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: miƩ jul 16 12:51:57 ART 2003
17 // | Author: Martin Marrese <mmarre@mecon.gov.ar>
18 // +----------------------------------------------------------------------+
24 require_once 'MECON/HTML/Tabla.php';
25 require_once 'SAMURAI/Usuario.php';
26 require_once 'SAMURAI/Sistema.php';
27 require_once 'HTML/Image.php';
31 $aHrefPopup = '<a href="" onClick="window.open(\'usuarios-datos?login=##LOGIN##\',\'usuariosdatos\',\'height=300,width=400,scrollbars=yes\');return false;">';
32 $aHref = '<a href="usuarios-abm?accion=##ACCION##&login=##NUEVO##">';
33 $aHrefModif = $aHref.'<img src="/MECON/images/general_modificar.gif" border="0" alt="Modificar Usuario"></a>';
34 $aHrefElim = $aHref.'<img src="/MECON/images/general_eliminar.gif" border="0" alt="Eliminar Usuario" ></a>';
36 //VEO SI HAY QUE ELEGIR EN QUE SISTEMA TRABAJAR {{{
37 if (!@$_SESSION['samurai']['id_sistema'] || !@$_SESSION['samurai']['login']) {
38 header('Location: ./../sel-sistema');
41 //CREO LOS OBJETOS NECESARIOS {{{
42 $TABLA2 = new Tabla ('cellspacing=0');
43 $TABLA = new Tabla ('cellpadding=2');
44 $TABLA3 = new Tabla ('cellspacing=0');
45 $SISTEMA = new SAMURAI_Sistema($DB, $_SESSION['samurai']['id_sistema']);
47 //OBTENGO LA INFORMACION DE LA BASE {{{
48 $usuarios = SAMURAI_Usuario::getUsuarios($DB, $_SESSION['samurai']['id_sistema']);
50 //AGREGO LOS DATOS A LAS TABLAS {{{
51 $imagen = new HTML_Image('/MECON/images/vinetas_flecha_doble.gif');
52 $row = array ($imagen->toHtml().' <b>SISTEMA: '.$SISTEMA->getNombre().'</b>');
53 $TABLA3->addRow($row,'align=left');
54 $row = array ($aHref.'<img src="/MECON/images/general_nuevo.gif" border="0">Agregar Nuevo Usuario</a>');
55 $TABLA2->addRow($row,'align=right');
56 $row = array ('Login','Nombre','Modif.','Elim.');
57 $TABLA->addRow($row,'cabecera');
58 foreach ($usuarios as $usuario) {
59 $Popup = ereg_replace('##LOGIN##' , $usuario->getLogin(), $aHrefPopup);
60 $Modif = ereg_replace('##NUEVO##' , $usuario->getLogin(), $aHrefModif);
61 $Elim = ereg_replace('##NUEVO##' , $usuario->getLogin(), $aHrefElim );
62 $Popup = $Popup.$usuario->getLogin().'</a>';
63 $Modif = ereg_replace('##ACCION##', 'm' , $Modif );
64 $Elim = ereg_replace('##ACCION##', 'e' , $Elim );
65 $row = array ( $Popup,
66 $usuario->getNombre(),
73 //DIBUJO LA PAGINA {{{
74 $MARCO->addBody($TABLA3);
75 $MARCO->addBody($TABLA2->toHtml(1));
76 $MARCO->addBody($TABLA);