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 Jun 19 16:54:08 2003
22 Autor: Gonzalo Merayo <gmeray@mecon.gov.ar>
23 -------------------------------------------------------------------------------
25 -----------------------------------------------------------------------------*/
27 #require_once 'PEAR.php';
28 require_once 'MECON/Agente.php';
29 require_once 'DB.php';
31 // +X2C Class 145 :Dependencia
35 class MECON_Dependencia {
49 * @var int $nombre_breve
63 function MECON_Dependencia($codep) // ~X2C
65 $this->codep = $codep;
66 $dsn = 'mysql://intranet:intranet@intranet-db.mecon.ar/CODEP';
67 $db = DB::connect($dsn);
69 die ($db->getMessage("No pudo conectarse a la base"));
70 $sql = "SELECT nombre, nombre_breve
72 WHERE codigo_actual = '$this->codep' AND
73 dependencia_esta_activa = 1";
74 $result = $db->query($sql);
75 if(DB::isError($result))
76 die($result->getMessage("query mal hecho"));
77 if($result->numRows() > 0) {
78 $row = $result->fetchRow(DB_FETCHMODE_ASSOC);
79 $this->nombre = $row['nombre'];
80 $this->nombre_breve = $row['nombre_breve'];
90 function getAgentes() // ~X2C
94 $dsn = 'mysql://intranet:intranet@intranet-db.mecon.ar/novedades';
95 $db = DB::connect($dsn);
97 die ($db->getMessage("No pudo conectarse a la base"));
100 WHERE codep = '$this->codep'";
101 $result = $db->query($sql);
102 if(DB::isError($result))
103 die($result->getMessage("query mal hecho"));
104 while($row = $result->fetchRow())
105 $agentes[] = new MECON_Agente($row[0]);
107 $dsn = 'mysql://intranet:intranet@intranet-db.mecon.ar/Contratados';
108 $db = DB::connect($dsn);
109 if (DB::isError($db))
110 die ($db->getMessage("No pudo conectarse a la base"));
111 $sql = "SELECT nrodoc
113 WHERE codep = '$this->codep'";
114 $result = $db->query($sql);
115 if(DB::isError($result))
116 die($result->getMessage("query mal hecho"));
117 while($row = $result->fetchRow())
118 $agentes[] = new MECON_Agente($row[0]);
123 // +X2C Operation 150
125 * @return dependencia
129 function getDependencias() // ~X2C
131 $dsn = 'mysql://intranet:intranet@intranet-db.mecon.ar/CODEP';
132 $db = DB::connect($dsn);
133 if (DB::isError($db))
134 die ($db->getMessage("No pudo conectarse a la base"));
135 $sql = "SELECT codigo_actual
137 WHERE dependencia_esta_activa = 1";
138 $result = $db->query($sql);
139 if(DB::isError($result))
140 die($result->getMessage("query mal hecho"));
141 $dependencias = array();
142 while($row = $result->fetchRow())
143 $dependencias[] = $row[0];
144 return $dependencias;
148 // +X2C Operation 165
153 function getNombre() // ~X2C
155 return $this->nombre;
159 // +X2C Operation 166
164 function getNombreBreve() // ~X2C
166 return $this->nombre_breve;
170 } // -X2C Class :Dependencia