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: mar may 27 15:16:38 ART 2003
17 // | Author: Martin Marrese <mmarre@mecon.gov.ar>
18 // +----------------------------------------------------------------------+
22 //VERIFICO SI SE TIENE ACCESO A LA PAGINA{{{
23 $SAMURAI_PERM->setSistema(SAMURAI_PERM);
24 if (!$SAMURAI_PERM->tiene(SAMURAI_PERM_DEVELOPER)) {
25 $SAMURAI_PERM->chequear(SAMURAI_PERM_DEVELOPER);
27 $MARCO =& new MECON_Marco ('/var/www/sistemas/samurai/sistema/conf/confSecciones.php', $SAMURAI_PERM);
30 require_once 'MECON/HTML/Tabla.php';
31 require_once 'SAMURAI/Permiso.php';
33 //LINKS A PERMISOS-ABM {{{
34 $aH = '<a href="permisos-abm?accion=##ACCION##&idPermiso=##NUEVO##">';
35 $aHModif = $aH.'<img src="/MECON/images/general_modificar.gif" border="0" alt="Modificar Permiso"></a>';
36 $aHElim = $aH.'<img src="/MECON/images/general_eliminar.gif" border="0" alt="Eliminar Permiso" ></a>';
37 $aHModifdes = '<img src="/MECON/images/general_modificar_des.gif" border="0" alt="No se puede modificar Permiso">';
38 $aHElimdes = '<img src="/MECON/images/general_eliminar_des.gif" border="0" alt="No se puede eliminar Permiso">';
40 //VEO SI HAY QUE ELEGIR EN QUE SISTEMA TRABAJAR {{{
41 if (!@$_SESSION['samurai']['id_sistema']) {
42 header('Location: ./../sel-sistema?redirect=permisos/permisos');
45 //CREO LOS OBJETOS NECESARIOS {{{
46 $TABLA2 = new MECON_HTML_Tabla ('cellspacing=0');
47 $TABLA = new MECON_HTML_Tabla ('cellpadding=2');
49 //OBTENGO LA INFORMACION DE LA BASE {{{
50 $permisos = SAMURAI_Permiso::getPermisos($DB);
52 //AGREGO LOS DATOS A LAS TABLAS {{{
53 $row = array ($aH.'<img src="/MECON/images/general_nuevo.gif" border="0">Ingresar Nuevo Permiso</a>');
54 $TABLA2->addRow($row,'align=right');
55 $row = array ('Id','DescripciĆ³n','Modif.','Elim.');
56 $TABLA->addRow($row,'cabecera');
58 foreach ($permisos as $permiso) {
59 if ($permiso->asociadoASistema()) {
64 $Modif = ereg_replace('##NUEVO##' , $permiso->getId(), $aHModif);
65 $Elim = ereg_replace('##NUEVO##' , $permiso->getId(), $aHElim );
66 $Modif = ereg_replace('##ACCION##' , 'm' , $Modif );
67 $Elim = ereg_replace('##ACCION##' , 'e' , $Elim );
69 $row = array ( $permiso->getId(),
70 $permiso->getDescripcion(),
75 $TABLA->updateColAttributes(0,'width="10%" ');
76 $TABLA->updateColAttributes(1,'width="70%"');
77 $TABLA->updateColAttributes(2,'width="10%"');
78 $TABLA->updateColAttributes(3,'width="10%"');
79 $TABLA->updateRowAttributes(0,'cabecera');
82 //DIBUJO LA PAGINA {{{
83 $MARCO->addBody($TABLA2->toHtml(1));
84 $MARCO->addBody($TABLA);