From 1b946b6e47650fa5465986e2164fbaecdb46e393 Mon Sep 17 00:00:00 2001 From: Leandro Lucarella Date: Sun, 25 Jul 2004 02:12:59 +0000 Subject: [PATCH] Se borran cosas que no entran en mlib. --- TODO | 6 +- lib/MECON/Agente.php | 215 ----- lib/MECON/Dependencia.php | 252 ----- lib/MECON/Legajos/Estudios.php | 93 -- lib/MECON/Legajos/ExperienciaLaboral.php | 121 --- lib/MECON/Legajos/Familiares.php | 128 --- lib/MECON/Marco.php | 326 ------- lib/MECON/Novedad.php | 84 -- lib/MECON/NovedadesDia.php | 186 ---- lib/MECON/Usuario.php | 302 ------ lib/MECON/includes/no_autorizado.html | 33 - pear_lib_tmp/HTML/Page.php | 1074 --------------------- pear_lib_tmp/HTML/Select.php | 329 ------- pear_lib_tmp/Numbers/Words/lang.es_AR.php | 468 --------- test/prueba_agente.php | 20 - test/prueba_dependencia.php | 11 - 16 files changed, 5 insertions(+), 3643 deletions(-) delete mode 100644 lib/MECON/Agente.php delete mode 100644 lib/MECON/Dependencia.php delete mode 100644 lib/MECON/Legajos/Estudios.php delete mode 100644 lib/MECON/Legajos/ExperienciaLaboral.php delete mode 100644 lib/MECON/Legajos/Familiares.php delete mode 100644 lib/MECON/Marco.php delete mode 100644 lib/MECON/Novedad.php delete mode 100644 lib/MECON/NovedadesDia.php delete mode 100644 lib/MECON/Usuario.php delete mode 100644 lib/MECON/includes/no_autorizado.html delete mode 100644 pear_lib_tmp/HTML/Page.php delete mode 100644 pear_lib_tmp/HTML/Select.php delete mode 100644 pear_lib_tmp/Numbers/Words/lang.es_AR.php delete mode 100755 test/prueba_agente.php delete mode 100755 test/prueba_dependencia.php diff --git a/TODO b/TODO index beb3f39..52930dc 100644 --- a/TODO +++ b/TODO @@ -1,3 +1,7 @@ $Id$ -- Falta sacar la debependencia de la DB de Banda. +* Modificar HIT como habíamos charlado y congelar su API para poder + empezar a usarla. +* Empezar a meter HIT en alguna clase de prueba y empezar a másticar + mejor como encajaría en todo esto. + diff --git a/lib/MECON/Agente.php b/lib/MECON/Agente.php deleted file mode 100644 index 38b6fd2..0000000 --- a/lib/MECON/Agente.php +++ /dev/null @@ -1,215 +0,0 @@ - -------------------------------------------------------------------------------- -$Id$ ------------------------------------------------------------------------------*/ - -require_once 'DB.php'; -require_once 'MECON/Tiempo/Hora.php'; - -/** - * @access public - */ -class MECON_Agente { - - /** - * Documento del agente. - */ - var $agente; - - /** - * Datos del agente - */ - var $datos=array(); - - /** - * @return string - */ - function getDependencia() - { - if(in_array('codep',array_keys($this->datos))) - return $this->datos['codep'];//TODO esta no es la columna correcta - else - return false; - } - - /** - * @return void - * @access public - */ - function getTipo() - { - if(in_array('marco_legal',array_keys($this->datos))) - return 'CON '.$this->datos['marco_legal']; - elseif(in_array('tipo_agente',array_keys($this->datos))) - return $this->datos['tipo_agente']; - else - return false; - } - - /** - * @param dbh $db - * @param int $agente - * - * @return void - * @access public - */ - function MECON_Agente(&$db,$agente=null) - { - $this->_db = $db; - //$this->_db = DB::connect('mysql://intranet:intranet@intranet-db.mecon.ar/novedades'); - if(! is_null($agente)) { - $this->buscarAgente($agente); - } - } - - /** - * @return void - * @access public - */ - function getNombre() - { - if(in_array('nombre',array_keys($this->datos))) - return $this->datos['nombre']; - else - return false; - } - - /** - * @return void - * @access public - */ - function getHoraDesde() - { - if(in_array('hora_desde',$this->datos)) - return new MECON_Tiempo_Hora($this->datos['hora_desde']); - elseif(in_array('hentra',$this->datos)) - return new MECON_Tiempo_Hora($this->datos['hentra']); - else - return false; - } - - /** - * @return void - * @access public - */ - function getHoraHasta() - { - if(in_array('hora_hasta',$this->datos)) - return new MECON_Tiempo_Hora($this->datos['hora_hasta']); - elseif(in_array('hsale',$this->datos)) - return new MECON_Tiempo_Hora($this->datos['hsale']); - else - return false; - } - - /** - * @return void - * @access public - */ - function getCuil() - { - if(in_array('cuil',$this->datos)) - { - $aux = $this->datos['cuil']; - $aux = preg_replace('/(\d{2})(\d*)(\d{1})/','$1-$2-$3',$aux); - return $aux; - }else - { - return false; - } - } - - /** - * @return void - * @access public - */ - function getOtrosDatos() - { - if(!is_null($this->datos['tipo_agente'])) { - $aux['tipo_doc'] = $this->datos['tipodoc']; - $aux['fecha_nac'] = $this->datos['fecha_nac']; - $aux['edad'] = $this->datos['edad']; - $aux['estado_civil'] = $this->datos['estado_civil']; - $aux['domicilio'] = $this->datos['domicilio']; - $aux['puerta'] = $this->datos['num_puerta']; - $aux['piso'] = $this->datos['piso']; - $aux['depto'] = $this->datos['depto']; - $aux['localidad'] = $this->datos['localidad']; - $aux['provincia'] = $this->datos['provincia']; - $aux['calle1'] = $this->datos['calle1']; - $aux['calle2'] = $this->datos['calle2']; - $aux['cp'] = $this->datos['cp']; - $aux['telefono'] = $this->datos['telefono']; - $aux['cargo'] = $this->datos['cargo']; - $aux['nivel'] = $this->datos['nivel']; - $aux['grado'] = $this->datos['grado']; - $aux['func_ejec'] = $this->datos['func_ejec']; - $aux['obra_social'] = $this->datos['obra_social']; - $aux['afiliado'] = $this->datos['afiliado']; - $aux['conyuge'] = $this->datos['conyuge']; - $aux['fecha_nac_conyuge'] = $this->datos['fecha_nac_cony']; - $aux['tipo_doc_conyuge'] = $this->datos['tipodoc_cony']; - $aux['nro_doc_cony'] = $this->datos['nrodoc_cony']; - return $aux; - } else { - return false; - } - } - - /** - * @param int $agente - * - * @return void - * @access public - */ - function buscarAgente($agente) - { - $this->agente = $agente; - $sql = "SELECT * - FROM novedades.web003 - WHERE nrodoc = ".$agente." AND tipo_agente <> 'AUT'"; - $result = $this->_db->query($sql); - if(DB::isError($result)) - trigger_error($result->getMessage("query mal hecho"), E_USER_ERROR); - if($result->numRows() > 0) { - $this->datos = $result->fetchRow(DB_FETCHMODE_ASSOC); - } else { - $sql = "SELECT * - FROM Contratados.Contratados - WHERE nrodoc = ".$agente; - $result = $this->_db->query($sql); - if(DB::isError($result)) { - trigger_error($result->getMessage("query mal hecho"), E_USER_ERROR); - } - if($result->numRows() > 0) { - $this->datos = $result->fetchRow(DB_FETCHMODE_ASSOC); - } else { - return false; - } - } - return true; - } - -} -?> \ No newline at end of file diff --git a/lib/MECON/Dependencia.php b/lib/MECON/Dependencia.php deleted file mode 100644 index 6b01f1f..0000000 --- a/lib/MECON/Dependencia.php +++ /dev/null @@ -1,252 +0,0 @@ - -------------------------------------------------------------------------------- -$Id$ ------------------------------------------------------------------------------*/ - -#require_once 'PEAR.php'; -require_once 'MECON/Agente.php'; -require_once 'DB.php'; - -/** - * @access protected - */ -class MECON_Dependencia { - - /** - * @protected - */ - var $_dbh; - - /** - * @protected - */ - var $_database; - - /** - * @var int $codep - * @access public - */ - var $codep; - - /** - * @var int $nombre - * @access public - */ - var $nombre; - - /** - * @var int $nombre_breve - * @access public - */ - var $nombre_breve; - - /** - * Id de la dependencia en la base. - * - * @var int $dependencia_id - * @access public - */ - var $dependencia_id = null; - - /** - * @param string $codep - * @param int $id - * - * @return void - * @access public - */ - function MECON_Dependencia(&$db, $codep, $id = null, $database = 'CODEP') - { - $this->_db = $db; - $this->_database = $database; - - if(!is_null($codep)) { - $this->codep = $codep; - - $sql = "SELECT nombre, nombre_breve, dependencia_id, codigo_actual - FROM ".$database.".Dependencias - WHERE codigo_actual = '".$this->codep."' AND - dependencia_esta_activa = 1"; - - $result = $this->_db->query($sql); - } - else { - $this->dependencia_id = $id; - - $sql = "SELECT nombre, nombre_breve, dependencia_id, codigo_actual - FROM ".$database.".Dependencias - WHERE dependencia_id = ".$this->dependencia_id." AND - dependencia_esta_activa = 1"; - $result = $this->_db->query($sql); - } - - if(DB::isError($result)) - trigger_error($result->getMessage("query mal hecho"), E_USER_ERROR); - - if($result->numRows() > 0) { - $row = $result->fetchRow(DB_FETCHMODE_ASSOC); - $this->codep = $row['codigo_actual']; - $this->nombre = $row['nombre']; - $this->nombre_breve = $row['nombre_breve']; - $this->dependencia_id = $row['dependencia_id']; - } - } - - - /** - * @return void - * @access public - */ - function getAgentes() - { - //Planta y becarios - $agentes = array(); - $sql = "SELECT nrodoc - FROM novedades.web003 - WHERE codep = '".$this->codep."'"; - $result = $this->_db->query($sql); - if(DB::isError($result)) - trigger_error($result->getMessage("query mal hecho"), E_USER_ERROR); - while($row = $result->fetchRow()) - $agentes[$row[0]] = new MECON_Agente($this->_db, $row[0]); - //Contratados - $sql = "SELECT nrodoc - FROM Contratados.Contratados - WHERE codep = '".$this->codep."'"; - $result = $this->_db->query($sql); - if(DB::isError($result)) - trigger_error($result->getMessage("query mal hecho"), E_USER_ERROR); - while($row = $result->fetchRow()) - $agentes[$row[0]] = new MECON_Agente($this->_db, $row[0]); - return $agentes; - } - - - /** - * @return dependencia - * @access public - * @static - */ - function getDependencias() - { - $base = (isset($this->_database))? $this->_database : "CODEP"; - $sql = "SELECT codigo_actual - FROM ".$base.".Dependencias - WHERE dependencia_esta_activa = 1"; - $result = $this->_db->query($sql); - if(DB::isError($result)) - trigger_error($result->getMessage("query mal hecho"), E_USER_ERROR); - $dependencias = array(); - while($row = $result->fetchRow()) - $dependencias[] = $row[0]; - return $dependencias; - } - - - /** - * @return void - * @access public - */ - function getNombre() - { - return $this->nombre; - } - - - /** - * @return void - * @access public - */ - function getNombreBreve() - { - return $this->nombre_breve; - } - - - - /** - * Buscar dependencias por el codep. - * - * @param db &$dbh Base de Datos - * @param string $codep COdigo de dependencia, o parte del mismo seguido del comodIn (*) - * - * @return array - * @access public - * @static - */ - function buscarPorCodigo(&$dbh, $codep, $database = 'CODEP') - { - //Reemplazar el comodín - $codep = preg_replace ('/\*/', '%', $codep); - - $sql = " SELECT codigo_actual, codigo_comdoc, nombre, - dependencia_id, nombre_breve - FROM ".$database.".Dependencias - WHERE dependencia_esta_activa = 1 - AND codigo_actual LIKE '".$codep."' - ORDER BY codigo_actual "; - - $dbh->setFetchMode(DB_FETCHMODE_ASSOC); - $result = $dbh->query($sql); - - return $result; - } - - - - /** - * @param db &$dbh Base de Datos - * @param string $clave Cadena de palabras clave del nombre de la dependencia. - * - * @return array - * @access public - * @static - */ - function buscarPorNombre(&$dbh, $clave, $database = 'CODEP') - { - //ReducciOn de espacios en blanco - $clave = preg_replace ('/\s+/', ' ', $clave); - - $sql = " SELECT codigo_actual, codigo_comdoc, nombre, dependencia_id, - nombre_breve - FROM ".$database.".Dependencias - WHERE dependencia_esta_activa = 1 "; - - //Separar la cadena de palabras clave - $items = split(' ', $clave); - foreach ($items as $i){ - $sql.= " AND nombre like '%".$i."%' "; - } - - $sql.= " ORDER BY codigo_actual"; - - $dbh->setFetchMode(DB_FETCHMODE_ASSOC); - $result = $dbh->query($sql); - - return $result; - } - - -} -?> \ No newline at end of file diff --git a/lib/MECON/Legajos/Estudios.php b/lib/MECON/Legajos/Estudios.php deleted file mode 100644 index 60a1060..0000000 --- a/lib/MECON/Legajos/Estudios.php +++ /dev/null @@ -1,93 +0,0 @@ - | -// +--------------------------------------------------------------------+ -// -// $Id: Intranet_Legajos_Estudios.php 23 2003-07-15 18:56:42Z msklar $ -// - - - -// +X2C includes -require_once 'DB.php'; -// ~X2C - -// +X2C Class 163 :Servicios_Legajos_Estudios -/** - * Estudios del agente - * - * @access public - */ -// XXX - Pregunta llucar: POR QUE CATSO HEREDA DE DB??? -class MECON_Legajos_Estudios extends DB { - /** - * @var int $agente - * @access public - */ - var $agente; - - /** - * @var int $datos - * @access public - */ - var $datos; - - // ~X2C - - // +X2C Operation 166 - /** - * @param int $agente - * - * @return void - * @access public - */ - function MECON_Legajos_Estudios($db,$agente) // ~X2C - { - $this->agente = $agente; - $sql = "SELECT * - FROM novedades.web005 - WHERE documento = $agente"; - $result = $db->query($sql); - if (DB::isError($result)) - trigger_error($result->getMessage('Query mal hecho'), E_USER_ERROR); - - for ($fila = 0; $fila < $result->numRows(); $fila++) { - $this->datos[$fila] = $result->fetchRow(DB_FETCHMODE_ASSOC); - } - } - // -X2C - - // +X2C Operation 172 - /** - * @return void - * @access public - */ - function getEstudios() // ~X2C - { - return $this->datos; - } - // -X2C - -} // -X2C Class :Servicios_Legajos_Estudios -?> diff --git a/lib/MECON/Legajos/ExperienciaLaboral.php b/lib/MECON/Legajos/ExperienciaLaboral.php deleted file mode 100644 index 27d8f89..0000000 --- a/lib/MECON/Legajos/ExperienciaLaboral.php +++ /dev/null @@ -1,121 +0,0 @@ - | -// +--------------------------------------------------------------------+ -// -// $Id: Intranet_Legajos_ExperienciaLaboral.php 23 2003-07-15 18:56:42Z msklar $ -// - -// +X2C includes -require_once 'DB.php'; -// ~X2C - -// +X2C Class 155 :Servicios_Legajos_ExperienciaLaboral -/** - * Antigüedad laboral del agente - * - * @access public - */ -// XXX - Pregunta llucar: POR QUE CATSO HEREDA DE DB??? -class MECON_Legajos_ExperienciaLaboral extends DB { - /** - * @var int $agente - * @access public - */ - var $agente; - - /** - * @var int $antiguedad - * @access public - */ - var $antiguedad; - - /** - * @var int $experiencia - * @access public - */ - var $experiencia; - - // ~X2C - - // +X2C Operation 159 - /** - * @param int $agente - * - * @return void - * @access public - */ - function MECON_Legajos_ExperienciaLaboral($db,$agente) // ~X2C - { - $this->agente = $agente; - $sql = "SELECT * - FROM novedades.web032 - WHERE nrodoc = $agente - ORDER BY desde"; - $result_exp = $db->query($sql); - if (DB::isError($result_exp)) - trigger_error($result_exp->getMessage('Query mal hecho'), E_USER_ERROR); - - for ($fila = 0; $fila < $result_exp->numRows(); $fila++) { - $this->experiencia[$fila] = $result_exp->fetchRow(DB_FETCHMODE_ASSOC); - } - - $sql = "SELECT * - FROM novedades.web031 - WHERE nrodoc = $agente"; - $result_ant = $db->query($sql); - if (DB::isError($result_ant)) - trigger_error($result_ant->getMessage('Query mal hecho'), E_USER_ERROR); - - if ($result_ant->numRows() > 0) { - $this->antiguedad = $result_ant->fetchRow(DB_FETCHMODE_ASSOC); - } - - } - // -X2C - - // +X2C Operation 160 - /** - * @return void - * @access public - */ - function getAntiguedad() // ~X2C - { - return $this->antiguedad; - } - // -X2C - - // +X2C Operation 161 - /** - * @return void - * @access public - */ - function getExperiencia() // ~X2C - { - return $this->experiencia; - } - // -X2C - -} // -X2C Class :Servicios_Legajos_ExperienciaLaboral -?> diff --git a/lib/MECON/Legajos/Familiares.php b/lib/MECON/Legajos/Familiares.php deleted file mode 100644 index 195480d..0000000 --- a/lib/MECON/Legajos/Familiares.php +++ /dev/null @@ -1,128 +0,0 @@ - | -// +--------------------------------------------------------------------+ -// -// $Id: Intranet_Legajos_Familiares.php 23 2003-07-15 18:56:42Z msklar $ -// - -// +X2C includes -require_once 'DB.php'; -// ~X2C - -// +X2C Class 154 :Servicios_Legajos_Familiares -/** - * @access public - */ -// XXX - Pregunta llucar: POR QUE CATSO HEREDA DE DB??? -class MECON_Legajos_Familiares extends DB { - /** - * @var int $agente - * @access public - */ - var $agente; - - /** - * @var int $datos - * @access public - */ - var $datos; - - // ~X2C - - // +X2C Operation 169 - /** - * @param int $agente - * - * @return void - * @access public - */ - function MECON_Legajos_Familiares($db,$agente) // ~X2C - { - $this->agente = $agente; - $sql = "SELECT * - FROM novedades.web004 - WHERE documento = $agente"; - $result = $db->query($sql); - if (DB::isError($result)) - trigger_error($result->getMessage('Query mal hecho'), E_USER_ERROR); - - for ($fila = 0; $fila < $result->numRows(); $fila++) { - $this->datos[$fila] = $result->fetchRow(DB_FETCHMODE_ASSOC); - } - } - // -X2C - - // +X2C Operation 170 - /** - * @return void - * @access public - */ - function getHijos() // ~X2C - { - $aux = array(); - $fila = 0; - if(is_array($this->datos)) { - foreach (array_keys($this->datos) as $key) { - if($this->datos[$key]['parentesco']=='H') { - $aux[$fila]['nombre'] = $this->datos[$key]['nombre']; - $aux[$fila]['tipo_doc'] = $this->datos[$key]['tipodoc']; - $aux[$fila]['nro_doc'] = $this->datos[$key]['nrodoc']; - $aux[$fila]['fecha_nac'] = $this->datos[$key]['fecha_nac']; - $aux[$fila]['parentesco'] = $this->datos[$key]['parentesco']; - $fila++; - } - } - } - return $aux; - } - // -X2C - - // +X2C Operation 171 - /** - * @return void - * @access public - */ - function getFamiliares() // ~X2C - { - $aux = array(); - $fila = 0; - if(is_array($this->datos)) { - foreach (array_keys($this->datos) as $key) { - if($this->datos[$key]['parentesco']!="H") { - $aux[$fila]['nombre'] = $this->datos[$key]['nombre']; - $aux[$fila]['tipo_doc'] = $this->datos[$key]['tipodoc']; - $aux[$fila]['nro_doc'] = $this->datos[$key]['nrodoc']; - $aux[$fila]['fecha_nac'] = $this->datos[$key]['fecha_nac']; - $aux[$fila]['parentesco'] = $this->datos[$key]['parentesco']; - $fila++; - } - } - } - return $aux; - } - // -X2C - -} // -X2C Class :Servicios_Legajos_Familiares -?> diff --git a/lib/MECON/Marco.php b/lib/MECON/Marco.php deleted file mode 100644 index 6adc181..0000000 --- a/lib/MECON/Marco.php +++ /dev/null @@ -1,326 +0,0 @@ - -------------------------------------------------------------------------------- -$Id$ ------------------------------------------------------------------------------*/ - -require_once 'PEAR.php'; -require_once 'MECON/Marco/Copete.php'; -require_once 'MECON/Marco/Menu.php'; -require_once 'MECON/Marco/MenuPrincipal.php'; - -//Agregado para el uso de HTML_Page (Uso la version Original de Pear) -require_once 'MECON/HTML/Page.php'; -require_once 'HTML/Table.php'; - -//Defino los directorios por default -define ('DIR_IMAGENES', 'images'); -define ('DIR_ESTILOS' , 'css' ); -define ('DIR_JS' , 'js' ); -define ('DIR_WWW' , 'www' ); -define ('DIR_CACHE' , '/tmp' ); - -//Defino las constantes -define ('SCRIPT_DIR_BASE', '/MECON/js/' ); -define ('ESTILO_DIR_BASE', '/MECON/css/'); -define ('SCRIPT_GENERICO', 'marco.js' ); -define ('ESTILO_GENERICO', 'marco.css' ); - -/** - * Clase encargada del manejo del Marco de los sistemas. - * - * @access public - */ -class MECON_Marco extends MECON_HTML_Page { - /** - * Array con los datos de configuracion del sistema. - * - * @var array $configuracion - * @access private - */ - var $_configuracion; - - /** - * Mantiene el estado de los espacios - * - * @var bool $espacios - * @access private - */ - var $_espacios = true; - - /** - * Menu vertical para agregar en la pantalla. - * - * @var mixed $menuVertical - * @access private - */ - var $_menuVertical = null; - - /** - * Mantiene el estado de los links en la pagina. (True habilitados, False no) - * - * @var bool $links - * @access private - */ - var $_links = true; - - /** - * Constructor. Recibe como parametro el path del archivo de configuracion - * - * @param string $arch_configuracion indicacion de la ubicacion y nombre del archivo de configuracion - * @param MECON_Perm $obj_permiso Objeto Permisos - * - * @return void - * @access public - */ - function MECON_Marco($arch_configuracion, $obj_permiso = null) - { - //Creo el objeto pagina - parent::MECON_HTML_Page(); - //Obtengo y arreglo la configuracion - $this->_obtenerConfiguracion($arch_configuracion); - //Agrego el objeto permiso a la configuracion - if (@$obj_permiso) { - $this->_configuracion['obj_permiso'] = $obj_permiso; - } - //Agrego el estilo y el script genericos - $this->addScript(SCRIPT_DIR_BASE.SCRIPT_GENERICO); - $this->addStyleSheet(ESTILO_DIR_BASE.ESTILO_GENERICO); - //Seteo el titulo - $this->setTitle($this->_configuracion['titulo_sistema']); - $this->_configuracion['subtitulo'] = ''; - $this->_configuracion['titulo_sistema2'] = ''; - } - - /** - * Funcion que se encarga de la obtencion y generacion del array de configuracion. Recibe como parametro el path del archivo de configuracion - * - * @param string $archivo Archivo de configuracion del sistema - * - * @return array - * @access private - */ - function _obtenerConfiguracion($archivo) - { - $this->_configuracion = include $archivo; - //Verifico que existan los directorios, si no es asi los reemplazo por los defaults - if (!@$this->_configuracion['directorios']['root']) { - trigger_error('Es obligatorio ingresar el directorio root!', E_USER_ERROR); - } - if (!@$this->_configuracion['directorios']['imagenes']){ - $this->_configuracion['directorios']['imagenes'] = $this->_configuracion['directorios']['root'].'/'.DIR_IMAGENES; - } - if (!@$this->_configuracion['directorios']['estilos']){ - $this->_configuracion['directorios']['estilos'] = $this->_configuracion['directorios']['root'].'/'.DIR_ESTILOS; - } - if (!@$this->_configuracion['directorios']['js']){ - $this->_configuracion['directorios']['js'] = $this->_configuracion['directorios']['root'].'/'.DIR_JS; - } - if (!@$this->_configuracion['directorios']['www']){ - $this->_configuracion['directorios']['www'] = $this->_configuracion['directorios']['root'].'/'.DIR_WWW; - } - if (!@$this->_configuracion['directorios_fs']['cache']){ - $this->_configuracion['directorios_fs']['cache'] = DIR_CACHE; - } - } - - /** - * Redefinicion de la funcion que permite agregar objetos o html al body de la pagina -Si es un objeto debe tener un metodo toHtml y opcionalmente puede tener un getCSS. -@deprecated - * - * @param Mixed $body Mixed. Recibe el contenido a agregar como body de la pagina - * - * @return void - * @access public - */ - function addBody($body) - { - $this->addBodyContent($body); - } - - /** - * Funcion que permite concatenar lo pasado como parametro al titulo del sistema - * - * @param string $titulo String que se quiere agregar al titulo del sistema - * - * @return void - * @access public - */ - function addTitle($titulo) - { - $this->_configuracion['titulo_sistema2'].= ' - '.$titulo; - } - - /** - * Setea la variable que define si hay que separar el body del menu - * - * @param bool $espacios Si es verdadero agrega los espacios, sino los elimina - * - * @return void - * @access public - */ - function setEspacios($espacios = true) - { - $this->_espacios = $espacios; - } - - /** - * Agrega un menu vertical a la izquierda en la pantalla. - * - * @param mixed $menuVertical Objeto u Html que representa el menu a mostrar. - * - * @return void - * @access public - */ - function addMenuVertical($menuVertical) - { - if ((is_object($menuVertical)) && (method_exists($menuVertical, 'getcss'))) { - $this->addStyleSheet($menuVertical->getCSS()); - } - $this->_menuVertical = $menuVertical; - } - - /** - * Permite habilitar o deshabilitar los links de una pagina (todos) - * - * @param bool $param True habilita los links, False no. - * - * @return void - * @access public - */ - function habilitarLinks($param = true) - { - $this->_links = $param; - } - - /** - * Devuelve el html de la pagina - * - * @return string - * @access public - */ - function toHTML() - { - //Seteo el titulo de la pagina - parent::setTitle($this->_configuracion['titulo_sistema'].$this->_configuracion['titulo_sistema2']); - //Agrego la opcion seleccionada de links a la configuracion - $this->_configuracion['links'] = $this->_links; - //Agrego la opcion seleccionada de espacios a la configuracion - $this->_configuracion['espacios'] = $this->_espacios; - //Creo el menu principal - $menu = new MECON_Marco_MenuPrincipal ($this->_configuracion); - //Agrego el contenido de la pagina - $body = array ( 'body' => $this->_body, 'menuVertical' => $this->_menuVertical); - //Page - //Agrego el contenido al menu - $menu->addBody($body); - //Agrego el Marco completo a Page - $this->setBody('
'); - foreach ($menu->resultado AS $res) { - $this->addBodyContent($res); - } - $this->addBodyContent('
'); - return parent::toHTML(); - } - - /** - * Funcion que permite concatenar lo pasado como parametro al titulo del sistema - * - * @param string $subtitulo Subtitulo a agregar - * - * @return void - * @access public - */ - function addSubTitle($subtitulo) - { - if (is_a($subtitulo, 'mecon_html_link')) { - $subtitulo->updateAttributes( - array('class' => 'mecon_marco_subtitle')); - } - if (method_exists($subtitulo, 'tohtml')) { - $subtitulo = $subtitulo->toHtml(); - } - $this->_configuracion['subtitulo'] .= ' - ' . $subtitulo; - } - - /** - * Concatena lo pasado por parametro al titulo del sistema - * - * @param string $titulo Titulo a agregar. Si se pasa vacio se borra lo que pudiera estar - * - * @return void - * @access public - */ - function setTitle($titulo = '') - { - $this->_configuracion['titulo_sistema2'] = ($titulo) ? ' - '.$titulo : - ''; - } - - /** - * Concatena lo pasado por parametro al titulo de seccion - * - * @param string $subtitulo Setea el subtitulo. Si se pasa vacio borra lo que pudiera estar. - * - * @return void - * @access public - */ - function setSubtitle($subtitulo = '') - { - $this->_configuracion['subtitulo'] = ($subtitulo) ? ' - '.$subtitulo : - ''; - } - - /** - * Permite hacer que en el copete aparezca un icono de ayuda, en un lugar predefinido. Sobreescribe lo seteado anteriormente por cualquier metodo. - * - * @param mixed $ayuda Objeto MECON_HTML_Link o string para utilizar en el map. - * - * @return void - * @access public - */ - function setAyuda($ayuda) - { - $this->_configuracion['ayuda'] = $ayuda; - } - - /** - * Permite obtener el array de configuracion completo. En caso de recibir una clave como parametro devuelve su valor. Solo se tienen en cuenta las claves del primer nivel. - * - * @param string $clave Clave del array de configuracion a obtener. - * - * @return mixed - * @access public - */ - function getConf($clave = null) - { - if ($clave) { - return @$this->_configuracion[$clave]; - } - else { - return $this->_configuracion; - } - } -} -?> \ No newline at end of file diff --git a/lib/MECON/Novedad.php b/lib/MECON/Novedad.php deleted file mode 100644 index 34b34a0..0000000 --- a/lib/MECON/Novedad.php +++ /dev/null @@ -1,84 +0,0 @@ -_db = $db; - - if(!is_null($codigo)) - { - - $this->codigo = $codigo; - $sql = "SELECT descripcion FROM novedades.webnov WHERE codigo='".$this->codigo."'"; - $result = $this->_db->getOne($sql); - $this->descripcion = $result; - } - } - } - - /** - * Devuelve el código de la novedad - * - * @return string codigo - * @access public - * - */ - function getCodigo() { - return $this->codigo; - } - - /** - * Devuelve la descripción de la novedad - * - * @return string descripcion - * @access public - * - */ - function getDescripcion() { - return $this->descripcion; - } -} - -?> diff --git a/lib/MECON/NovedadesDia.php b/lib/MECON/NovedadesDia.php deleted file mode 100644 index e652584..0000000 --- a/lib/MECON/NovedadesDia.php +++ /dev/null @@ -1,186 +0,0 @@ - | -// +--------------------------------------------------------------------+ -// -// $URL: http://portal.mecon.ar/svn/he/tronco/src/lib/he/HE/NovedadesDia.php $ -// $Rev: 380 $ -// $Date: 2003-05-08 18:40:47 -0300 (Thu, 08 May 2003) $ -// $Author: gmeray $ -// - -require_once 'DB.php'; -require_once 'Date.php'; -require_once 'MECON/Novedad.php'; -require_once 'MECON/Tiempo/Hora.php'; - -/** - * Representa un Intervalo entre 2 horas del mismo dia - * - * @package HE - * @abstract - * @version $Rev: 380 $ - * @author Gonzalo Merayo - */ -class MECON_NovedadesDia { - - var $novedades = array(); - - var $agente = null; - - var $fecha = null; - - var $_db = null; - - - function MECON_NovedadesDia(&$db, $agente, $fecha) { -#validar el tipo de $fecha - $this->agente = $agente; - $this->fecha = $fecha; - -#Ver de donde sacar esto bonito... - - $this->_db = $db; - if(DB::isError($this->_db)) - trigger_error($this->_db->getMessage(), E_USER_ERROR); -#Carga las novedades del agente/fecha en la lista de novedades - - $this->BuscarLicencia(); - $this->BuscarNovedadesTemporales(); - $this->BuscarNovedadDiaria(); - } - - function deLicencia() { - $licencias = array('Adp','Asa','Fal','Fran','FES/REL','Grem','Interrup','Sus','10a','10a/d','10c','10d','10g','10h','10i','10j','10j/c','13Ia','13Ia/s','13Ia/u','13Ib','13Ic','13Id','13Id/a','13Id/h','13Ie','13Ig','13IIa','13IIb','13IIc','13IId', '13IIe','1363/97-2','14a','14b','14b1','14b2','14c','14d','14f','14g','14h','15a', '15b','15c','9'); - $anti_licencias = array('Interr/13a','Interr/9'); - foreach($this->novedades as $nov) { - if(in_array($nov->codigo, $anti_licencias)) - return false; - if(in_array($nov->codigo, $licencias)) - return true; - } - return false; - } - - function enComicion() { - foreach($this->novedades as $nov) - if($nov->codigo == 'com') - return true; - return false; - } - - function esFranco() { - foreach($this->novedades as $nov) - if($nov->codigo == 'Fran') - return true; - return false; - } - - function debioVenir() { - $ret = true; - foreach($this->novedades as $novedad) { - if(!($novedad->codigo == 'adde' - or $novedad->codigo == 'aden' - or $novedad->codigo == 'adden' - or $novedad->codigo == 'ahp' - or $novedad->codigo == 'anul' - or $novedad->codigo == 'ato' - or $novedad->codigo == 'atp' - or $novedad->codigo == 'interr/13a' - or $novedad->codigo == 'interr/9' - or $novedad->codigo == 'interrup' - or $novedad->codigo == 'lta' - or $novedad->codigo == 'sinnov' - or $novedad->codigo == 'tsj' - or $novedad->codigo == '10a/c' - or $novedad->codigo == '10b' - or $novedad->codigo == '10e' - or $novedad->codigo == '15a' - or $novedad->codigo == '15b' - )) - $ret = false; - } - return $ret; - } - - function getAtos() { - $atos = array(); - foreach($this->novedades as $nov) - if($nov->codigo == 'ato') - array_push($atos, $nov); - return $atos; - } - - function BuscarLicencia() { - $fecha = $this->fecha->format("%Y%m%d"); - $query = "SELECT codnov,descripcion - FROM novedades.web018,novedades.webnov - WHERE docagente = $this->agente - AND diadesde <= $fecha - AND diahasta >= $fecha - AND codnov = codigo"; - $result = $this->_db->query($query); - if(DB::isError($result)) - trigger_error($result->getMessage(), E_USER_ERROR); - while($r = $result->fetchRow()) { - $novedad = new MECON_Novedad(); - $novedad->codigo = $r[0]; - $novedad->descripcion = $r[1]; - array_push($this->novedades, $novedad); - } - } - - function BuscarNovedadesTemporales() { - $fecha = $this->fecha->getYear()."-". - $this->fecha->getMonth()."-". - $this->fecha->getDay(); - $query = "SELECT novedad, desde, hasta, descripcion - FROM novedades.parciales,novedades.webnov - WHERE fecha = '$fecha' - AND nrodoc = $this->agente - AND novedad = codigo"; - $result = $this->_db->query($query); - if(DB::isError($result)) - trigger_error($result->getMessage(), E_USER_ERROR); - while($r = $result->fetchRow()) { - $novedad = new MECON_Novedad(); - $novedad->codigo = $r[0]; - $novedad->descripcion = $r[3]; - $novedad->intervalo = new MECON_Tiempo_Intervalo(new MECON_Tiempo_Hora($r[1]), new MECON_Tiempo_Hora($r[2])); - array_push($this->novedades, $novedad); - } - - } - - function BuscarNovedadDiaria() { - $mes = $this->fecha->getMonth(); - $dia = $this->fecha->getDay() + 0; //el +0 hace que tome al dia como numero - //y no le agregue un 0 si es < que 10 - $ano = $this->fecha->getYear(); - $query = "SELECT novedad,descripcion - FROM novedades.web020,novedades.webnov - WHERE anio = $ano - AND mes = $mes - AND nrodoc = $this->agente - AND dia$dia = 1 - AND novedad = codigo"; - $result = $this->_db->query($query); - if(DB::isError($result)) - trigger_error($result->getMessage(), E_USER_ERROR); - if($c = $result->fetchRow()) { - $codigo = $c[0]; - $descripcion = $c[1]; - $novedad = new MECON_Novedad(); - $novedad->codigo = $codigo; - $novedad->descripcion = $descripcion; - array_push($this->novedades, $novedad); - } - } - -} diff --git a/lib/MECON/Usuario.php b/lib/MECON/Usuario.php deleted file mode 100644 index 8d4b9a2..0000000 --- a/lib/MECON/Usuario.php +++ /dev/null @@ -1,302 +0,0 @@ - -------------------------------------------------------------------------------- -$Id: Usuario.php 242 2003-08-11 18:02:16Z manazar $ ------------------------------------------------------------------------------*/ -require_once 'MECON/Agente.php'; - -require_once 'DB.php'; -require_once 'PEAR.php'; - -/** - * @access public - */ -class MECON_Usuario { - /** - * @var int $dni - * @access public - */ - var $dni; - - /** - * @var string $login - * @access public - */ - var $login; - - /** - * @var string $nivelygrado - * @access public - */ - var $nivelygrado; - - - /** - * @var string $codep - * @access public - */ - var $codep; - - - /** - * @var string $nombre - * @access public - */ - var $nombre; - - /** - * @var string $tipo - * @access public - */ - var $tipo; - - /** - * @protected - */ - var $_db; - - /** - * @param string $dni - * - * @return void - * @access public - */ - function ArmarconDNI($dni) - { - $sql = "SELECT login,nombre - from usuario.Usuario - where dni = $dni"; - $result = $this->_db->query($sql); - if (DB::isError($result)) { - return $result; - } elseif ($result->NumRows()>0) { - $row = $result->fetchRow(DB_FETCHMODE_ORDERED); - $login = $row[0]; - $nombre = $row[1]; - $this->login=$login; - $this->nombre=$nombre; - $this->dni=$dni; - } else { - return new PEAR_Error ('El dni '.$dni.' no existe, debe loguearse al - menos una vez a la intranet.'); - } - } - - /** - * @param string $login - * - * @return void - * @access public - */ - function ArmarconLOGIN($login) - { - //$login = ereg_replace ("@", "\\\@", $login); - $sql = "SELECT dni,nombre - from usuario.Usuario - where login = '$login'"; - - $result = $this->_db->query($sql); - - if (DB::isError($result)) { - return $result; - } elseif ($result->NumRows()>0) { - $row = $result->fetchRow(DB_FETCHMODE_ORDERED); - $this->dni = $row[0]; - $this->nombre = $row[1]; - $this->login = $login; - } else { - return new PEAR_Error ('El usuario '.$login.' no existe, debe loguearse al - menos una vez a la intranet.'); - } - } - - /** - * @param int $dni - * - * @return void - * @access public - */ - function MECON_Usuario($db, $dni = null, $login = null) - { - $this->_db = $db; - if(! is_null($dni)) { - $this->ArmarconDNI($dni); - $this->buscarUsuarioDNI($dni); - } - if(! is_null($login)) { - $this->ArmarconLOGIN($login); - $this->buscarUsuarioDNI($this->getDni()); - } - - } - - /** - * @param int $uario - * - * @return lo que devuelve el query (DB_Result o DB_Error). - * @access public - */ - function Insertar_Usuario($dni, $login, $nombre) - { - $sql = "REPLACE INTO usuario.Usuario (login,dni,nombre) - values ('$login',$dni,'$nombre')"; - return $this->_db->query($sql); - } - - /** - * @return int - * @access public - */ - function getDni() - { - return $this->dni; - } - - /** - * @return string - * @access public - */ - function getLogin() - { - return $this->login; - } - - /** - * @return string - * @access public - */ - function getCodep() - { - return $this->codep; - } - - - /** - * @return string - * @access public - */ - function getNombre() - { - return $this->nombre; - } - - /** - * @return string - * @access public - */ - function getNivelygrado() - { - return $this->nivelygrado; - } - - - /** - * @return string - * @access public - */ - function getTipo() - { - return $this->tipo; - } - - - /** - * @param int $dni - * - * @return void - * @access public - */ - function buscarUsuarioDNI($dni) - { - $MECON_Agente= & new MECON_Agente($this->_db, $dni); - $this->dni = $dni; - $nombre = $MECON_Agente->getNombre(); - $this->nombre = $nombre; - $codep= $MECON_Agente->getDependencia(); - $this->codep = $codep; - $tipo= $MECON_Agente->getTipo(); - $this->tipo = $tipo; - $this->nivelygrado=""; - if (isset($MECON_Agente->datos['nivel'])) - { - $this->nivelygrado= $MECON_Agente->datos['nivel'].$MECON_Agente->datos['grado']; - } - - } - - /** - * Verifica si el login pasado por parametro es valido - * - * @param string $login Login a verificar - * - * @return mixed - * @access public - */ - function verificarLogin($login) { - $sql = "SELECT count(*) as cuenta FROM usuario.Usuario WHERE login = " - . $this->_db->quote($login) ; - $result = $this->_db->query($sql); - if (PEAR::isError($result)) { - return $result; - } - $row = $result->fetchRow(DB_FETCHMODE_ASSOC); - if ($row['cuenta'] != 0) { - return true; - } - return false; - } - - /** - * Devuelve un array de logins con aquellos que cumplan con algun requisito - * del filtro. - * - * @param DB &$db Base de Datos - * @param string $login Login a filtrar. (Puede ser completo o una parte de el) - * @param string $nombre Nombre a filtrar. - * - * @return mixed - * @access public - * @static - */ - function filtrarUsuarios(&$db, $login, $nombre) { - if ($login && $nombre) { - return new PEAR_Error('Solo debe ingresarse una opcion de filtro, - login o nombre, a la vez.'); - } - $sql = "SELECT u.login as login, u.nombre as nombre FROM usuario.Usuario as u - WHERE "; - - if ($login) { - $sql.= ' u.login LIKE \'%'.$login.'%\''; - } - else { - $sql.= ' u.nombre LIKE \'%'.$nombre.'%\''; - } - $sql.= 'ORDER BY u.login'; - - $db->setFetchMode(DB_FETCHMODE_ASSOC); - $result = $db->query($sql); - return $result; - } -} -?> diff --git a/lib/MECON/includes/no_autorizado.html b/lib/MECON/includes/no_autorizado.html deleted file mode 100644 index 0264ea3..0000000 --- a/lib/MECON/includes/no_autorizado.html +++ /dev/null @@ -1,33 +0,0 @@ - - -ERROR - - - - - - - - - - - - - - - - - - - -
-
-
-
ACCESO - NO AUTORIZADO
-
- diff --git a/pear_lib_tmp/HTML/Page.php b/pear_lib_tmp/HTML/Page.php deleted file mode 100644 index 233b416..0000000 --- a/pear_lib_tmp/HTML/Page.php +++ /dev/null @@ -1,1074 +0,0 @@ - | -// | Klaus Guenther | -// +----------------------------------------------------------------------+ -// -// $Id$ - -require_once 'PEAR.php'; -require_once 'HTML/Common.php'; -// HTML/Page/Doctypes.php is required in _getDoctype() -// HTML/Page/Namespaces.php is required in _getNamespace() - -/** - * Base class for XHTML pages - * - * This class handles the details for creating a properly constructed XHTML page. - * Page caching, stylesheets, client side script, and Meta tags can be - * managed using this class. - * - * The body may be a string, object, or array of objects or strings. Objects with - * toHtml() and toString() methods are supported. - * - * - * XHTML Examples: - * --------------- - * - * Simplest example: - * ----------------- - * - * // the default doctype is XHTML 1.0 Transitional - * // All doctypes and defaults are set in HTML/Page/Doctypes.php - * $p = new HTML_Page(); - * - * //add some content - * $p->addBodyContent("

