$store->addField(new PhpExt_Data_FieldConfigObject("modulo")); $store->addField(new PhpExt_Data_FieldConfigObject("contacto")); $store->addField(new PhpExt_Data_FieldConfigObject("sucursal::nombre")); $store->addField(new PhpExt_Data_FieldConfigObject("sucursal")); $filter_plugin = new PhpExtUx_Grid_GridFilters(); $filter_plugin->addFilter(PhpExt_Grid_FilterConfigObject::createFilter("numeric", "id")); $filter_plugin->addFilter(PhpExt_Grid_FilterConfigObject::createFilter("string", "nombre")); $filter_plugin->addFilter(PhpExt_Grid_FilterConfigObject::createFilter("string", "contacto::apellido")); $filter_plugin->addFilter(PhpExt_Grid_FilterConfigObject::createFilter("string", "sucursal::nombre")); $paging = new PhpExt_Toolbar_PagingToolbar(); $paging->setStore($store)->setPageSize($page_size)->setDisplayInfo(true)->setEmptyMessage("No se encontraron permisos"); $paging->getPlugins()->add($filter_plugin); $txt_nombre = new PhpExt_Form_TextField(); $txt_descripcion = new PhpExt_Form_TextField(); $modulos = array(); if ($listado_modulos = OOB_module::listModules()) { foreach ($listado_modulos as $modulo) { $modulos[] = array($modulo->name(), $modulo->nicename()); } //end each } //end if $store_modulos = new PhpExt_Data_SimpleStore(); $store_modulos->addField("id"); $store_modulos->addField("detalle"); $store_modulos->setData(PhpExt_Javascript::variable(json_encode($modulos))); $cbo_modulo = PhpExt_Form_ComboBox::createComboBox("cbo_modulo")->setStore($store_modulos)->setDisplayField("detalle")->setValueField("id")->setLazyRender(true)->setEditable(false)->setForceSelection(true)->setSingleSelect(true)->setMode(PhpExt_Form_ComboBox::MODE_LOCAL)->setTriggerAction(PhpExt_Form_ComboBox::TRIGGER_ACTION_ALL); $format_contacto = "\n\t function( v, params, record , rowIndex, colIndex, store ){\t\t\t\n\t\treturn record.data['contacto'];\n\t }\n"; $format_modulo = "\n\t function( v, params, record , rowIndex, colIndex, store ){\t\t\t\n\t\treturn record.data['modulenicename'];\n\t }\n"; $col_model = new PhpExt_Grid_ColumnModel(); $col_model->addColumn(PhpExt_Grid_ColumnConfigObject::createColumn("Id", "id", null, 30));
# # @copyright Pablo Micolini # @license BSD ######################################## */ OOB_module::includeClass('seguridad', 'seguridad_permission'); if (!seguridad::isAllowed(seguridad_action::nameConstructor('new', 'permission', 'seguridad'))) { throw new OOB_exception("Acceso Denegado", "403", "Acceso Denegado. Consulte con su Administrador!", true); } global $ari; $ari->t->assign("form", true); $sp = new oob_safepost("form"); $modSelect = ''; $arrModulo = array(); $arrIdModulo = array(); if ($objModulo = OOB_module::listModules()) { foreach ($objModulo as $m) { $arrModulo[] = $m->nicename(); $arrIdModulo[] = $m->name(); if (isset($_POST['cboModulo'])) { //echo $_POST['cboModulo']."<br>"; if ($_POST['cboModulo'] == $m->name()) { $modSelect = $m->name(); } } } } $ari->t->assign("arrModulo", $arrModulo); $ari->t->assign("arrIdModulo", $arrIdModulo); $ari->t->assign("modSelect", $modSelect); if (!isset($_POST['guardar'])) {
//codigo por jpcoseani //script que devuelve el listado de modulos de un rol determinado global $ari; $ari->popup = 1; // no mostrar el main_frame //falta controlar si viene el id del rol y validar si el rol se crea correctamente if (isset($_POST['id'])) { $role = new seguridad_role($_POST['id']); } else { throw new OOB_Exception_400("La variable [id] no esta definida"); } //ARRAY CON LOS MODULOS DEL ROLE $modules_role = false; $modules_role = seguridad_role::listModulesFor($role, false); $modulos = array(); if ($modules = OOB_module::listModules()) { foreach ($modules as $m) { $padre = array(); $padre['leaf'] = false; $padre['id'] = "m_" . $m->name(); $padre['text'] = $m->nicename(); $padre['expanded'] = true; $padre['iconCls'] = 'Clsmodule'; $name = ''; $name = $m->name(); //VEO SI EL MODULO ESTA EN EL ROL if ($modules_role) { if (in_array($name, $modules_role)) { $padre['checked'] = true; } else { $padre['checked'] = false;
if (!isset($handle[2]) || !in_array($handle[2], OOB_module::getViews())) { $handle[2] = "all"; } $ari->t->assign("view", $handle[2]); // set the order if (!isset($handle[3]) || !in_array($handle[3], OOB_module::getOrders())) { $handle[3] = "nicename"; } $ari->t->assign("order", $handle[3]); //selectors data $ari->t->assign("kind_values", OOB_module::getViews()); $ari->t->assign("kind_names", OOB_module::getViews()); //$ari->t->assign("change_values",OOB_module::getViews()); // @todo set the amount so we know the "page", need a page drawer :( // finally get the data if ($modules = OOB_module::listModules($handle[2], true, $handle[3])) { // show time $i = 0; foreach ($modules as $m) { $return[$i]['nicename'] = $m->nicename(); $return[$i]['modulename'] = $m->name(); $return[$i]['description'] = $m->description(); if ($m->isenabled()) { $return[$i]['checked_yes'] = "checked"; $return[$i]['checked_no'] = ""; } else { $return[$i]['checked_yes'] = ""; $return[$i]['checked_no'] = "checked"; } if (!$m->primary()) { $return[$i]['disabled'] = "disabled";
//CAMBIO DE ESTADO DE LOS MODULOS ( HABILITADO O NO) if (isset($_POST['UpdateEnabledData'])) { $change_status = json_decode($_POST['UpdateEnabledData'], true); foreach ($change_status as $chk) { $module = new OOB_module($chk['modulename']); if ($chk['checked'] == "true") { $module->enable(); } else { $module->disable(); } } } $i = 0; $return = array(); //SE OBTIENE EL LISTADO DE MODULOS if ($modules = OOB_module::listModules('all', true, 'nicename')) { foreach ($modules as $m) { $return[$i]['nicename'] = $m->nicename(); $return[$i]['modulename'] = $m->name(); $return[$i]['description'] = $m->description(); $return[$i]['checked'] = $m->isenabled(); $return[$i]['optional'] = $m->optional(); $i++; } } $result = array(); $result["totalCount"] = $i; $result["topics"] = $return; //RESULTADO $obj_comunication = new OOB_ext_comunication(); $obj_comunication->set_data($result);