2 // vim: set expandtab tabstop=4 softtabstop=4 shiftwidth=4 foldmethod=marker:
3 // +----------------------------------------------------------------------+
5 // +----------------------------------------------------------------------+
6 // | Copyright (c) 1997-2003 The PHP Group |
7 // +----------------------------------------------------------------------+
8 // | This source file is subject to version 2.02 of the PHP license, |
9 // | that is bundled with this package in the file LICENSE, and is |
10 // | available at through the world-wide-web at |
11 // | http://www.php.net/license/2_02.txt. |
12 // | If you did not receive a copy of the PHP license and are unable to |
13 // | obtain it through the world-wide-web, please send a note to |
14 // | license@php.net so we can mail you a copy immediately. |
15 // +----------------------------------------------------------------------+
16 // | Created: lun jul 7 10:39:58 ART 2003
17 // | Author: Martin Marrese <mmarre@mecon.gov.ar>
18 // +----------------------------------------------------------------------+
24 require_once 'MECON/HTML/Page.php';
25 require_once 'MECON/HTML/QuickForm.php';
26 require_once 'MECON/HTML/Tabla.php';
27 require_once 'SAMURAI/Sistema.php';
28 require_once 'MECON/HTML/Image.php';
31 //CREO LOS OBJETOS NECESARIOS {{{
32 $PAGE =& new MECON_HTML_Page();
33 $FORM =& new MECON_HTML_QuickForm ('sel_sistema','post','sel-sistema');
34 $TABLA =& new HTML_Table('width="760"');
35 $TABLAFORM =& new MECON_HTML_Tabla ('width="400"', 'comun');
36 $FORM->renderer->setTable($TABLAFORM);
37 $SISTEMAS = SAMURAI_Sistema::getArraySistemasSeleccionar($DB);
40 //AGREGO LOS ELEMENTOS DEL FORM {{{
41 $FORM->addElement ('header', 'cabecera', 'Seleccione el sistema con el cual quiere trabajar');
42 $FORM->addElement ('select', 'sistemas', 'Sistemas', $SISTEMAS, array('size' => '1'));
43 if (@$_GET['redirect']) {
44 $redirect = $_GET['redirect'];
46 elseif (@$_POST['redirect']) {
47 $redirect = $_POST['redirect'];
52 $FORM->addElement ('hidden', 'redirect', $redirect);
53 $group[] = HTML_QuickForm::createElement('submit', 'aceptar' , 'Seleccionar');
54 $FORM->addGroup($group,'botones', '', ', ');
57 //VALIDO EL FORMULARIO {{{
58 if ($FORM->validate()) {
59 $sistema =& $FORM->getElement ('sistemas');
60 $tmp = $sistema->getSelected();
61 $_SESSION['samurai']['id_sistema'] = $tmp['0'];
63 if ($FORM->elementExists('responsable')) {
64 $responsable =& $FORM->getElement ('responsable');
65 $_SESSION['usuario'] = $responsable->getValue();
67 header('Location: '.$_POST['redirect']);
71 //DIBUJO LA PAGINA {{{
72 $im =& new MECON_HTML_Image('images/copete.jpg',
73 'Intranet - MEcon - SAMURAI');
75 $TABLA->addRow(array($im), 'align="center"');
76 $TABLA->addRow(array($FORM), 'align="center"');
78 $PAGE->addStyleSheet($FORM->getCss());
79 $PAGE->addBodyContent('<div align="left">');
80 $PAGE->addBodyContent($TABLA);
81 $PAGE->addBodyContent('</div>');
82 $PAGE->setTitle('Seleccionar Sistema');