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 jul 17 16:29:54 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_ALTA_PERFIL,SAMURAI_BAJA_PERFIL,SAMURAI_MODI_PERFIL);
28 require_once 'MECON/HTML/QuickForm.php';
29 require_once 'MECON/HTML/Error.php';
32 require_once 'SAMURAI/Perfil.php';
33 require_once 'SAMURAI/Permiso.php';
34 require_once 'SAMURAI/Sistema.php';
36 require_once 'MECON/HTML/Image.php';
37 require_once 'HTML/Page.php';
40 //CREO LOS OBJETOS NECESARIOS {{{
41 if (!@$_GET['id_perfil']) {
42 $FORM = new MECON_HTML_Error('No hay un perfil seleccionado');
45 $PAGE = new HTML_Page(array ('doctype'=>'HTML 4.01 Transitional',
46 'charset' => 'iso-8859-1',
51 $PAGE->addStyleSheet('/MECON/css/general_estilos.css');
52 $FORM = new MECON_HTML_QuickForm ('perfil_datos','post','perfil-datos');
53 $PERFIL = new SAMURAI_Perfil($DB, $_GET['id_perfil']);
54 $SISTEMA = new SAMURAI_Sistema ($DB, $_SESSION['samurai']['id_sistema']);
58 //OBTENGO LOS PERMISOS DEL SISTEMA {{{
59 $ASOCIACIONES = $SISTEMA->getAsociaciones();
61 foreach ($ASOCIACIONES as $as) {
62 $clave = $as['id'].'##'.$as['obs'];
63 $texto = ($as['obs'] != '') ? $as['desc'].' - '.$as['obs']: $as['desc'];
64 $PERMISOS[$clave] = $texto;
67 //TRADUZCO EL TIPO DE PERFIL {{{
68 $TipoPerfil = $PERFIL->getTipo();
70 switch ($TipoPerfil) {
71 case 'I': $TipoPerfil = 'Interno';
73 case 'E': $TipoPerfil = 'Externo';
75 case 'D': $TipoPerfil = 'Dios';
80 //AGREGO LOS ELEMENTOS AL FORM {{{
81 $FORM->addElement ('static', 'id_perfil' , 'Id Perfil' , $PERFIL->getId() );
82 $FORM->addElement ('static', 'desc_perfil', 'Descricion' , $PERFIL->getDescripcion() );
83 $perf =& $FORM->addElement('select', 'permisos' , 'Permisos' , $PERMISOS, array ('size'=>'5'));
84 $FORM->addElement ('static', 'tipo_perfil', 'Tipo Perfil' , $TipoPerfil );
85 $perf->setSelected($PERFIL->getPermisos());
89 //DIBUJO LA PAGINA {{{
90 $PAGE->addBodyContent($FORM);
91 $imagen = new MECON_HTML_Image('/MECON/images/general_cerrar.gif');
92 $PAGE->addBodyContent('<a href="" onClick=\'self.close();return false;\'>'.$imagen->toHtml().'</a>');
93 $PAGE->setTitle('Datos del Perfil');