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: jue sep 18 14:29:07 ART 2003
17 // | Author: Martin Marrese <mmarre@mecon.gov.ar>
18 // +----------------------------------------------------------------------+
23 //VERIFICO SI SE TIENE ACCESO A LA PAGINA{{{
24 $SAMURAI_PERM->chequear(SAMURAI_PERM_DEVELOPER);
27 require_once 'MECON/HTML/QuickForm.php';
28 require_once 'MECON/HTML/Tabla.php';
29 require_once 'SAMURAI/Sistema.php';
30 require_once 'SAMURAI/Permiso.php';
35 // vim: set expandtab tabstop=4 softtabstop=4 shiftwidth=4 foldmethod=marker:
36 // +----------------------------------------------------------------------+
37 // | Ministerio De Economia |
38 // +----------------------------------------------------------------------+
39 // | Archivo generado automaticamente por samurai. |
40 // | Definicion de constantes para su uso en los sistemas. |
41 // +----------------------------------------------------------------------+
51 //CREO LOS OBJETOS NECESARIOS {{{
52 $TABLAFORM = new MECON_HTML_Tabla ('width="500"', 'comun');
53 $FORM = new MECON_HTML_QuickForm ('php_constantes','post','php-constantes');
54 $FORM->renderer->setTable($TABLAFORM);
55 $SISTEMAS = SAMURAI_Sistema::getArraySistemas($DB);
57 //AGREGO LOS ELEMENTOS DEL FORM {{{
58 $FORM->addElement ('header', 'cabecera', 'Seleccione el sistema.');
59 $FORM->addElement ('select', 'sistemas', 'Sistemas', $SISTEMAS, array('size' => '1'));
60 $group[] = HTML_QuickForm::createElement('submit', 'aceptar' , 'Seleccionar');
61 $FORM->addGroup($group,'botones', '', ', ');
63 //VALIDO EL FORMULARIO {{{
64 if ($FORM->validate()) {
65 $f_sistema =& $FORM->getElement ('sistemas');
66 $tmp = $f_sistema->getSelected();
67 $SISTEMA = new SAMURAI_Sistema ($DB, $tmp[0]);
69 $nombre_sistema= strtoupper(strtr($SISTEMA->getNombre().'_PERM', array(
70 '$'=>'_', '@'=>'_' , '!'=>'_' , '#'=>'_', '%'=>'_',
71 '^'=>'_', '&'=>'_' , '*'=>'_' , '-'=>'_', '+'=>'_',
72 '='=>'_', '\\'=>'_', '|'=>'_' , '`'=>'_', '~'=>'_',
73 '/'=>'_', '\"'=>'_', '\''=>'_', '<'=>'_', '>'=>'_',
74 '?'=>'_' , ','=>'_' , 'ç'=>'c', 'Ç'=>'C', ' '=>'_')
77 $permisos = SAMURAI_Permiso::getArrayPermisos($DB, $SISTEMA->getId());
79 //Armo el contenido {{{
81 $contenido.= "\n\n/** @file\n * Definicion de Constantes del sistema ".
82 $SISTEMA->getNombre()."\n */";
84 $contenido.= "\n\n/**\n * Identificador del Sistema\n */\n";
85 $contenido.= 'define(\''.$nombre_sistema.'\', '.$SISTEMA->getId().');';
87 foreach ($permisos as $key => $value) {
88 $contenido.= "\n\n/**\n * Identificacion del permiso ". $value ."\n */\n";
89 $value= strtoupper(strtr($value,
91 '$'=>'_', '@'=>'_' , '!'=>'_' , '#'=>'_', '%'=>'_',
92 '^'=>'_', '&'=>'_' , '*'=>'_' , '-'=>'_', '+'=>'_',
93 '='=>'_', '\\'=>'_', '|'=>'_' , '`'=>'_', '~'=>'_',
94 '/'=>'_', '\"'=>'_', '\''=>'_', '<'=>'_', '>'=>'_',
95 '?'=>'_' , ','=>'_' , 'ç'=>'c', 'Ç'=>'C', ' '=>'_')
98 $contenido.= 'define(\''.$nombre_sistema.'_'.$value.'\', '.$key.');';
103 //Envio el archivo {{{
104 header('Content-type: application/octet-stream');
105 header("Content-Disposition: attachment; filename=permisos.php");
111 //DIBUJO LA PAGINA {{{
112 $MARCO->addBody($FORM);
113 $MARCO->setTitle('Definicion de constantes');