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);
31 require_once 'MECON/HTML/Image.php';
32 require_once 'MECON/HTML/Link.php';
33 require_once 'MECON/HTML/TablaDB.php';
34 require_once 'SAMURAI/Permiso.php';
37 //VEO SI HAY QUE ELEGIR EN QUE SISTEMA TRABAJAR {{{
38 if (!@$_SESSION['samurai']['id_sistema']) {
39 header('Location: ./../sel-sistema?redirect=permisos/permisos');
43 //OBTENGO LA INFORMACION DE LA BASE {{{
44 $res = SAMURAI_Permiso::getPermisosPager($DB);
45 if (PEAR::isError($res)) {
46 trigger_error('Error: ' . $res->getMessage() . "\n", E_USER_ERROR);
51 //CREO LA TABLA DE PERMISOS {{{
52 $TABLA =& new MECON_HTML_TablaDB ('Permisos');
56 'permisos-abm', 'Nuevo Permiso',
58 'accion' => '##ACCION##',
59 'idPermiso' => '##NUEVO##'
63 $TABLA->addRow(array('Id', 'DescripciĆ³n', 'Modif.', 'Elimn.'), 'cabecera');
64 $pager = $TABLA->addPager($res, null, new MECON_HTML_Link ('permisos', null), 25);
66 //Agrego las columnas de modificacion y eliminacion {{{
68 $TABLA->addRowsData('%s',
80 function modificar_callback($param) {
81 if ($param['cuenta']) {
83 $tmp =& new MECON_HTML_Image (
84 '/MECON/images/general_modificar_des.gif',
87 return $tmp->toHtml();
91 $tmp =& new MECON_HTML_Link (
93 new MECON_HTML_Image (
94 '/MECON/images/general_modificar.gif',
99 'idPermiso' => $param['id_permiso']
102 return $tmp->toHtml();
107 $TABLA->addRowsData('%s',
119 function eliminar_callback($param) {
120 if ($param['cuenta']) {
122 $tmp =& new MECON_HTML_Image (
123 '/MECON/images/general_eliminar_des.gif',
126 return $tmp->toHtml();
130 $tmp =& new MECON_HTML_Link (
132 new MECON_HTML_Image (
133 '/MECON/images/general_eliminar.gif',
138 'idPermiso' => $param['id_permiso']
141 return $tmp->toHtml();
147 $TABLA->addRows($pager, array ('id_permiso', 'desc_permiso'));
148 $TABLA->updateColAttributes(0,'width="10%" ');
149 $TABLA->updateColAttributes(1,'width="70%"');
150 $TABLA->updateColAttributes(2,'width="10%"');
151 $TABLA->updateColAttributes(3,'width="10%"');
154 //DIBUJO LA PAGINA {{{
155 $MARCO->addBody($TABLA);