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
54 function dependencia($codep) // ~X2C
56 $this->codep = $codep;
65 function getAgentes() // ~X2C
69 $dsn = 'mysql://intranet:intranet@intranet-db/novedades';
70 $db = DB::connect($dsn);
71 if (DB::isError($db)) die ($db->getMessage("No pudo conectarse a la base"));
74 WHERE codep = '$this->codep'";
75 $result = $db->query($sql);
76 if(DB::isError($result))
77 die($result->getMessage("query mal hecho"));
78 while($row = $result->fetchRow())
79 $agentes[] = new Agente($row[0]);
81 $dsn = 'mysql://intranet:intranet@intranet-db/Contratados';
82 $db = DB::connect($dsn);
83 if (DB::isError($db)) die ($db->getMessage("No pudo conectarse a la base"));
86 WHERE codep = '$this->codep'";
87 $result = $db->query($sql);
88 if(DB::isError($result))
89 die($result->getMessage("query mal hecho"));
90 while($row = $result->fetchRow())
91 $agentes[] = new Agente($row[0]);
102 function getDependencias() // ~X2C
104 $dsn = 'mysql://intranet:intranet@intranet-db/CODEP';
105 $db = DB::connect($dsn);
106 if (DB::isError($db)) die ($db->getMessage("No pudo conectarse a la base"));
107 $sql = "SELECT codigo_actual
109 WHERE dependencia_esta_activa = 1";
110 $result = $db->query($sql);
111 if(DB::isError($result))
112 die($result->getMessage("query mal hecho"));
113 $dependencias = array();
114 while($row = $result->fetchRow())
115 $dependencias[] = $row[0];
116 return $dependencias;
120 } // -X2C Class :Dependencia