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','Bandas Horarias');
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 ($m[0]<10)?$m[0]='0'.$m[0]:0;
60 $MESES[$m[1].'-'.$m[0].'-01'] = $m[1].'-'.$mes;
64 //AGREGO LOS ELEMENTOS AL FORM {{{
65 $header =& $FORM->addElement('header', 'comun' , 'Ingreso de fecha');
66 $edificio =& $FORM->addElement('select', 'fecha' , 'Meses Disponibles' , $MESES, array('size' => '1'));
67 //Agrego el botón del formulario
69 $grupo[] =& HTML_QuickForm::createElement('submit', 'aceptar' , 'Buscar');
70 $botones =& $FORM->addGroup($grupo, 'botones');
75 $MARCO->addStyleSheet('../../css/servicios_bandas.css'); //EL PROBLEMA QUE ESTO LO NECESITO PARA QUE FUNCIONE EL RENDERER NUEVO
80 $TABLA->addRow(array($FORM));
83 //AGREGO EL JAVASCRIPT DE VALIDACION {{{
84 //Este js esta copiado del epl original, ya que con los campos del formulario
85 //llamados de la misma manera las reglas de validacion ya se cumplen.
87 function validar(theForm)
89 if(theForm.interno.value=="" && theForm.nombre.value=="" && theForm.codep.value=="" && theForm.piso.value=="" && theForm.oficina.value==""
90 && (theForm.dependencia.value=="" || theForm.dependencia.value=='--Ingrese una palabra clave--')
91 && theForm.edificio.options[theForm.edificio.selectedIndex].value=="-")
93 alert('Indique una opción de búsqueda');theForm.interno.focus();return(false);
96 if(theForm.interno.value=="" && theForm.nombre.value=="" && theForm.codep.value=="" && theForm.piso.value=="" && theForm.oficina.value==""
97 && (theForm.dependencia.value=="" || theForm.dependencia.value=='--Ingrese una palabra clave--')
98 && theForm.edificio.options[theForm.edificio.selectedIndex].value!="-")
100 alert('Indique un párametro adicional para la búsqueda');theForm.edificio.focus();return(false);
103 if(theForm.interno.value=="" && theForm.nombre.value=="" && theForm.codep.value=="" && theForm.piso.value!="" && theForm.oficina.value==""
104 && (theForm.dependencia.value=="" || theForm.dependencia.value=='--Ingrese una palabra clave--')
105 && theForm.edificio.options[theForm.edificio.selectedIndex].value=="-")
107 alert('Indique el edificio');theForm.edificio.focus();return(false);
110 if (theForm.dependencia.value=="" || theForm.dependencia.value=='--Ingrese una palabra clave--')
111 {theForm.dependencia.value='-';}
116 //$MARCO->addScriptDeclaration($JS);
118 //MUESTRO LA INFO {{{
119 $MARCO->addTitle('Bandas Horarias');
120 $MARCO->addBodyContent($TABLA);