some text

"); - * - * // print to browser - * $p->display(); - *
- * - * Complex XHTML example: - * ---------------------- - * - * // The initializing code can also be in in the form of an HTML - * // attr="value" string. - * // Possible attributes are: charset, mime, lineend, tab, doctype, namespace, language and cache - * - * $p = new HTML_Page(array ( - * - * // Sets the charset encoding - * // utf-8 is default - * 'charset' => 'utf-8', - * - * // Sets the line end character - * // unix (\n) is default - * 'lineend' => 'unix', - * - * // Sets the tab string for autoindent - * // tab (\t) is default - * 'tab' => ' ', - * - * // This is where you define the doctype - * 'doctype' => "XHTML 1.0 Strict", - * - * // Global page language setting - * 'language' => 'en', - * - * // If cache is set to true, the browser may - * // cache the output. Else - * 'cache' => 'false' - * )); - * - * // Here we go - * - * // Set the page title - * $p->setTitle("My page"); - * - * // Add optional meta data - * $p->addMetaData("author", "My Name"); - * - * // Put something into the body - * $p->addBodyContent = "

some text

"; - * - * // If at some point you want to clear the page content - * // and output an error message, you can easily do that - * // See the source for {@link toHtml} and {@link _getDoctype} - * // for more details - * if ($error) { - * $p->setTitle("Error!"); - * $p->setBodyContent("

