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 -------------------------------------------------------------------------------
25 -----------------------------------------------------------------------------*/
27 require_once '/home/mmarrese/public_html/intranet/sistema/local_lib/Servicios/Agenda.php';
28 require_once 'HTML/Table.php';
29 require_once '../../../local_lib/HTML_DietMarco.php';
30 require_once 'MECON/HTML/QuickForm.php';
31 require_once 'HTML/Image.php';
32 require_once 'HTML/Link.php';
33 require_once 'DB.php';
35 //CREO LA CONEXION A LA BASE DE DATOS {{{
36 $DB = DB::connect("mysql://intranet:intranet@intranet-db/agenda",true);
37 if (DB::isError($DB)) {
38 die ($DB->getMessage());
41 //CREO LOS OBJETOS NECESARIOS {{{
42 $MARCO = new HTML_DietMarco('servicios');
43 $FORM = new MECON_HTML_QuickForm('agenda', '', '', '', array ('method' => 'post', 'onSubmit' => "return validar(this)", 'action' => ''));
44 $TABLA = new HTML_Table('width="760"');
45 $IMG1 = new HTML_Image('../../images/servicios_agenda_lupa.gif');
46 $IMG2 = new HTML_Image('../../images/servicios_agenda_mail.gif');
47 $TELECO = new HTML_Image('../../images/servicios_agenda_teleco.gif');
48 $LINK_1 = new HTML_Link('mailto:teleco@mecon.gov.ar', $IMG2);
49 $LINK_2 = new HTML_Link('mailto:teleco@mecon.gov.ar', 'Consultas', array(), array ('class' => 'txt2'));
51 //OBTENGO LOS DATOS DE LAS BASES {{{
52 $EDIFICIOS = Servicios_Agenda::getEdificios($DB);
54 //AGREGO LOS ELEMENTOS AL FORM {{{
55 $header =& $FORM->addElement('header', 'comun' , $IMG1->toHtml().'Búsqueda de Internos');
56 $interno =& $FORM->addElement('text' , 'interno' , 'Interno' , array ("size" => '10 , "maxlength" => "4"'));
57 $usuario =& $FORM->addElement('text' , 'nombre' , 'Usuario' , array ("size" => '40'));
58 $codep =& $FORM->addElement('text' , 'codep' , 'Codep' , array ("size" => '40', "maxlength" => "10"));
59 $dependencia =& $FORM->addElement('text' , 'dependencia', 'Dependencia', array ("size" => '40', "value" => "--Ingrese una palabra clave--"));
60 $edificio =& $FORM->addElement('select', 'edificio' , 'Edificio' , $EDIFICIOS, array('size' => '1'));
61 $piso =& $FORM->addElement('text' , 'piso' , 'Piso' , array ("size" => '10', "maxlength" => "5"));
62 $oficina =& $FORM->addElement('text' , 'oficina' , 'Oficina' , array ("size" => '10', "maxlength" => "5"));
65 $grupo[] =& HTML_QuickForm::createElement('radio', 'op1', null, 'interno');
66 $grupo[] =& HTML_QuickForm::createElement('radio', 'op1', null, 'usuario');
67 $grupo[] =& HTML_QuickForm::createElement('radio', 'op1', null, 'dependencia');
68 $grupo[] =& HTML_QuickForm::createElement('radio', 'op1', null, 'edificio');
69 $ordenar =& $FORM->addGroup($grupo, 'Ordenado por', 'Ordenado por', ' ', true);
70 $grupo[1]->setChecked(false);
71 $grupo[2]->setChecked(false);
72 $grupo[3]->setChecked(false);
75 $grupo2[] =& HTML_QuickForm::createElement('submit', 'aceptar' , 'Buscar');
76 $grupo2[] =& HTML_QuickForm::createElement('button', 'cancelar', 'Cancelar', array ('onClick' => 'javascript:window.location =\'../../servicios.php\';return false;'));
77 $botones =& $FORM->addGroup($grupo2, 'botones');
80 $MARCO->addStyleSheet(PATH_RAIZ.'css/servicios_agenda.css'); //EL PROBLEMA QUE ESTO LO NECESITO PARA QUE FUNCIONE EL RENDERER NUEVO
81 $FORM->setRenderer('MECON_HTML_QuickForm_Renderer_Tabla_Servicios');
82 $FORM->setRendererOpts('width="500"');
85 $TABLA->addRow(array($LINK_1->toHtml(), $LINK_2->toHtml(), $TELECO->toHtml()));
86 $TABLA->updateColAttributes(0,'width="24"');
87 $TABLA->updateColAttributes(1,'width="60"');
88 $TABLA->updateColAttributes(2,'width="676" class="txt_derecha"');
89 $TABLA->addRow(array($FORM), 'colspan="3"');
91 //AGREGO EL JAVASCRIPT DE VALIDACION {{{
93 function validar(theForm)
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 una opción de búsqueda');theForm.interno.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 un párametro adicional para la búsqueda');theForm.edificio.focus();return(false);
109 if(theForm.interno.value=="" && theForm.nombre.value=="" && theForm.codep.value=="" && theForm.piso.value!="" && theForm.oficina.value==""
110 && (theForm.dependencia.value=="" || theForm.dependencia.value=='--Ingrese una palabra clave--')
111 && theForm.edificio.options[theForm.edificio.selectedIndex].value=="-")
113 alert('Indique el edificio');theForm.edificio.focus();return(false);
116 if (theForm.dependencia.value=="" || theForm.dependencia.value=='--Ingrese una palabra clave--')
117 {theForm.dependencia.value='-';}
122 $MARCO->addScriptDeclaration($JS);
124 //MUESTRO LA INFO {{{
125 $MARCO->addTitle('Agenda Telefonica');
126 $MARCO->addBodyContent($TABLA);