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
49 * @var int $nombre_breve
63 function dependencia($codep) // ~X2C
65 $this->codep = $codep;
66 $dns = 'mysql://intranet:intranet@intranet-db/novedades';
67 $db = DB::connect($dsn);
68 if (DB::isError($db)) die ($db->getMessage("No pudo conectarse a la base"));
69 $sql = "SELECT nombre, nombre_breve
71 WHERE codigo_actual = '$this->codep' AND
72 dependencia_esta_activa = 1";
73 $result = $db->query($sql);
74 if(DB::isError($result))
75 die($result->getMessage("query mal hecho"));
76 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/novedades';
95 $db = DB::connect($dsn);
96 if (DB::isError($db)) die ($db->getMessage("No pudo conectarse a la base"));
99 WHERE codep = '$this->codep'";
100 $result = $db->query($sql);
101 if(DB::isError($result))
102 die($result->getMessage("query mal hecho"));
103 while($row = $result->fetchRow())
104 $agentes[] = new Agente($row[0]);
106 $dsn = 'mysql://intranet:intranet@intranet-db/Contratados';
107 $db = DB::connect($dsn);
108 if (DB::isError($db)) die ($db->getMessage("No pudo conectarse a la base"));
109 $sql = "SELECT nrodoc
111 WHERE codep = '$this->codep'";
112 $result = $db->query($sql);
113 if(DB::isError($result))
114 die($result->getMessage("query mal hecho"));
115 while($row = $result->fetchRow())
116 $agentes[] = new Agente($row[0]);
121 // +X2C Operation 150
123 * @return dependencia
127 function getDependencias() // ~X2C
129 $dsn = 'mysql://intranet:intranet@intranet-db/CODEP';
130 $db = DB::connect($dsn);
131 if (DB::isError($db)) die ($db->getMessage("No pudo conectarse a la base"));
132 $sql = "SELECT codigo_actual
134 WHERE dependencia_esta_activa = 1";
135 $result = $db->query($sql);
136 if(DB::isError($result))
137 die($result->getMessage("query mal hecho"));
138 $dependencias = array();
139 while($row = $result->fetchRow())
140 $dependencias[] = $row[0];
141 return $dependencias;
145 // +X2C Operation 165
150 function getNombre() // ~X2C
152 return $this->nombre;
156 // +X2C Operation 166
161 function getNombreBreve() // ~X2C
163 return $this->nombre_breve;
167 } // -X2C Class :Dependencia