1 <?php /* vim: set binary expandtab tabstop=4 shiftwidth=4 foldmethod=marker:
2 -------------------------------------------------------------------------------
5 -------------------------------------------------------------------------------
6 This file is part of agenda.
8 agenda 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 agenda 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: lun ago 11 14:10:35 ART 2003
22 Autor: Martin Marrese <mmarre@mecon.gov.ar>
23 -------------------------------------------------------------------------------
24 $Id: agenda1.php 64 2003-08-21 18:48:28Z mmarre $
25 -----------------------------------------------------------------------------*/
28 require_once 'HTML/Table.php';
29 require_once 'MECON/HTML/Tabla.php';
30 require_once '../../../local_lib/HTML_DietMarco.php';
31 require_once '../../../local_lib/Servicios/Bandas/Buscador.php';
32 require_once 'MECON/HTML/QuickForm.php';
33 require_once 'MECON/HTML/Image.php';
34 require_once 'DB.php';
37 //CREO LA CONEXION A LA BASE DE DATOS {{{
38 $DB = DB::connect("mysql://intranet:intranet@bal747f/bandas",true);
39 if (DB::isError($DB)) {
40 die ($DB->getMessage());
44 //CREO LOS OBJETOS NECESARIOS {{{
45 $TABLAFORM = new MECON_HTML_Tabla ('width="500"', 'servicio');
46 $MARCO = new HTML_DietMarco('servicios');
47 $FORM = new MECON_HTML_QuickForm('bandas', 'post', 'banda_agente', '', array ('onSubmit' => "return validar(this)", 'action' => ''));
48 $FORM->renderer->setTable($TABLAFORM);
49 $TABLA = new HTML_Table('width="760" border="0" cellspacing="0" cellpadding="0" bgcolor="#FFFFFF"');
52 //OBTENGO LOS DATOS DE LAS BASES {{{
53 setlocale (LC_ALL, 'es_AR');
54 $RESULT_MESES = Servicios_Bandas_Buscador::getMeses($DB);
56 foreach ($RESULT_MESES as $m)
58 $mes = strftime("%B", mktime(0,0,0,$m[0],1,$m[1]));
59 $MESES[$m[1].'-'.$m[0]] = $m[1].'-'.$mes;
63 //AGREGO LOS ELEMENTOS AL FORM {{{
64 $header =& $FORM->addElement('header', 'comun' , 'Ingreso de fecha');
65 $edificio =& $FORM->addElement('select', 'fecha' , 'Meses Disponibles' , $MESES, array('size' => '1'));
66 //Agrego el botón del formulario
68 $grupo[] =& HTML_QuickForm::createElement('submit', 'aceptar' , 'Buscar');
69 $botones =& $FORM->addGroup($grupo, 'botones');
74 $MARCO->addStyleSheet('../../css/servicios_bandas.css'); //EL PROBLEMA QUE ESTO LO NECESITO PARA QUE FUNCIONE EL RENDERER NUEVO
79 $TABLA->addRow(array($FORM));
82 //AGREGO EL JAVASCRIPT DE VALIDACION {{{
83 //Este js esta copiado del epl original, ya que con los campos del formulario
84 //llamados de la misma manera las reglas de validacion ya se cumplen.
86 function validar(theForm)
88 if(theForm.interno.value=="" && theForm.nombre.value=="" && theForm.codep.value=="" && theForm.piso.value=="" && theForm.oficina.value==""
89 && (theForm.dependencia.value=="" || theForm.dependencia.value=='--Ingrese una palabra clave--')
90 && theForm.edificio.options[theForm.edificio.selectedIndex].value=="-")
92 alert('Indique una opción de búsqueda');theForm.interno.focus();return(false);
95 if(theForm.interno.value=="" && theForm.nombre.value=="" && theForm.codep.value=="" && theForm.piso.value=="" && theForm.oficina.value==""
96 && (theForm.dependencia.value=="" || theForm.dependencia.value=='--Ingrese una palabra clave--')
97 && theForm.edificio.options[theForm.edificio.selectedIndex].value!="-")
99 alert('Indique un párametro adicional para la búsqueda');theForm.edificio.focus();return(false);
102 if(theForm.interno.value=="" && theForm.nombre.value=="" && theForm.codep.value=="" && theForm.piso.value!="" && theForm.oficina.value==""
103 && (theForm.dependencia.value=="" || theForm.dependencia.value=='--Ingrese una palabra clave--')
104 && theForm.edificio.options[theForm.edificio.selectedIndex].value=="-")
106 alert('Indique el edificio');theForm.edificio.focus();return(false);
109 if (theForm.dependencia.value=="" || theForm.dependencia.value=='--Ingrese una palabra clave--')
110 {theForm.dependencia.value='-';}
115 //$MARCO->addScriptDeclaration($JS);
117 //MUESTRO LA INFO {{{
118 $MARCO->addTitle('Bandas Horarias');
119 $MARCO->addBodyContent($TABLA);