Conjunto 753e2f4 en sipp
- Fecha y hora:
- 30/05/2013 17:09:54 (hace 11 años)
- Branches:
- master, drupal-7.x
- Children:
- 76b2289
- Parents:
- a012c55
- Fichero:
-
- 1 editado
Leyenda
- No modificado
- Añadido
- Eliminado
-
modules/ente_planificador_sipp/ente_planificador_sipp.module
r8ec7804 r753e2f4 1 1 <?php 2 2 /** 3 * Sistema Automatizado para la Planificación Estratégico-Situacional en la Administración Pública Venezolana3 * Sistema de Planificación y Presupuesto - SIPP 4 4 * @file ente_planificador_sipp.module 5 5 * Drupal part Module to code ente planificador module 6 * Copyright 2013 Sistema Automatizado para la Planificación Estratégico-Situacional en la Administración Pública Venezolana (CENDITEL)6 * Copyright 2013 Sistema de Planificación y Presupuesto - SIPP 7 7 * 8 8 * This program is free software; you can redistribute it and/or modify … … 19 19 * along with this program; if not, write to the Free Software 20 20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 21 * 22 * @author Cenditel Merida - Msc. Juan Vizcarrondo 21 * 23 22 * @author Cenditel Merida - Ing. Luis Gerardo Peña Camacho 24 23 * @date 2013-01-10 // (año-mes-dia) … … 32 31 function ente_planificador_sipp_form_alter(&$form, $form_state, $form_id) { 33 32 /* 34 echo $form_id; 35 print "<pre>"; 36 print_r($form); 37 print "</pre>"; 38 */ 33 * Configuración del ente planificador SIPP 34 * Creación del Rol para el Actor Enlace 35 */ 39 36 if ($form_id == 'ente_planificador_admin_settings') { 40 //$iconsets = entes_planificadores_toolbar_get_iconsets(); 41 //foreach($iconsets as $id => $value) { 42 // $icons[$id] = $value->name; 43 44 45 $form['ActorPlanificadorEnlace'] = $form['ActorPlanificadorMacro']; 37 $form['ActorPlanificadorEnlace'] = $form['ActorPlanificadorMacro']; 46 38 $form['ActorPlanificadorEnlace']['#default_value'] = variable_get('ActorPlanificadorEnlace', 2); 47 39 $form['ActorPlanificadorEnlace']['#title'] = 'Rol para el Actor Enlace'; 48 40 $form['ActorPlanificadorEnlace']['#description'] = 'Seleccione el rol para el Actor Enlace'; 49 $form['buttons']['#weight'] = 10; 50 41 $form['buttons']['#weight'] = 10; 51 42 } 52 43 53 44 /* 54 Modificando el registro de usuarios presentando los roles disponibles 55 */ 56 if ($form_id == 'user_register') { 57 /* 58 print "<pre>"; 59 print_r($form_id); 60 //print_r($form); 61 print_r(user_roles()); 62 print "</pre>"; 63 */ 45 * Modificando el Registro de Usuarios presentando los roles disponibles: 46 * Supervisor 47 * Enlace 48 */ 49 if ($form_id == 'user_register') { 64 50 $roles = user_roles(); 65 51 $rolenlace = variable_get('ActorPlanificadorEnlace', 2); 66 //print_r($rolenlace);52 $rolsupervisor = variable_get('ActorPlanificadorMicro', 2); 67 53 $ente_planificador = FALSE; 68 54 if (arg(4) && is_numeric(arg(4))) { … … 71 57 if($ente_planificador->tipo && $ente_planificador->tipo == 2) { 72 58 if (isset($roles[$rolenlace])) { 73 $form['account']['roles']['#options'][$rolenlace] = $roles[$rolenlace]; 59 $form['account']['roles']['#default_value'] = array(2); 60 $form['account']['roles']['#options'][$rolenlace] = $roles[$rolenlace]; 74 61 } 75 62 } 76 63 } 77 64 } 65 66 /* 67 * hook_user 68 * Verificando que se inserte el Rol seleccionado en el Registro del usuario 69 * Si el Rol es Enlace se elimina el Rol Supervisor(Micro) que viene por 70 * defecto del modulo ente_planificador en la función: ente_planificador_user 71 */ 72 function ente_planificador_sipp_user($op, &$edit, &$user, $category = NULL) { 73 switch ($op) { 74 case 'insert': 75 if(array_key_exists('entes', $edit) && $edit['entes']) { 76 $roles = user_roles(); 77 $ente_planificador = node_load($edit['entes']); 78 $rolenlace = variable_get('ActorPlanificadorEnlace', 2); 79 $rolsupervisor = variable_get('ActorPlanificadorMicro', 2); 80 //Si se han creado los roles 81 if(isset($roles[$rolenlace]) && isset($roles[$rolsupervisor])){ 82 if ($ente_planificador->tipo) { 83 if($ente_planificador->tipo && $ente_planificador->tipo == 2) { 84 $edit['roles'][2] = $roles[2]; 85 // Si se selecciona el rol Enlace 86 if(isset($edit['roles'][$rolenlace])){ 87 //Elimina el rol supervisor 88 unset($edit['roles'][$rolsupervisor]); 89 } 90 /* 91 if(isset($edit['roles'][$rolsupervisor])){ 92 unset($edit['roles'][$rolenlace]); 93 */ 94 } 95 } 96 } 97 } 98 break; 99 } 100 }
Nota: Vea TracChangeset
para ayuda en el uso del visor de conjuntos de cambios.