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"));
109 //$login = ereg_replace ("@", "\\\@", $login);
110 $sql = "SELECT dni,nombre
112 where login = '$login'";
113 $result = $db->query($sql);
114 if ($result->NumRows()>0){
116 $row = $result->fetchRow();
120 $this->nombre=$nombre;
127 // +X2C Operation 135
134 function MECON_Usuario($dni = NULL, $login = NULL) // ~X2C
138 $this->ArmarconDNI($dni);
139 $this->buscarUsuarioDNI($dni);
141 if(! is_null($login))
143 $this->ArmarconLOGIN($login);
144 $this->buscarUsuarioDNI($this->getDni());
150 // +X2C Operation 136
157 function Insertar_Usuario($dni = NULL, $login = NULL, $nombre = NULL) // ~X2C
159 if((! is_null($dni)) && (! is_null($login)) && (! is_null($nombre)))
161 $db = DB::connect($this->dsn);
162 if (DB::isError($db))
164 die ($db->getMessage("No pudo conectarse a la base"));
168 $sql = "REPLACE INTO Usuario (login,dni,nombre)
169 values ('$login',$dni,'$nombre')";
170 $result = $db->query($sql);
176 // +X2C Operation 136
181 function getDni() // ~X2C
187 // +X2C Operation 137
192 function getLogin() // ~X2C
198 // +X2C Operation 138
203 function getNombre() // ~X2C
205 return $this->nombre;
210 // +X2C Operation 154
217 function buscarUsuarioDNI($dni) // ~X2C
220 $dsn = 'mysql://intranet:intranet@intranet-db/novedades';
221 $db = DB::connect($dsn);
222 if (DB::isError($db)) die ($db->getMessage("No pudo conectarse a la base"));
223 $sql = "SELECT nombre
225 WHERE nrodoc = $dni";
226 $result = $db->query($sql);
227 if(DB::isError($result))
228 die($result->getMessage("query mal hecho"));
229 if($result->numRows() > 0)
231 $row = $result->fetchRow();
233 $this->nombre = $nombre;
237 $dsn = 'mysql://intranet:intranet@intranet-db/Contratados';
238 $db = DB::connect($dsn);
239 if (DB::isError($db)) die ($db->getMessage("No pudo conectarse a la base"));
240 $sql = "SELECT nombre
242 WHERE nrodoc = $dni";
243 $result = $db->query($sql);
244 if(DB::isError($result))
245 die($result->getMessage("query mal hecho"));
246 if($result->numRows() > 0)
248 $row = $result->fetchRow();
250 $this->nombre = $nombre;
259 } // -X2C Class :MECON_Usuario