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->setSistema(SAMURAI_PERM);
25 if (!$SAMURAI_PERM->tiene(SAMURAI_PERM_DEVELOPER)) {
26 $SAMURAI_PERM->chequear(SAMURAI_PERM_DEVELOPER);
28 $MARCO =& new MECON_Marco ('/var/www/sistemas/samurai/sistema/conf/confSecciones.php', $SAMURAI_PERM);
31 require_once 'MECON/HTML/QuickForm.php';
32 require_once 'MECON/HTML/Tabla.php';
33 require_once 'SAMURAI/Sistema.php';
34 require_once 'SAMURAI/Permiso.php';
39 // vim: set expandtab tabstop=4 softtabstop=4 shiftwidth=4 foldmethod=marker:
40 // +----------------------------------------------------------------------+
41 // | Ministerio De Economia |
42 // +----------------------------------------------------------------------+
43 // | Archivo generado automaticamente por samurai. |
44 // | Definicion de constantes para su uso en los sistemas. |
45 // +----------------------------------------------------------------------+
55 //CREO LOS OBJETOS NECESARIOS {{{
56 $TABLAFORM = new MECON_HTML_Tabla ('width="400"', 'comun');
57 $FORM = new MECON_HTML_QuickForm ('php_constantes','post','php-constantes');
58 $FORM->renderer->setTable($TABLAFORM);
59 $SISTEMAS = SAMURAI_Sistema::getArraySistemas($DB);
61 //AGREGO LOS ELEMENTOS DEL FORM {{{
62 $FORM->addElement ('header', 'cabecera', 'Seleccione el sistema.');
63 $FORM->addElement ('select', 'sistemas', 'Sistemas', $SISTEMAS, array('size' => '1'));
64 $group[] = HTML_QuickForm::createElement('submit', 'aceptar' , 'Seleccionar');
65 $FORM->addGroup($group,'botones', '', ', ');
67 //VALIDO EL FORMULARIO {{{
68 if ($FORM->validate()) {
69 $f_sistema =& $FORM->getElement ('sistemas');
70 $tmp = $f_sistema->getSelected();
71 $SISTEMA = new SAMURAI_Sistema ($DB, $tmp[0]);
73 $nombre_sistema= strtoupper(strtr($SISTEMA->getNombre().'_PERM', array(
74 '$'=>'_', '@'=>'_' , '!'=>'_' , '#'=>'_', '%'=>'_',
75 '^'=>'_', '&'=>'_' , '*'=>'_' , '-'=>'_', '+'=>'_',
76 '='=>'_', '\\'=>'_', '|'=>'_' , '`'=>'_', '~'=>'_',
77 '/'=>'_', '\"'=>'_', '\''=>'_', '<'=>'_', '>'=>'_',
78 '?'=>'_' , ','=>'_' , 'ç'=>'c', 'Ç'=>'C', ' '=>'_')
81 $permisos = SAMURAI_Permiso::getArrayPermisos($DB, $SISTEMA->getId());
83 //Armo el contenido {{{
85 $contenido.= "\n\n/** @file\n * Definicion de Constantes del sistema ".
86 $SISTEMA->getNombre()."\n */";
88 $contenido.= "\n\n/**\n * Identificador del Sistema\n */\n";
89 $contenido.= 'define(\''.$nombre_sistema.'\', '.$SISTEMA->getId().');';
91 foreach ($permisos as $key => $value) {
92 $contenido.= "\n\n/**\n * Identificacion del permiso ". $value ."\n */\n";
93 $value= strtoupper(strtr($value,
95 '$'=>'_', '@'=>'_' , '!'=>'_' , '#'=>'_', '%'=>'_',
96 '^'=>'_', '&'=>'_' , '*'=>'_' , '-'=>'_', '+'=>'_',
97 '='=>'_', '\\'=>'_', '|'=>'_' , '`'=>'_', '~'=>'_',
98 '/'=>'_', '\"'=>'_', '\''=>'_', '<'=>'_', '>'=>'_',
99 '?'=>'_' , ','=>'_' , 'ç'=>'c', 'Ç'=>'C', ' '=>'_')
102 $contenido.= 'define(\''.$nombre_sistema.'_'.$value.'\', '.$key.');';
107 //Envio el archivo {{{
108 header('Content-type: application/octet-stream');
109 header("Content-Disposition: attachment; filename=permisos.php");
115 //DIBUJO LA PAGINA {{{
116 $MARCO->addBody($FORM);
117 $MARCO->setTitle('Definicion de constantes');