#OOB/N1 Framework [2008 - Nutus] - PM // Código por JPCOSEANI // SCRIPT QUE GENERA EL FORM LISTADO DE MODULOS if (!seguridad::isAllowed(seguridad_action::nameConstructor('update', 'user', 'seguridad'))) { throw new OOB_exception("Acceso Denegado", "403", "Acceso Denegado. Consulte con su Administrador!", true); } PhpExt_Javascript::sendContentType(); global $ari; $ari->popup = 1; // no mostrar el main_frame //STORE PARA TRAER EL LISTADO DE MODULOS $store = new PhpExt_Data_JsonStore(); $store->setUrl("/admin/module/get_modules")->setRoot("topics")->setAutoLoad(true)->setTotalProperty("totalCount"); //AGREGO LOS CAMPOS AL STORE $store->addField(new PhpExt_Data_FieldConfigObject("nicename")); $store->addField(new PhpExt_Data_FieldConfigObject("modulename")); $store->addField(new PhpExt_Data_FieldConfigObject("description")); $store->addField(new PhpExt_Data_FieldConfigObject("checked")); $store->addField(new PhpExt_Data_FieldConfigObject("optional")); //CHECKBOX PARA SELECCIONAR LOS MODULOS $checkColumn = new PhpExtUx_Grid_CheckColumn("Habilitado"); $checkColumn->setDataIndex("checked")->setId("check")->setWidth(55); //AGREGO LAS COLUMNAS A LA GRILLA $col_model = new PhpExt_Grid_ColumnModel(); $col_model->addColumn(PhpExt_Grid_ColumnConfigObject::createColumn("Nombre del Módulo", "nicename", null, 150)); $col_model->addColumn(PhpExt_Grid_ColumnConfigObject::createColumn("Descripción", "description", null, 340)); $col_model->addColumn($checkColumn); //GRILLA $grid = new PhpExt_Grid_GridPanel(); $grid->setStore($store)->setColumnModel($col_model)->setLoadMask(true)->setenableColLock(false);
// CODIGO POR JPCOSEANI // Script que genera el FORM LISTADO DE PERMISOS if (!seguridad::isAllowed(seguridad_action::nameConstructor('list', 'impuesto', 'impuestos'))) { throw new OOB_exception("Acceso Denegado", "403", "Acceso Denegado. Consulte con su Administrador!", true); } //LIBRERIAS PhpExt_Javascript::sendContentType(); global $ari; $ari->popup = 1; // no mostrar el main_frame $page_size = PAGE_SIZE; //STORE PARA TRAER LOS DATOS $store = new PhpExt_Data_JsonStore(); $store->setUrl("/seguridad/permission/get_permissions")->setRoot("topics")->setTotalProperty("totalCount"); //DEFINICION DE LOS CAMPOS DEL STORE $store->addField(new PhpExt_Data_FieldConfigObject("id")); $store->addField(new PhpExt_Data_FieldConfigObject("nombre")); $store->addField(new PhpExt_Data_FieldConfigObject("descripcion")); $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();
$tab_roles = new PhpExt_Panel(); $tab_roles->setTitle("Roles")->setLayout(new PhpExt_Layout_FormLayout()); //control para seleccionar los usuarios $select_roles = new PhpExtUx_Itemselector(); $select_roles->setName("roles")->setId("roles")->setFieldLabel("Roles")->setToLegend("Miembros")->setFromLegend("No Miembros")->setvalueField("id")->setdisplayField("name")->setmsHeight(160)->setmsWidth($field_width)->setToStore($roles_to_store)->setFromStore($roles_from_store)->setdataFields(PhpExt_Javascript::variable('["id", "name"]'))->setimagePath("/scripts/ext/resources/extjs-ux/multiselect/"); $tab_roles->addItem($select_roles); $tab_panel->addItem($tab_roles); $tab_modulos = new PhpExt_Panel(); $tab_modulos->setTitle("Modulos")->setLayout(new PhpExt_Layout_FormLayout()); $modulos_from_store = new PhpExt_Data_JsonStore(); $modulos_from_store->setUrl("/admin/perspective/get_modules_nomembers")->setRoot("topics")->setAutoLoad("true")->setBaseParams(array("id" => $name))->setTotalProperty("totalCount"); $modulos_from_store->addField(new PhpExt_Data_FieldConfigObject("id", "id")); $modulos_from_store->addField(new PhpExt_Data_FieldConfigObject("name", "name")); $modulos_to_store = new PhpExt_Data_JsonStore(); $modulos_to_store->setUrl("/admin/perspective/get_modules_members")->setRoot("topics")->setAutoLoad("true")->setBaseParams(array("id" => $name))->setTotalProperty("totalCount"); $modulos_to_store->addField(new PhpExt_Data_FieldConfigObject("id", "id")); $modulos_to_store->addField(new PhpExt_Data_FieldConfigObject("name", "name")); //control para seleccionar los grupos $select_modulos = new PhpExtUx_Itemselector(); $select_modulos->setName("modulos")->setId("modulos")->setFieldLabel("Modulos")->setToLegend("Miembros")->setFromLegend("No Miembros")->setvalueField("id")->setdisplayField("name")->setmsHeight(160)->setmsWidth($field_width)->setToStore($modulos_to_store)->setFromStore($modulos_from_store)->setdataFields(PhpExt_Javascript::variable('["id", "name"]'))->setimagePath("/scripts/ext/resources/extjs-ux/multiselect/"); $tab_modulos->addItem($select_modulos); $tab_panel->addItem($tab_modulos); //Boton actualizar OnClick $handler_actualizar = "function(){\nExt.getCmp('frm_update_perspective').getForm().submit(\n\t{ \n\t url:'/admin/perspective/update_process',\n\t waitMsg:'Enviando Datos',\n\t waitTitle:'Emporika'\n\t}\n\t);\t\t\t\t\n\t\t\t\t\t\t\t }"; $btn_actualizar = PhpExt_Button::createTextButton("Actualizar", new PhpExt_JavascriptStm($handler_actualizar)); $id_perspective = array(); $id_perspective["name"] = $name; //formulario que contiene todos los controles $frm_update_perspective = new PhpExt_Form_FormPanel(); $frm_update_perspective->setId("frm_update_perspective")->setBaseParams($id_perspective)->setFrame(true)->setWidth(530)->setAutoHeight(true)->setTitle("Datos de la Perpectiva")->setMethod(PhpExt_Form_FormPanel::METHOD_POST); $frm_update_perspective->addItem($tab_panel);
if (isset($_POST['gid'])) { $grid_id = $_POST['gid']; } $page_size = PAGE_SIZE; //controles //nombre del grupo $txt_nombre = PhpExt_Form_TextField::createTextField("txt_nombre", "Nombre")->setWidth($field_width)->setMsgTarget(PhpExt_Form_FormPanel::MSG_TARGET_SIDE)->setValue($grupo->get("name")); //descripcion del grupo $txt_descripcion = PhpExt_Form_TextArea::createTextArea("txt_descripcion", "Descripción")->setMsgTarget(PhpExt_Form_FormPanel::MSG_TARGET_SIDE)->setWidth($field_width)->setValue($grupo->get("description")); $from_store = new PhpExt_Data_JsonStore(); $from_store->setUrl("/seguridad/group/get_nomembers")->setRoot("topics")->setBaseParams(array("id" => $grupo->get("group")))->setTotalProperty("totalCount"); $from_store->addField(new PhpExt_Data_FieldConfigObject("id", "id")); $from_store->addField(new PhpExt_Data_FieldConfigObject("uname", "uname")); $to_store = new PhpExt_Data_JsonStore(); $to_store->setUrl("/seguridad/group/get_members")->setRoot("topics")->setAutoLoad("true")->setBaseParams(array("id" => $grupo->get("group")))->setTotalProperty("totalCount"); $to_store->addField(new PhpExt_Data_FieldConfigObject("id", "id")); $to_store->addField(new PhpExt_Data_FieldConfigObject("uname", "uname")); //TXT DE BUSQUEDA DE USUARIOS $txt_buscar_usuario = new PhpExtUx_App_SearchField(); $txt_buscar_usuario->setFieldLabel("Buscar")->setStore($from_store); //control para seleccionar los usuarios $select = new PhpExtUx_Itemselector(); $select->setName("usuarios")->setFieldLabel("Usuarios")->setToLegend("Miembros")->setFromLegend("No Miembros")->setvalueField("id")->setdisplayField("uname")->setmsHeight(160)->setmsWidth($field_width)->setToStore($to_store)->setFromStore($from_store)->setdataFields(PhpExt_Javascript::variable('["id", "uname"]'))->setimagePath("/scripts/ext/resources/extjs-ux/multiselect/"); //Boton actualizar OnClick $handler_actualizar = "function(){\nthis.findParentByType('form').getForm().submit(\n\t{ \n\t\t\t url : '/seguridad/group/update_process',\n\t\t waitMsg : 'Enviando Datos',\n \t\t waitTitle :'Emporika',\n \t\tsuccess_msg : 'Grupo guardado correctamente',\n\tgrid_reload_id : '{$grid_id}' \n\t}\n\t);\t\t\t\t\n\t\t\t\t\t\t\t }"; $btn_actualizar = PhpExt_Button::createTextButton("Actualizar", new PhpExt_JavascriptStm($handler_actualizar)); //Data_Reader para leer los resultados devueltos $error_reader = new PhpExt_Data_JsonReader(); $error_reader->setRoot("errors"); $error_reader->setSuccessProperty("success"); $error_reader->addField(new PhpExt_Data_FieldConfigObject("id"));
include_once 'PhpExt/Data/SortInfoConfigObject.php'; include_once 'PhpExt/Data/SimpleStore.php'; include_once 'PhpExt/Form/Radio.php'; include_once 'PhpExt/Form/TextField.php'; include_once 'PhpExt/Grid/RowSelectionModel.php'; include_once 'PhpExt/Form/DateField.php'; include_once 'PhpExt/Form/NumberField.php'; include_once 'PhpExtUx/App/FitToParent.php'; global $ari; $ari->popup = 1; // no mostrar el main_frame $separador_decimal = trim($ari->locale->get('decimal', 'numbers')); $store = new PhpExt_Data_JsonStore(); $store->setUrl("/currency/currency/get_currencys_change")->setRoot("topics")->setTotalProperty("totalCount"); //AGREGO LOS CAMPOS AL STORE $store->addField(new PhpExt_Data_FieldConfigObject("id")); $store->addField(new PhpExt_Data_FieldConfigObject("currency")); $store->addField(new PhpExt_Data_FieldConfigObject("value")); $store->addField(new PhpExt_Data_FieldConfigObject("date")); $store->addField(new PhpExt_Data_FieldConfigObject("new")); $txt_nuevo_valor = new PhpExt_Form_NumberField(); $txt_nuevo_valor->setDecimalSeparator($separador_decimal)->setMsgTarget(PhpExt_Form_FormPanel::MSG_TARGET_SIDE); //AGREGO LAS COLUMNAS A LA GRILLA $col_model = new PhpExt_Grid_ColumnModel(); $col_model->addColumn(PhpExt_Grid_ColumnConfigObject::createColumn("Id", "id", null, 35)); $col_model->addColumn(PhpExt_Grid_ColumnConfigObject::createColumn("Moneda", "currency")); $col_model->addColumn(PhpExt_Grid_ColumnConfigObject::createColumn("Ultimo Valor", "value")); $col_model->addColumn(PhpExt_Grid_ColumnConfigObject::createColumn("Fecha", "date", null, 110)); $col_model->addColumn(PhpExt_Grid_ColumnConfigObject::createColumn("Nuevo Valor", "new")->setEditor($txt_nuevo_valor)); $paging = new PhpExt_Toolbar_PagingToolbar(); $paging->setStore($store)->setDisplayInfo(true)->setEmptyMessage("No tiene monedas flotantes para definir el tipo de cambio");
#OOB/N1 Framework [2008 - Nutus] - PM // Código por JPCOSEANI // Script que genera el FORM Listado de Usuarios if (!seguridad::isAllowed(seguridad_action::nameConstructor('update', 'user', 'seguridad'))) { throw new OOB_exception("Acceso Denegado", "403", "Acceso Denegado. Consulte con su Administrador!", true); } PhpExt_Javascript::sendContentType(); global $ari; $ari->popup = 1; // no mostrar el main_frame $page_size = PAGE_SIZE; //STORE PARA TRAER EL LISTADO DE USUARIOS $store = new PhpExt_Data_JsonStore(); $store->setUrl("/seguridad/user/get_users")->setRoot("topics")->setId("id")->setTotalProperty("totalCount"); //AGREGO LOS CAMPOS AL STORE $store->addField(new PhpExt_Data_FieldConfigObject("id")); $store->addField(new PhpExt_Data_FieldConfigObject("uname")); $store->addField(new PhpExt_Data_FieldConfigObject("email")); $store->addField(new PhpExt_Data_FieldConfigObject("status")); $check_select = new PhpExt_Grid_CheckboxSelectionModel(); //Paso los estado a json $estados = array(); foreach (oob_user::getStatus() as $id => $descripcion) { $estados[] = array($id, $descripcion); } $filter_plugin = new PhpExtUx_Grid_GridFilters(); $filter_plugin->addFilter(PhpExt_Grid_FilterConfigObject::createFilter("numeric", "id")); $filter_plugin->addFilter(PhpExt_Grid_FilterConfigObject::createFilter("string", "uname")); $filter_plugin->addFilter(PhpExt_Grid_FilterConfigObject::createFilter("string", "email")); $filter_plugin->addFilter(PhpExt_Grid_FilterConfigObject::createFilter("list", "status", PhpExt_Javascript::variable(json_encode($estados)), PhpExt_Javascript::variable("1"), true)); $col_model = new PhpExt_Grid_ColumnModel();
// LIBRERIAS include_once 'PhpExt/Javascript.php'; PhpExt_Javascript::sendContentType(); include_once 'PhpExt/Grid/ColumnConfigObject.php'; include_once 'PhpExt/Grid/GridPanel.php'; include_once 'PhpExt/Data/JsonStore.php'; include_once 'PhpExt/Data/FieldConfigObject.php'; include_once 'PhpExtUx/App/FitToParent.php'; global $ari; $ari->popup = 1; // no mostrar el main_frame //STORE PARA TRAER LA LISTA DE PERSPECTIVAS $store = new PhpExt_Data_JsonStore(); $store->setUrl("/admin/perspective/get_prespectives")->setRoot("topics")->setTotalProperty("totalCount")->setId("id")->setAutoLoad(true); //CAMPOS DEL STORE $store->addField(new PhpExt_Data_FieldConfigObject("name")); $store->addField(new PhpExt_Data_FieldConfigObject("path")); //SE AGREGAN LAS COLUMNAS A LA GRILLA $col_model = new PhpExt_Grid_ColumnModel(); $col_model->addColumn(PhpExt_Grid_ColumnConfigObject::createColumn("Nombre", "name", null, 80))->addColumn(PhpExt_Grid_ColumnConfigObject::createColumn("Ruta", "path", null, 250)); //GRILLA $grid = new PhpExt_Grid_GridPanel(); $grid->setColumnModel($col_model)->setStore($store)->setStripeRows(true)->setLoadMask(true); $grid->getPlugins()->add(new PhpExtUx_App_FitToParent()); $grid_render = "\n\nvar edit = function(){\n\nvar m = grid.getSelections();\n\nif(m.length ==1 ){\n\tvar id = 'id=' + m[0].get('name');\n\taddTab( 'Modificar Perpectiva', '/admin/perspective/update', true, id );\n}else{\n\tExt.MessageBox.alert('Emporika', 'Por favor seleccione \"un\" item');\n}\n\n}\n\nvar button1 = grid.getTopToolbar().items.find( function(c){ return ( c.text == 'Modificar') } );\nbutton1.on( 'click', edit );\n\n\ngrid.on( 'celldblclick', edit );\n\n"; $grid->setEnableKeyEvents(true); $grid->attachListener("render", new PhpExt_Listener(PhpExt_Javascript::functionDef(null, $grid_render, array("grid")))); //AGREGO EL BOTON MODIFICAR EN LA GRILLA $tb = $grid->getTopToolbar(); $tb->addButton("modificar", "Modificar", "images/edit.gif"); //RESULTADO
include_once 'PhpExt/Grid/GridPanel.php'; include_once 'PhpExt/Toolbar/PagingToolbar.php'; include_once 'PhpExt/Data/StoreLoadOptions.php'; include_once 'PhpExt/Data/JsonStore.php'; include_once 'PhpExt/Layout/AbsoluteLayout.php'; include_once 'PhpExt/Grid/CheckboxSelectionModel.php'; include_once 'PhpExtUx/Grid/GridFilters.php'; include_once 'PhpExtUx/Grid/FilterConfigObject.php'; include_once 'PhpExtUx/App/FitToParent.php'; global $ari; $ari->popup = 1; // no mostrar el main_frame $page_size = PAGE_SIZE; $store = new PhpExt_Data_JsonStore(); $store->setUrl("/seguridad/group/get_groups")->setRoot("topics")->setTotalProperty("totalCount")->setId("id"); $store->addField(new PhpExt_Data_FieldConfigObject("id")); $store->addField(new PhpExt_Data_FieldConfigObject("name")); $store->addField(new PhpExt_Data_FieldConfigObject("description")); $check_select = new PhpExt_Grid_CheckboxSelectionModel(); $filter_plugin = new PhpExtUx_Grid_GridFilters(); $filter_plugin->addFilter(PhpExt_Grid_FilterConfigObject::createFilter("numeric", "id")); $filter_plugin->addFilter(PhpExt_Grid_FilterConfigObject::createFilter("string", "name")); $filter_plugin->addFilter(PhpExt_Grid_FilterConfigObject::createFilter("string", "description")); $col_model = new PhpExt_Grid_ColumnModel(); $col_model->addColumn($check_select)->addColumn(PhpExt_Grid_ColumnConfigObject::createColumn("Id", "id", null, 30))->addColumn(PhpExt_Grid_ColumnConfigObject::createColumn("Nombre", "name", null, 120))->addColumn(PhpExt_Grid_ColumnConfigObject::createColumn("Descripción", "description", null, 180)); $paging = new PhpExt_Toolbar_PagingToolbar(); $paging->setStore($store)->setPageSize($page_size)->setDisplayInfo(true)->setEmptyMessage("No se encontraron grupos"); $paging->getPlugins()->add($filter_plugin); $grid = new PhpExt_Grid_GridPanel(); $grid->setColumnModel($col_model)->setStore($store)->setStripeRows(true)->setSelectionModel($check_select)->setLoadMask(true); $grid->getPlugins()->add($filter_plugin);
include_once 'PhpExt/Data/SortInfoConfigObject.php'; include_once 'PhpExt/Form/ComboBox.php'; include_once 'PhpExt/Button.php'; include_once 'PhpExt/Data/SimpleStore.php'; include_once 'PhpExt/Form/Radio.php'; include_once 'PhpExt/Grid/RowSelectionModel.php'; include_once 'PhpExtUx/App/FitToParent.php'; global $ari; $ari->popup = 1; // no mostrar el main_frame $page_size = PAGE_SIZE; //STORE PARA TRAER LOS DATOS DEL LISTADO $store = new PhpExt_Data_JsonStore(); $store->setUrl("/currency/currency/get_currencys")->setRoot("topics")->setTotalProperty("totalCount"); //AGREGO LOS CAMPOAS AL LISTADO $store->addField(new PhpExt_Data_FieldConfigObject("id")); $store->addField(new PhpExt_Data_FieldConfigObject("name")); $store->addField(new PhpExt_Data_FieldConfigObject("default")); $store->addField(new PhpExt_Data_FieldConfigObject("type")); $store->addField(new PhpExt_Data_FieldConfigObject("cotizacion")); $types = array(); $types[] = array(1, "Fijo"); $types[] = array(2, "Flotante"); $filter_plugin = new PhpExtUx_Grid_GridFilters(); $filter_plugin->addFilter(PhpExt_Grid_FilterConfigObject::createFilter("numeric", "id")); $filter_plugin->addFilter(PhpExt_Grid_FilterConfigObject::createFilter("string", "name")); $filter_plugin->addFilter(PhpExt_Grid_FilterConfigObject::createFilter("boolean", "default")); $filter_plugin->addFilter(PhpExt_Grid_FilterConfigObject::createFilter("list", "type", PhpExt_Javascript::variable(json_encode($types)))); $filter_plugin->addFilter(PhpExt_Grid_FilterConfigObject::createFilter("numeric", "cotizacion")); //SE CREA EL PAGINADOR $paging = new PhpExt_Toolbar_PagingToolbar();