1 <?php /* vim: set binary expandtab tabstop=4 shiftwidth=4 textwidth=80:
2 -------------------------------------------------------------------------------
3 Ministerio de EconomÃa
5 -------------------------------------------------------------------------------
6 This file is part of meconlib.
8 meconlib is free software; you can redistribute it and/or modify it under
9 the terms of the GNU General Public License as published by the Free
10 Software Foundation; either version 2 of the License, or (at your option)
13 meconlib is distributed in the hope that it will be useful, but WITHOUT
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
15 FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License; if not,
18 write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
19 Boston, MA 02111-1307 USA
20 -------------------------------------------------------------------------------
21 Creado: Thu Aug 11 15:17:11 2003
22 Autor: Manuel Nazar <manazar@mecon.gov.ar>
23 -------------------------------------------------------------------------------
24 $Id: Usuario.php 242 2003-08-11 18:02:16Z manazar $
25 -----------------------------------------------------------------------------*/
27 require_once 'DB.php';
29 // +X2C Class 131 :MECON_Usuario
56 var $dsn = 'mysql://intranet:intranet@bal747f.mecon.ar/usuario';
68 function ArmarconDNI($dni) // ~X2C
70 $db = DB::connect($this->dsn);
73 die ($db->getMessage("No pudo conectarse a la base"));
77 $sql = "SELECT login,nombre
80 $result = $db->query($sql);
81 $row = $result->fetchRow();
85 $this->nombre=$nombre;
94 * @param string $login
99 function ArmarconLOGIN($login) // ~X2C
101 $db = DB::connect($this->dsn);
102 if (DB::isError($db))
104 die ($db->getMessage("No pudo conectarse a la base"));
108 $sql = "SELECT dni,nombre
110 where login = '$login'";
111 $result = $db->query($sql);
112 $row = $result->fetchRow();
116 $this->nombre=$nombre;
122 // +X2C Operation 135
129 function MECON_Usuario($dni = NULL, $login = NULL) // ~X2C
133 $this->ArmarconDNI($dni);
134 $this->buscarUsuarioDNI($dni);
136 if(! is_null($login))
138 $this->ArmarconLOGIN($login);
139 $this->buscarUsuarioDNI($dni);
145 // +X2C Operation 136
152 function Insertar_Usuario($dni = NULL, $login = NULL, $nombre = NULL) // ~X2C
154 if((! is_null($dni)) && (! is_null($login)) && (! is_null($nombre)))
156 $db = DB::connect($this->dsn);
157 if (DB::isError($db))
159 die ($db->getMessage("No pudo conectarse a la base"));
163 $sql = "REPLACE INTO Usuario (login,dni,nombre)
164 values ('$login',$dni,'$nombre')";
165 $result = $db->query($sql);
171 // +X2C Operation 137
176 function getLogin() // ~X2C
182 // +X2C Operation 138
187 function getNombre() // ~X2C
189 return $this->nombre;
194 // +X2C Operation 154
201 function buscarUsuarioDNI($dni) // ~X2C
204 $dsn = 'mysql://intranet:intranet@intranet-db/novedades';
205 $db = DB::connect($dsn);
206 if (DB::isError($db)) die ($db->getMessage("No pudo conectarse a la base"));
207 $sql = "SELECT nombre
209 WHERE nrodoc = $dni";
210 $result = $db->query($sql);
211 if(DB::isError($result))
212 die($result->getMessage("query mal hecho"));
213 if($result->numRows() > 0)
215 $row = $result->fetchRow();
217 $this->nombre = $nombre;
221 $dsn = 'mysql://intranet:intranet@intranet-db/Contratados';
222 $db = DB::connect($dsn);
223 if (DB::isError($db)) die ($db->getMessage("No pudo conectarse a la base"));
224 $sql = "SELECT nombre
226 WHERE nrodoc = $dni";
227 $result = $db->query($sql);
228 if(DB::isError($result))
229 die($result->getMessage("query mal hecho"));
230 if($result->numRows() > 0)
232 $row = $result->fetchRow();
234 $this->nombre = $nombre;
243 } // -X2C Class :MECON_Usuario