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: Tue May 27 17:05:58 2003
17 // | Author: Martin Marrese - Myrna Degano <mmarre@mecon.gov.ar - mdegan@mecon.gov.ar>
18 // +----------------------------------------------------------------------+
27 #require_once 'PEAR.php';
28 require_once 'Sistema.php';
29 require_once 'Usuario.php';
30 require_once 'Permiso.php';
31 require_once 'Perfil.php';
35 // +X2C Class 274 :Samurai
43 * Identificador del sistema.
45 * @var int $id_sistema
64 * Constructor. Recibe como parametro el identificador del sistema.
66 * @param Samurai_DB &$db Objeto conexion
67 * @param int $idSistema Indetificador del sistema
73 function Samurai(&$db, $idSistema = null) // ~X2C
75 $this->_id_sistema = $idSistema;
82 * Devuleve un array con los identificadores de todos los sistemas.
84 * @return array(Sistema)
88 function _getIdSistemas() // ~X2C
91 $sql = include 'Samurai/consultas.php';
92 $dbh = $this->_db->prepare($sql['obtener_id_sistemas']);
93 $res = $this->_db->execute($dbh);
94 while ($re = $res->fetchrow(DB_FETCHMODE_ASSOC)) {
95 array_push($rta,$re['id_sistema']);
102 // +X2C Operation 285
104 * Arma el array de sistemas
106 * @return array(Sistema)
110 function _armarArraySistemas() // ~X2C
113 foreach ($this->_getIdSistemas() as $id) {
114 $tmp = new Sistema($this->_db,$id);
115 array_push($rta, $tmp);
121 // +X2C Operation 286
123 * Devuelve el array de sistemas
125 * @return array(Sistema)
129 function getSistemas() // ~X2C
131 return $this->_armarArraySistemas();
135 // +X2C Operation 287
137 * Devuelve el identificador maximo de un sistema que hay en base
143 function getMaxIdSistema() // ~X2C
145 $sql = include 'Samurai/consultas.php';
146 $dbh = $this->_db->prepare($sql['obtener_max_id_sistemas']);
147 $res = $this->_db->execute($dbh);
148 $re = $res->fetchrow(DB_FETCHMODE_ASSOC);
150 return $re['id_sistema'];
154 } // -X2C Class :Samurai