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 // +----------------------------------------------------------------------+
49 $start.= "\n\n\n\n//Servidor: ". $_SERVER['SERVER_NAME'];
56 //CREO LOS OBJETOS NECESARIOS {{{
57 $TABLAFORM = new MECON_HTML_Tabla ('width="400"', 'comun');
58 $FORM = new MECON_HTML_QuickForm ('php_constantes','post','php-constantes');
59 $FORM->renderer->setTable($TABLAFORM);
60 $SISTEMAS = SAMURAI_Sistema::getArraySistemas($DB);
62 //AGREGO LOS ELEMENTOS DEL FORM {{{
63 $FORM->addElement ('header', 'cabecera', 'Seleccione el sistema.');
64 $FORM->addElement ('select', 'sistemas', 'Sistemas', $SISTEMAS, array('size' => '1'));
65 $group[] = HTML_QuickForm::createElement('submit', 'aceptar' , 'Seleccionar');
66 $FORM->addGroup($group,'botones', '', ', ');
68 //VALIDO EL FORMULARIO {{{
69 if ($FORM->validate()) {
70 $f_sistema =& $FORM->getElement ('sistemas');
71 $tmp = $f_sistema->getSelected();
72 $SISTEMA = new SAMURAI_Sistema ($DB, $tmp[0]);
74 $nombre_sistema= strtoupper(strtr($SISTEMA->getNombre().'_PERM', array(
75 '$'=>'_', '@'=>'_' , '!'=>'_' , '#'=>'_', '%'=>'_',
76 '^'=>'_', '&'=>'_' , '*'=>'_' , '-'=>'_', '+'=>'_',
77 '='=>'_', '\\'=>'_', '|'=>'_' , '`'=>'_', '~'=>'_',
78 '/'=>'_', '\"'=>'_', '\''=>'_', '<'=>'_', '>'=>'_',
79 '?'=>'_' , ','=>'_' , 'ç'=>'c', 'Ç'=>'C', ' '=>'_')
82 $permisos = SAMURAI_Permiso::getArrayPermisos($DB, $SISTEMA->getId());
84 //Armo el contenido {{{
86 $contenido.= "\n\n/** @file\n * Definicion de Constantes del sistema ".
87 $SISTEMA->getNombre()."\n */";
89 $contenido.= "\n\n/**\n * Identificador del Sistema\n */\n";
90 $contenido.= 'define(\''.$nombre_sistema.'\', '.$SISTEMA->getId().');';
92 foreach ($permisos as $key => $value) {
93 $contenido.= "\n\n/**\n * Identificacion del permiso ". $value ."\n */\n";
94 $value= strtoupper(strtr($value,
96 '$'=>'_', '@'=>'_' , '!'=>'_' , '#'=>'_', '%'=>'_',
97 '^'=>'_', '&'=>'_' , '*'=>'_' , '-'=>'_', '+'=>'_',
98 '='=>'_', '\\'=>'_', '|'=>'_' , '`'=>'_', '~'=>'_',
99 '/'=>'_', '\"'=>'_', '\''=>'_', '<'=>'_', '>'=>'_',
100 '?'=>'_' , ','=>'_' , 'ç'=>'c', 'Ç'=>'C', ' '=>'_')
103 $contenido.= 'define(\''.$nombre_sistema.'_'.$value.'\', '.$key.');';
108 //Envio el archivo {{{
109 header('Content-type: application/octet-stream');
110 header("Content-Disposition: attachment; filename=permisos.php");
116 //DIBUJO LA PAGINA {{{
117 $MARCO->addBody($FORM);
118 $MARCO->setTitle('Definicion de constantes');