2 // vim: set expandtab tabstop=4 softtabstop=4 shiftwidth=4:
3 // +----------------------------------------------------------------------+
5 // +----------------------------------------------------------------------+
6 // | Copyright (c) 1997-2003 The PHP Group |
7 // +----------------------------------------------------------------------+
8 // | This source file is subject to version 2.02 of the PHP license, |
9 // | that is bundled with this package in the file LICENSE, and is |
10 // | available at through the world-wide-web at |
11 // | http://www.php.net/license/2_02.txt. |
12 // | If you did not receive a copy of the PHP license and are unable to |
13 // | obtain it through the world-wide-web, please send a note to |
14 // | license@php.net so we can mail you a copy immediately. |
15 // +----------------------------------------------------------------------+
16 // | Created: Thu Jun 19 16:54:08 2003
17 // | Author: Gonzalo Merayo <gmeray@mecon.gov.ar>
18 // +----------------------------------------------------------------------+
27 #require_once 'PEAR.php';
28 require_once 'MECON/Agente.php';
29 require_once 'DB.php';
33 // +X2C Class 145 :Dependencia
53 function dependencia($codep) // ~X2C
55 $this->codep = $codep;
64 function getAgentes() // ~X2C
68 $dsn = 'mysql://intranet:intranet@intranet-db/novedades';
69 $db = DB::connect($dsn);
70 if (DB::isError($db)) die ($db->getMessage("No pudo conectarse a la base"));
73 WHERE codep = $this->codep";
74 $result = $db->query($sql);
75 if(DB::isError($result))
76 die($result->getMessage("query mal hecho"));
77 while($row = $result->fetchRow())
78 $agentes[] = new Agente($row[0]);
80 $dsn = 'mysql://intranet:intranet@intranet-db/Contratados';
81 $db = DB::connect($dsn);
82 if (DB::isError($db)) die ($db->getMessage("No pudo conectarse a la base"));
85 WHERE codep = $this->codep";
86 $result = $db->query($sql);
87 if(DB::isError($result))
88 die($result->getMessage("query mal hecho"));
89 while($row = $result->fetchRow())
90 $agentes[] = new Agente($row[0]);
101 function getDependencias() // ~X2C
103 $dsn = 'mysql://intranet:intranet@intranet-db/CODEP';
104 $db = DB::connect($dsn);
105 if (DB::isError($db)) die ($db->getMessage("No pudo conectarse a la base"));
106 $sql = "SELECT codigo_actual
108 WHERE dependencia_esta_activa = 1";
109 $result = $db->query($sql);
110 if(DB::isError($result))
111 die($result->getMessage("query mal hecho"));
112 $dependencias[] = array();
113 while($row = $result->fetchRow())
114 $dependencias[] = $row[0];
115 return $dependencias;
119 } // -X2C Class :Dependencia