Houston, we have a problem: $error

"); - * $p->display(); - * die; - * } // end error handling - * - * // print to browser - * $p->display(); - *
- * - * Simple XHTML declaration example: - * - * $p = new HTML_Page(); - * // An XHTML compliant page (with title) is automatically generated - * - * // This overrides the XHTML 1.0 Transitional default - * $p->setDoctype('XHTML 1.0 Strict'); - * - * // Put some content in here - * $p->addBodyContent("

some text

"); - * - * // print to browser - * $p->display(); - *
- * - * - * HTML examples: - * -------------- - * - * HTML 4.01 example: - * ------------------ - * - * $p = new HTML_Page('doctype="HTML 4.01 Strict"'); - * $p->addBodyContent = "

some text

"; - * $p->display(); - *
- * - * nuke doctype declaration: - * ------------------------- - * - * $p = new HTML_Page('doctype="none"'); - * $p->addBodyContent = "

some text

"; - * $p->display(); - *
- * - * @author Adam Daniel - * @author Klaus Guenther - * @version 2.0 - * @since PHP 4.0.3pl1 - */ -class HTML_Page extends HTML_Common { - - /** - * Contains the content of the <body> tag. - * - * @var array - * @access private - */ - var $_body = array(); - - /** - * Controls caching of the page - * - * @var bool - * @access private - */ - var $_cache = false; - - /** - * Contains the character encoding string - * - * @var string - * @access private - */ - var $_charset = 'utf-8'; - - /** - * Contains the !DOCTYPE definition - * - * @var array - * @access private - */ - var $_doctype = array('type'=>'xhtml','version'=>'1.0','variant'=>'transitional'); - - /** - * Contains the page language setting - * - * @var string - * @access private - */ - var $_language = 'en'; - - /** - * Array of meta tags - * - * @var array - * @access private - */ - var $_metaTags = array( 'standard' => array ( 'Generator' => 'PEAR HTML_Page' ) ); - - /** - * Document mime type - * - * @var string - * @access private - */ - var $_mime = 'text/html'; - - /** - * Document namespace - * - * @var string - * @access private - */ - var $_namespace = ''; - - /** - * Array of linked scripts - * - * @var array - * @access private - */ - var $_scripts = array(); - - /** - * Array of scripts placed in the header - * - * @var array - * @access private - */ - var $_script = array(); - - /** - * Array of linked scripts - * - * @var array - * @access private - */ - var $_simple = false; - - /** - * Array of included style declarations - * - * @var array - * @access private - */ - var $_style = array(); - - /** - * Array of linked style sheets - * - * @var array - * @access private - */ - var $_styleSheets = array(); - - /** - * HTML page title - * - * @var string - * @access private - */ - var $_title = ''; - - /** - * Class constructor - * Possible attributes are: - * - general options: - * - "lineend" => "unix|win|mac" (Sets line ending style; defaults to unix.) - * - "tab" => string (Sets line ending style; defaults to \t.) - * - "cache" => "false|true" - * - "charset" => charset string (Sets charset encoding; defaults to utf-8) - * - "mime" => mime encoding string (Sets document mime type; defaults to text/html) - * - XHTML specific: - * - "doctype" => string (Sets XHTML doctype; defaults to XHTML 1.0 Transitional.) - * - "language" => two letter language designation. (Defines global document language; defaults to "en".) - * - "namespace" => string (Sets document namespace; defaults to the W3C defined namespace.) - * - * @param mixed $attributes Associative array of table tag attributes - * or HTML attributes name="value" pairs - * @access public - */ - function HTML_Page($attributes = array()) - { - $commonVersion = 1.7; - if (HTML_Common::apiVersion() < $commonVersion) { - return PEAR::raiseError("HTML_Page version " . $this->apiVersion() . " requires " . - "HTML_Common version 1.2 or greater.", 0, PEAR_ERROR_TRIGGER); - } - - if ($attributes) { - $attributes = $this->_parseAttributes($attributes); - } - - if (isset($attributes['lineend'])) { - $this->setLineEnd($attributes['lineend']); - } - - if (isset($attributes['charset'])) { - $this->setCharset($attributes['charset']); - } - - if (isset($attributes['doctype'])){ - if ($attributes['doctype'] == 'none') { - $this->_simple = true; - } elseif ($attributes['doctype']) { - $this->setDoctype($attributes['doctype']); - } - } - - if (isset($attributes['language'])) { - $this->setLang($attributes['language']); - } - - if (isset($attributes['mime'])) { - $this->setMimeEncoding($attributes['mime']); - } - - if (isset($attributes['namespace'])) { - $this->setNamespace($attributes['namespace']); - } - - if (isset($attributes['tab'])) { - $this->setTab($attributes['tab']); - } - - if (isset($attributes['cache'])) { - $this->setCache($attributes['cache']); - } - - } - - /** - * Generates the HTML string for the <body< tag - * - * @access private - * @return string - */ - function _generateBody() - { - - // get line endings - $lnEnd = $this->_getLineEnd(); - $tab = $this->_getTab(); - - // If body attributes exist, add them to the body tag. - // Depreciated because of CSS - $strAttr = $this->_getAttrString($this->_attributes); - - if ($strAttr) { - $strHtml = "" . $lnEnd; - } else { - $strHtml = '' . $lnEnd; - } - - // Allow for mixed content in the body array - // Iterate through the array and process each element - foreach ($this->_body as $element) { - if (is_object($element)) { - if (is_subclass_of($element, "html_common")) { - $element->setTab($tab); - $element->setTabOffset(1); - $element->setLineEnd($lnEnd); - } - if (method_exists($element, "toHtml")) { - $strHtml .= $element->toHtml() . $lnEnd; - } elseif (method_exists($element, "toString")) { - $strHtml .= $element->toString() . $lnEnd; - } - } elseif (is_array($element)) { - foreach ($element as $level2) { - if (is_subclass_of($level2, "html_common")) { - $level2->setTabOffset(1); - $level2->setTab($tab); - $level2->setLineEnd($lnEnd); - } - if (is_object($level2)) { - if (method_exists($level2, "toHtml")) { - $strHtml .= $level2->toHtml() . $lnEnd; - } elseif (method_exists($level2, "toString")) { - $strHtml .= $level2->toString() . $lnEnd; - } - } else { - $strHtml .= $tab . $level2 . $lnEnd; - } - } - } else { - $strHtml .= $tab . $element . $lnEnd; - } - } - - // Close tag - $strHtml .= '' . $lnEnd; - - // Let's roll! - return $strHtml; - } // end func _generateHead - - /** - * Generates the HTML string for the <head< tag - * - * @return string - * @access private - */ - function _generateHead() - { - // close empty tags if XHTML - if ($this->_doctype['type'] == 'html'){ - $tagEnd = '>'; - } else { - $tagEnd = ' />'; - } - - // get line endings - $lnEnd = $this->_getLineEnd(); - $tab = $this->_getTab(); - - $strHtml = '' . $lnEnd; - $strHtml .= $tab . '' . $this->getTitle() . '' . $lnEnd; - - // Generate META tags - foreach ($this->_metaTags as $type => $tag) { - foreach ($tag as $name => $content) { - if ($type == 'http-equiv') { - $strHtml .= $tab . "_styleSheets as $strStyleSheet) { - $strHtml .= $tab . "_style as $type => $content) { - $strHtml .= $tab . '' . $lnEnd; - } - - // Generate script file links - foreach ($this->_scripts as $strSrc => $strType) { - $strHtml .= $tab . "" . $lnEnd; - } - - // Generate script declarations - foreach ($this->_script as $type => $content) { - $strHtml .= $tab . '' . $lnEnd; - } - - // Close tag - $strHtml .= '' . $lnEnd; - - // Let's roll! - return $strHtml; - } // end func _generateHead - - /** - * Returns the doctype declaration - * - * @return mixed - * @access private - */ - function _getDoctype() - { - require('HTML/Page/Doctypes.php'); - - if (isset($this->_doctype['type'])) { - $type = $this->_doctype['type']; - } - - if (isset($this->_doctype['version'])) { - $version = $this->_doctype['version']; - } - - if (isset($this->_doctype['variant'])) { - $variant = $this->_doctype['variant']; - } - - $strDoctype = ''; - - if (isset($variant)) { - if (isset($doctype[$type][$version][$variant][0])) { - foreach ( $doctype[$type][$version][$variant] as $string) { - $strDoctype .= $string.$this->_getLineEnd(); - } - } - } elseif (isset($version)) { - if (isset($doctype[$type][$version][0])) { - foreach ( $doctype[$type][$version] as $string) { - $strDoctype .= $string.$this->_getLineEnd(); - } - } else { - if (isset($default[$type][$version][0])) { - $this->_doctype = $this->_parseDoctypeString($default[$type][$version][0]); - $strDoctype = $this->_getDoctype(); - } - } - } elseif (isset($type)) { - if (isset($default[$type][0])){ - $this->_doctype = $this->_parseDoctypeString($default[$type][0]); - $strDoctype = $this->_getDoctype(); - } - } else { - $this->_doctype = $this->_parseDoctypeString($default['default'][0]); - $strDoctype = $this->_getDoctype(); - } - - if ($strDoctype) { - return $strDoctype; - } else { - return PEAR::raiseError('Error: "'.$this->getDoctypeString().'" is an unsupported or illegal document type.', - 0,PEAR_ERROR_TRIGGER); - } - - } // end func _getDoctype - - /** - * Retrieves the document namespace - * - * @return mixed - * @access private - */ - function _getNamespace() - { - require('HTML/Page/Namespaces.php'); - - if (isset($this->_doctype['type'])) { - $type = $this->_doctype['type']; - } - - if (isset($this->_doctype['version'])) { - $version = $this->_doctype['version']; - } - - if (isset($this->_doctype['variant'])) { - $variant = $this->_doctype['variant']; - } - - $strNamespace = ''; - - if (isset($variant)){ - if (isset($namespace[$type][$version][$variant][0]) && is_string($namespace[$type][$version][$variant][0])) { - $strNamespace = $namespace[$type][$version][$variant][0]; - } elseif (isset($namespace[$type][$version][0]) && is_string($namespace[$type][$version][0]) ) { - $strNamespace = $namespace[$type][$version][0]; - } elseif (isset($namespace[$type][0]) && is_string($namespace[$type][0]) ) { - $strNamespace = $namespace[$type][0]; - } - } elseif (isset($version)) { - if (isset($namespace[$type][$version][0]) && is_string($namespace[$type][$version][0]) ) { - $strNamespace = $namespace[$type][$version][0]; - } elseif (isset($namespace[$type][0]) && is_string($namespace[$type][0]) ) { - $strNamespace = $namespace[$type][0]; - } - } else { - if (isset($namespace[$type][0]) && is_string($namespace[$type][0]) ) { - $strNamespace = $namespace[$type][0]; - } - } - - - if ($strNamespace) { - return $strNamespace; - } else { - return PEAR::raiseError('Error: "'.$this->getDoctypeString().'" does not have a default namespace. Use setNamespace() to define your namespace.', - 0,PEAR_ERROR_TRIGGER); - } - - } // end func _getNamespace - - /** - * Parses a doctype declaration like "XHTML 1.0 Strict" to an array - * - * @param string $string The string to be parsed - * @return string - * @access private - */ - function _parseDoctypeString($string) - { - $split = explode(' ',strtolower($string)); - $elements = count($split); - - if (isset($split[2])){ - $array = array('type'=>$split[0],'version'=>$split[1],'variant'=>$split[2]); - } elseif (isset($split[1])){ - $array = array('type'=>$split[0],'version'=>$split[1]); - } else { - $array = array('type'=>$split[0]); - } - - return $array; - } // end func _parseDoctypeString - - /** - * Sets the content of the <body> tag. If content already exists, - * the new content is appended. - * If you wish to overwrite whatever is in the body, use {@link setBody}; - * {@link unsetBody} completely empties the body without inserting new content. - * It is possible to add objects, strings or an array of strings and/or objects - * Objects must have a toString method. - * - * @param mixed $content New <body> tag content (may be passed as a reference) - * @access public - */ - function addBodyContent($content) - { - $this->_body[] =& $content; - if (is_object($content)) { - if (method_exists($content, "toStyleSheet")) { - $this->addStyleSheet($content->toStyleSheet()); - } - if (method_exists($content, "toScript")) { - $script = $content->toScript(); - if (is_array($script)) { - $this->addScript($script[0], $script[1]); - } else { - $this->addScript($script); - } - } - } elseif (is_array($content)) { - foreach ($content as $element) { - if (is_object($content)) { - if (method_exists($element, "toStyleSheet")) { - $this->addStyleSheet($element->toStyleSheet()); - } - if (method_exists($element, "toScript")) { - $script = $element->toScript(); - if (is_array($script)) { - $this->addScript($script[0], $script[1]); - } else { - $this->addScript($script); - } - } - } - } - } - } // end addBodyContent - - /** - * Adds a linked script to the page - * - * @param string $url URL to the linked script - * @param string $type Type of script. Defaults to 'text/javascript' - * @access public - */ - function addScript($url, $type="text/javascript") - { - $this->_scripts[$url] = $type; - } // end func addScript - - /** - * Adds a script to the page. - * Content can be a string or an object with a toString method. - * Defaults to text/javascript. - * - * @access public - * @param mixed $content Script (may be passed as a reference) - * @param string $type Scripting mime (defaults to 'text/javascript') - * @return void - */ - function addScriptDeclaration($content, $type = 'text/javascript') - { - $this->_script[strtolower($type)] =& $content; - } // end func addScriptDeclaration - - /** - * Adds a linked stylesheet to the page - * - * @param string $url URL to the linked style sheet - * @access public - * @return void - */ - function addStyleSheet($url) - { - $this->_styleSheets[$url] = $url; - } // end func addStyleSheet - - /** - * Adds a stylesheet declaration to the page. - * Content can be a string or an object with a toString method. - * Defaults to text/css. - * - * @access public - * @param mixed $content Style declarations (may be passed as a reference) - * @param string $type Type of stylesheet (defaults to 'text/css') - * @return void - */ - function addStyleDeclaration($content, $type = 'text/css') - { - $this->_style[strtolower($type)] =& $content; - } // end func addStyleDeclaration - - /** - * Returns the current API version - * - * @access public - * @returns double - */ - function apiVersion() - { - return 2.0; - } // end func apiVersion - - /** - * Returns the document charset encoding. - * - * @access public - * @returns string - */ - function getCharset() - { - return $this->_charset; - } // end setCache - - /** - * Returns the document type string - * - * @access private - * @return string - */ - function getDoctypeString() - { - $strDoctype = strtoupper($this->_doctype['type']); - $strDoctype .= ' '.ucfirst(strtolower($this->_doctype['version'])); - if ($this->_doctype['variant']) { - $strDoctype .= ' ' . ucfirst(strtolower($this->_doctype['variant'])); - } - return trim($strDoctype); - } // end func getDoctypeString - - /** - * Returns the document language. - * - * @return string - * @access public - */ - function getLang () - { - return $this->_language; - } // end func getLang - - /** - * Return the title of the page. - * - * @returns string - * @access public - */ - function getTitle() - { - if (!$this->_title){ - if ($this->_simple) { - return 'New Page'; - } else { - return 'New '. $this->getDoctypeString() . ' Compliant Page'; - } - } else { - return $this->_title; - } - } // end func getTitle - - /** - * Sets the content of the <body> tag. If content exists, it is overwritten. - * If you wish to use a "safe" version, use {@link addBodyContent} - * Objects must have a toString method. - * - * @param mixed $content New <body> tag content. May be an object. (may be passed as a reference) - * @access public - */ - function setBody($content) - { - $this->unsetBody(); - $this->addBodyContent($content); - } // end setBody - - /** - * Unsets the content of the <body> tag. - * - * @access public - */ - function unsetBody() - { - $this->_body = ''; - } // end unsetBody - - /** - * Defines if the document should be cached by the browser. Defaults to false. - * - * @param string $cache Options are currently 'true' or 'false'. Defaults to 'false'. - * @access public - */ - function setCache($cache = 'false') - { - if ($cache == 'true'){ - $this->_cache = true; - } else { - $this->_cache = false; - } - } // end setCache - - /** - * Defines if the document should be cached by the browser. Defaults to false. - * - * @param string $cache Options are currently 'true' or 'false'. Defaults to 'false'. - * @access public - * @returns void - */ - function setCharset($type = 'utf-8') - { - $this->_charset = $type; - } // end setCache - - /** - * Sets or alters the XHTML !DOCTYPE declaration. Can be set to "strict", - * "transitional" or "frameset". Defaults to "transitional". This must come - * _after_ declaring the character encoding with {@link setCharset} or directly - * when the class is initiated {@link HTML_Page}. - * - * @param string $type String containing a document type. Defaults to "XHTML 1.0 Transitional" - * @access public - * @returns void - */ - function setDoctype($type = "XHTML 1.0 Transitional") - { - $this->_doctype = $this->_parseDoctypeString($type); - } // end func setDoctype - - /** - * Sets the global document language declaration. Default is English. - * - * @access public - * @param string $lang Two-letter language designation. - */ - function setLang($lang = "en") - { - $this->_language = strtolower($lang); - } // end setLang - - /** - * Sets or alters a meta tag. - * - * @param string $name Value of name or http-equiv tag - * @param string $content Value of the content tag - * @param bool $http_equiv META type "http-equiv" defaults to NULL - * @return void - * @access public - */ - function setMetaData($name, $content, $http_equiv = false) - { - if ($http_equiv == true) { - $this->_metaTags['http-equiv'][$name] = $content; - } else { - $this->_metaTags['standard'][$name] = $content; - } - } // end func setMetaData - - /** - * Sets an http-equiv Content-Type meta tag - * - * @access public - * @returns void - */ - function setMetaContentType() - { - $this->setMetaData('Content-Type', $this->_mime . '; charset=' . $this->_charset , true ); - } // end func setMetaContentType - - /** - * Easily sets or alters a refresh meta tag. - * If no $url is passed, "self" is presupposed, and the appropriate URL - * will be automatically generated. - * - * @param string $time Time till refresh (in seconds) - * @param string $url Absolute URL or "self" - * @param bool $https If $url = self, this allows for the https protocol defaults to NULL - * @return void - * @access public - */ - function setMetaRefresh($time, $url = 'self', $https = false) - { - if ($url == 'self') { - if ($https) { - $protocol = 'https://'; - } else { - $protocol = 'http://'; - } - $url = $protocol . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; - } - $this->setMetaData("Refresh", "$time; url=$url", true); - } // end func setMetaRefresh - - /** - * Sets the document MIME encoding that is sent to the browser. - * - * @param string $type - * @access public - * @returns void - */ - function setMimeEncoding($type = 'text/html') - { - $this->_mime = strtolower($type); - } // end func setMimeEncoding - - /** - * Sets the document namespace - * - * @param string $namespace Optional. W3C namespaces are used by default. - * @access public - * @returns void - */ - function setNamespace($namespace = '') - { - if (isset($namespace)){ - $this->_namespace = $namespace; - } else { - $this->_namespace = $this->_getNamespace(); - } - } // end func setTitle - - /** - * Sets the title of the page - * - * @param string $title - * @access public - * @returns void - */ - function setTitle($title) - { - $this->_title = $title; - } // end func setTitle - - /** - * Generates and returns the complete page as a string. - * - * @return string - * @access private - */ - function toHTML() - { - - // get line endings - $lnEnd = $this->_getLineEnd(); - - // get the doctype declaration - $strDoctype = $this->_getDoctype(); - - // This determines how the doctype is declared - if ($this->_simple) { - - $strHtml = '' . $lnEnd; - - } elseif ($this->_doctype['type'] == 'xhtml') { - - // get the namespace if not already set - if (!$this->_namespace){ - $this->_namespace = $this->_getNamespace(); - } - - $strHtml = '_charset . '"?>' . $lnEnd; - $strHtml .= $strDoctype . $lnEnd; - $strHtml .= '' . $lnEnd; - - } else { - - $strHtml = $strDoctype . $lnEnd; - $strHtml .= '' . $lnEnd; - - } - - $strHtml .= $this->_generateHead(); - $strHtml .= $this->_generateBody(); - $strHtml .= ''; - return $strHtml; - } // end func toHtml - - /** - * Outputs the HTML content to the screen. - * - * @access public - */ - function display() - { - if(! $this->_cache) { - header("Expires: Tue, 1 Jan 1980 12:00:00 GMT"); - header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); - header("Cache-Control: no-cache"); - header("Pragma: no-cache"); - } - - // set character encoding - header('Content-Type: ' . $this->_mime . '; charset=' . $this->_charset); - - $strHtml = $this->toHTML(); - print $strHtml; - } // end func display - -} -?> \ No newline at end of file diff --git a/pear_lib_tmp/HTML/Select.php b/pear_lib_tmp/HTML/Select.php deleted file mode 100644 index b6b1c0e..0000000 --- a/pear_lib_tmp/HTML/Select.php +++ /dev/null @@ -1,329 +0,0 @@ - | -// +----------------------------------------------------------------------+ -// -// $Id$ - -require_once 'PEAR.php'; -require_once 'HTML/Common.php'; - -/** - * Class to dynamically create an HTML SELECT - * - * @author Adam Daniel - * @version 1.2 - * @since PHP4.04pl1 - * @access public - */ -class HTML_Select extends HTML_Common -{ - - /** - * Contains the select options - * - * @var array - * @since 1.0 - * @access private - */ - var $_options = array(); - - /** - * Default values of the SELECT - * - * @var string - * @since 1.0 - * @access private - */ - var $_values = array(); - - /** - * Class constructor - * - * @param string $name (optional)Name attribute of the SELECT - * @param int $size (optional) Size attribute of the SELECT - * @param bool $multiple (optional)Whether the select will allow multiple - * selections or not - * @param mixed $attributes (optional)Either a typical HTML attribute string - * or an associative array - * @param int $tabOffset (optional)Number of tabs to offset HTML source - * @since 1.0 - * @access public - * @return void - * @throws - */ - function HTML_Select($name = '', $size = 1, $multiple = false, $attributes = null, $tabOffset = 0) - { - HTML_Common::HTML_Common($attributes, $tabOffset); - $attr = array('name' => $name, 'size' => $size); - if ($multiple) { - $attr['multiple'] = 'multiple'; - } - $this->updateAttributes($attr); - $this->setSelectedValues(array()); - } - - /** - * Returns the current API version - * - * @since 1.0 - * @access public - * @return double - * @throws - */ - function apiVersion() - { - return 1.3; - } - - /** - * Sets the default values of the select box - * - * @param mixed $values Array or comma delimited string of selected values - * @since 1.0 - * @access public - * @return void - * @throws - */ - function setSelectedValues($values) - { - if (is_string($values)) { - $values = split("[ ]?,[ ]?", $values); - } - $this->_values = $values; - } - - /** - * Returns an array of the selected values - * - * @since 1.0 - * @access public - * @return array of selected values - * @throws - */ - function getSelectedValues() - { - return $this->_values; - } - - /** - * Adds a new OPTION to the SELECT - * - * @param string $text Display text for the OPTION - * @param string $value Value for the OPTION - * @param bool $selected Whether the option is selected or not - * @param mixed $attributes Either a typical HTML attribute string - * or an associative array - * @since 1.0 - * @access public - * @return void - * @throws - */ - function addOption($text, $value, $selected = false, $attributes = null) - { - if ($selected && !in_array($value, $this->_values)) { - $this->_values[] = $value; - } - - $attributes = $this->_parseAttributes($attributes); - $attr['value'] = $value; - $this->_updateAttrArray($attributes, $attr); - $this->_options[] = array('text' => $text, 'attr' => $attributes); - } - - /** - * Loads the options from an associative array - * - * @param array $arr Associative array of options - * @param mixed $values (optional) Array or comma delimited string of selected values - * @since 1.0 - * @access public - * @return PEAR_Error on error or true - * @throws PEAR_Error - */ - function loadArray($arr, $values=null) - { - if (!is_array($arr)) { - return new PEAR_ERROR('First argument to HTML_Select::loadArray is not a valid array'); - } - if (isset($values)) { - $this->setSelectedValues($values); - } - while (list($key, $value) = each($arr)) { - $this->addOption($key, $value); - } - return true; - } - - /** - * Loads the options from an array with numeric keys, using the - * array values as the form values as well as labels. - * - * @param array $arr Array of options - * @param mixed $values (optional) Array or comma delimited string of selected values - * @since 1.2 - * @access public - * @return PEAR_Error on error or true - * @throws PEAR_Error - */ - function loadValueArray($arr, $values = null) - { - if (!is_array($arr)) { - return new PEAR_ERROR("First argument to HTML_Select::loadArray is not a valid array"); - } - if (isset($values)) { - $this->setSelectedValues($values); - } - foreach ($arr as $value) { - $this->addOption($value, $value); - } - return true; - } - - /** - * Loads the options from DB_result object - * - * If no column names are specified the first two columns of the result are - * used as the text and value columns respectively - * @param object $result DB_result object - * @param string $textCol (optional) Name of column to display as the OPTION text - * @param string $valueCol (optional) Name of column to use as the OPTION value - * @param mixed $values (optional) Array or comma delimited string of selected values - * @since 1.0 - * @access public - * @return PEAR_Error on error or true - * @throws PEAR_Error - */ - function loadDbResult(&$result, $textCol=null, $valueCol=null, $values=null) - { - include_once 'DB.php'; - - if (!is_object($result) || (get_class($result) != "db_result" && - is_subclass_of($result, "db_result"))) { - return new PEAR_ERROR("First argument to HTML_Select::loadDbResult is not a valid DB_result"); - } - if (isset($values)) { - $this->setSelectedValues($values); - } - $fetchMode = ($textCol && $valueCol) ? DB_FETCHMODE_ASSOC : DB_FETCHMODE_DEFAULT; - while (is_array($row = $result->fetchRow($fetchMode)) ) { - if ($fetchMode == DB_FETCHMODE_ASSOC) { - $this->addOption($row[$textCol], $row[$valueCol]); - } else { - $this->addOption($row[0], $row[1]); - } - } - return true; - } - - /** - * Queries a database and loads the options from the results - * - * @param mixed $conn Either an existing DB connection or a valid dsn - * @param string $sql SQL query string - * @param string $textCol (optional) Name of column to display as the OPTION text - * @param string $valueCol (optional) Name of column to use as the OPTION value - * @param mixed $values (optional) Array or comma delimited string of selected values - * @since 1.1 - * @access private - * @return void - * @throws - */ - function loadQuery(&$conn, $sql, $textCol=null, $valueCol=null, $values=null) - { - include_once 'DB.php'; - - if (is_string($conn)) { - $dbConn = &DB::connect($conn, true); - if (DB::isError($dbConn)) return $dbConn; - } elseif (is_subclass_of($conn, "db_common")) { - $dbConn = $conn; - } else { - return $this->raiseError("Argument 1 of HTML_Select::loadQuery is not a valid type"); - } - $result = @$dbConn->query($sql); - if (DB::isError($result)) return $result; - return $this->loadDbResult($result, $textCol, $valueCol, $values); - } - - /** - * Loads options from different types of data sources - * - * This method is a simulated overloaded method. The arguments, other than the - * first are optional and only mean something depending on the type of the first argument. - * If the first argument is an array then all arguments are passed in order to loadArray. - * If the first argument is a db_result then all arguments are passed in order to loadDbResult. - * If the first argument is a string or a DB connection then all arguments are - * passed in order to loadQuery. - * @param mixed $options Options source currently supports assoc array or DB_result - * @param mixed $param1 (optional) See function detail - * @param mixed $param2 (optional) See function detail - * @param mixed $param3 (optional) See function detail - * @param mixed $param4 (optional) See function detail - * @since 1.1 - * @access public - * @return PEAR_Error on error or true - * @throws PEAR_Error - */ - function load(&$options, $param1=null, $param2=null, $param3=null, $param4=null) - { - switch (true) { - case is_array($options): - return $this->loadArray($options, $param1); - break; - case (get_class($options) == "db_result" || is_subclass_of($options, "db_result")): - return $this->loadDbResult($options, $param1, $param2, $param3); - break; - case (is_string($options) || is_subclass_of($options, "db_common")): - return $this->loadQuery($options, $param1, $param2, $param3, $param4); - break; - } - } - - /** - * Returns the SELECT in HTML - * - * @since 1.0 - * @access public - * @return string - * @throws - */ - function toHtml() - { - $tabs = $this->_getTabs(); - $name = $this->_attributes['name']; - $strHtml = $tabs; - if ($this->_comment) { - $strHtml .= "\n$tabs"; - } - $strHtml .= - '_getAttrString($this->_attributes) . '>'; - foreach ($this->_options as $option) { - $attrString = $this->_getAttrString($option['attr']); - $strHtml .= - '_values) - ? ' selected' - : '') - . '>' . htmlspecialchars($option['text']) . ''; - } - $strHtml .= ''; - return $strHtml; - } - -} - -?> diff --git a/pear_lib_tmp/Numbers/Words/lang.es_AR.php b/pear_lib_tmp/Numbers/Words/lang.es_AR.php deleted file mode 100644 index e1d79a2..0000000 --- a/pear_lib_tmp/Numbers/Words/lang.es_AR.php +++ /dev/null @@ -1,468 +0,0 @@ - | -// | Based On: lang_es.php - Xavier Noguer | -// +----------------------------------------------------------------------+ -// $Id$ -// -// Numbers_Words class extension to spell numbers in Argentinian Spanish -// (Castellano). -// -// - -/** - * Class for translating numbers into Spanish (Castellano). - * - * @author Martin Marrese - * @package Numbers_Words - */ - -/** - * Include needed files - */ -require_once("Numbers/Words.php"); - -/** - * Class for translating numbers into Spanish (Castellano). - * It supports up to decallones (10^6). - * It doesn't support spanish tonic accents (acentos). - * - * @author Martin Marrese - * @package Numbers_Words - */ -class Numbers_Words_es_AR extends Numbers_Words -{ - // {{{ properties - - /** - * Locale name - * @var string - * @access public - */ - var $locale = 'es_AR'; - - /** - * Language name in English - * @var string - * @access public - */ - var $lang = 'Spanish'; - - /** - * Native language name - * @var string - * @access public - */ - var $lang_native = 'Español'; - - /** - * The word for the minus sign - * @var string - * @access private - */ - var $_minus = 'menos'; - - /** - * The sufixes for exponents (singular and plural) - * @var array - * @access private - */ - var $_exponent = array( - 0 => array('',''), - 3 => array('mil','mil'), - 6 => array('millón','millones'), - 12 => array('billón','billones'), - 18 => array('trilón','trillones'), - 24 => array('cuatrillón','cuatrillones'), - 30 => array('quintillón','quintillones'), - 36 => array('sextillón','sextillones'), - 42 => array('septillón','septillones'), - 48 => array('octallón','octallones'), - 54 => array('nonallón','nonallones'), - 60 => array('decallón','decallones'), - ); - /** - * The array containing the digits (indexed by the digits themselves). - * @var array - * @access private - */ - var $_digits = array( - 0 => 'cero', 'uno', 'dos', 'tres', 'cuatro', - 'cinco', 'seis', 'siete', 'ocho', 'nueve' - ); - /** - * The word separator - * @var string - * @access private - */ - var $_sep = ' '; - - /** - * The currency names (based on the below links, - * informations from central bank websites and on encyclopedias) - * - * @var array - * @link http://30-03-67.dreamstation.com/currency_alfa.htm World Currency Information - * @link http://www.jhall.demon.co.uk/currency/by_abbrev.html World currencies - * @link http://www.shoestring.co.kr/world/p.visa/change.htm Currency names in English - * @access private - */ - var $_currency_names = array( - 'ALL' => array(array('lek'), array('qindarka')), - 'AUD' => array(array('Australian dollar'), array('cent')), - 'ARS' => array(array('Peso'), array ('centavo')), - 'BAM' => array(array('convertible marka'), array('fenig')), - 'BGN' => array(array('lev'), array('stotinka')), - 'BRL' => array(array('real'), array('centavos')), - 'BYR' => array(array('Belarussian rouble'), array('kopiejka')), - 'CAD' => array(array('Canadian dollar'), array('cent')), - 'CHF' => array(array('Swiss franc'), array('rapp')), - 'CYP' => array(array('Cypriot pound'), array('cent')), - 'CZK' => array(array('Czech koruna'), array('halerz')), - 'DKK' => array(array('Danish krone'), array('ore')), - 'EEK' => array(array('kroon'), array('senti')), - 'EUR' => array(array('euro'), array('euro-cent')), - 'GBP' => array(array('pound', 'pounds'), array('pence')), - 'HKD' => array(array('Hong Kong dollar'), array('cent')), - 'HRK' => array(array('Croatian kuna'), array('lipa')), - 'HUF' => array(array('forint'), array('filler')), - 'ISK' => array(array('Icelandic króna'), array('aurar')), - 'JPY' => array(array('yen'), array('sen')), - 'LTL' => array(array('litas'), array('cent')), - 'LVL' => array(array('lat'), array('sentim')), - 'MKD' => array(array('Macedonian dinar'), array('deni')), - 'MTL' => array(array('Maltese lira'), array('centym')), - 'NOK' => array(array('Norwegian krone'), array('oere')), - 'PLN' => array(array('zloty', 'zlotys'), array('grosz')), - 'ROL' => array(array('Romanian leu'), array('bani')), - 'RUB' => array(array('Russian Federation rouble'), array('kopiejka')), - 'SEK' => array(array('Swedish krona'), array('oere')), - 'SIT' => array(array('Tolar'), array('stotinia')), - 'SKK' => array(array('Slovak koruna'), array()), - 'TRL' => array(array('lira'), array('kuruþ')), - 'UAH' => array(array('hryvna'), array('cent')), - 'USD' => array(array('dollar'), array('cent')), - 'YUM' => array(array('dinars'), array('para')), - 'ZAR' => array(array('rand'), array('cent')) - ); - - /** - * The default currency name - * @var string - * @access public - */ - var $def_currency = 'ARS'; // Argentinian Peso - - // }}} - // {{{ toWords() - /** - * Converts a number to its word representation - * in Spanish (Castellano). - * - * @param float $num An float between -infinity and infinity inclusive :) - * that should be converted to a words representation - * @param integer $power The power of ten for the rest of the number to the right. - * For example toWords(12,3) should give "doce mil". - * Optional, defaults to 0. - * @return string The corresponding word representation - * - * @access private - * @author Martin Marrese - */ - function toWords($num, $power = 0) - { - // The return string; - $ret = ''; - - // add a the word for the minus sign if necessary - if (substr($num, 0, 1) == '-') - { - $ret = $this->_sep . $this->_minus; - $num = substr($num, 1); - } - - - // strip excessive zero signs - $num = preg_replace('/^0+/','',$num); - - $num_tmp = split ('\.', $num); - - $num = $num_tmp[0]; - $dec = (@$num_tmp[1]) ? $num_tmp[1] : ''; - - if (strlen($num) > 6) - { - $current_power = 6; - // check for highest power - if (isset($this->_exponent[$power])) - { - // convert the number above the first 6 digits - // with it's corresponding $power. - $snum = substr($num, 0, -6); - $snum = preg_replace('/^0+/','',$snum); - if ($snum !== '') { - $ret .= $this->toWords($snum, $power + 6); - } - } - $num = substr($num, -6); - if ($num == 0) { - return $ret; - } - } - elseif ($num == 0 || $num == '') { - return(' '.$this->_digits[0]); - $current_power = strlen($num); - } - else { - $current_power = strlen($num); - } - - // See if we need "thousands" - $thousands = floor($num / 1000); - if ($thousands == 1) { - $ret .= $this->_sep . 'mil'; - } - elseif ($thousands > 1) { - $ret .= $this->toWords($thousands, 3); - } - - // values for digits, tens and hundreds - $h = floor(($num / 100) % 10); - $t = floor(($num / 10) % 10); - $d = floor($num % 10); - - // cientos: doscientos, trescientos, etc... - switch ($h) - { - case 1: - if (($d == 0) and ($t == 0)) { // is it's '100' use 'cien' - $ret .= $this->_sep . 'cien'; - } - else { - $ret .= $this->_sep . 'ciento'; - } - break; - case 2: - case 3: - case 4: - case 6: - case 8: - $ret .= $this->_sep . $this->_digits[$h] . 'cientos'; - break; - case 5: - $ret .= $this->_sep . 'quinientos'; - break; - case 7: - $ret .= $this->_sep . 'setecientos'; - break; - case 9: - $ret .= $this->_sep . 'novecientos'; - break; - } - - // decenas: veinte, treinta, etc... - switch ($t) - { - case 9: - $ret .= $this->_sep . 'noventa'; - break; - - case 8: - $ret .= $this->_sep . 'ochenta'; - break; - - case 7: - $ret .= $this->_sep . 'setenta'; - break; - - case 6: - $ret .= $this->_sep . 'sesenta'; - break; - - case 5: - $ret .= $this->_sep . 'cincuenta'; - break; - - case 4: - $ret .= $this->_sep . 'cuarenta'; - break; - - case 3: - $ret .= $this->_sep . 'treinta'; - break; - - case 2: - if ($d == 0) { - $ret .= $this->_sep . 'veinte'; - } - else { - if (($power > 0) and ($d == 1)) { - $ret .= $this->_sep . 'veintiún'; - } - else { - $ret .= $this->_sep . 'veinti' . $this->_digits[$d]; - } - } - break; - - case 1: - switch ($d) - { - case 0: - $ret .= $this->_sep . 'diez'; - break; - - case 1: - $ret .= $this->_sep . 'once'; - break; - - case 2: - $ret .= $this->_sep . 'doce'; - break; - - case 3: - $ret .= $this->_sep . 'trece'; - break; - - case 4: - $ret .= $this->_sep . 'catorce'; - break; - - case 5: - $ret .= $this->_sep . 'quince'; - break; - - case 6: - case 7: - case 9: - case 8: - $ret .= $this->_sep . 'dieci' . $this->_digits[$d]; - break; - } - break; - } - - // add digits only if it is a multiple of 10 and not 1x or 2x - if (($t != 1) and ($t != 2) and ($d > 0)) - { - if($t != 0) // don't add 'y' for numbers below 10 - { - // use 'un' instead of 'uno' when there is a suffix ('mil', 'millones', etc...) - if(($power > 0) and ($d == 1)) { - $ret .= $this->_sep.' y un'; - } - else { - $ret .= $this->_sep.'y '.$this->_digits[$d]; - } - } - else { - if(($power > 0) and ($d == 1)) { - $ret .= $this->_sep.'un'; - } - else { - $ret .= $this->_sep.$this->_digits[$d]; - } - } - } - - if ($power > 0) - { - if (isset($this->_exponent[$power])) { - $lev = $this->_exponent[$power]; - } - - if (!isset($lev) || !is_array($lev)) { - return null; - } - - // if it's only one use the singular suffix - if (($d == 1) and ($t == 0) and ($h == 0)) { - $suffix = $lev[0]; - } - else { - $suffix = $lev[1]; - } - if ($num != 0) { - $ret .= $this->_sep . $suffix; - } - } - - if ($dec) { - $dec = $this->toWords(trim($dec)); - $ret.= ' con ' . trim ($dec); - } - - return $ret; - } - // }}} - - // {{{ toCurrency() - - /** - * Converts a currency value to its word representation - * (with monetary units) in Agentinian Spanish language - * - * @param integer $int_curr An international currency symbol - * as defined by the ISO 4217 standard (three characters) - * @param integer $decimal A money total amount without fraction part (e.g. amount of dollars) - * @param integer $fraction Fractional part of the money amount (e.g. amount of cents) - * Optional. Defaults to false. - * - * @return string The corresponding word representation for the currency - * - * @access public - * @author Martin Marrese - */ - function toCurrencyWords($int_curr, $decimal, $fraction = false) { - $int_curr = strtoupper($int_curr); - if (!isset($this->_currency_names[$int_curr])) { - $int_curr = $this->def_currency; - } - $curr_names = $this->_currency_names[$int_curr]; - $lev = ($decimal == 1) ? 0 : 1; - if ($lev > 0) { - if (count($curr_names[0]) > 1) { - $ret = $curr_names[0][$lev]; - } else { - $ret = $curr_names[0][0] . 's'; - } - } else { - $ret = $curr_names[0][0]; - } - $ret .= $this->_sep . trim($this->toWords($decimal)); - - if ($fraction !== false) { - $ret .= $this->_sep .'con'. $this->_sep . trim($this->toWords($fraction)); - $lev = ($fraction == 1) ? 0 : 1; - if ($lev > 0) { - if (count($curr_names[1]) > 1) { - $ret .= $this->_sep . $curr_names[1][$lev]; - } else { - $ret .= $this->_sep . $curr_names[1][0] . 's'; - } - } else { - $ret .= $this->_sep . $curr_names[1][0]; - } - } - return $ret; - } - // }}} - - - -} -?> diff --git a/test/prueba_agente.php b/test/prueba_agente.php deleted file mode 100755 index b95ec2f..0000000 --- a/test/prueba_agente.php +++ /dev/null @@ -1,20 +0,0 @@ -#!/usr/bin/php4 -qC -getNombre()); -#var_dump($agente->getDependencia()); -#var_dump($agente->getCuil()); -#var_dump($agente->getTipo()); -#var_dump($agente->getHoraDesde()); -#var_dump($agente->getHoraHasta()); -var_dump($agente->getOtrosDatos()); - -?> - diff --git a/test/prueba_dependencia.php b/test/prueba_dependencia.php deleted file mode 100755 index 5ea3d87..0000000 --- a/test/prueba_dependencia.php +++ /dev/null @@ -1,11 +0,0 @@ -#!/usr/bin/php4 -qC -getAgentes() as $a) - echo $a->getNombre()."\n"; - -?> - -- 2.43.0