public static function Render($dataModel, $object, $PageSize = 5, $Titulo = '') { include_once 'PhpExt/Ext.php'; include_once 'PhpExt/Data/SimpleStore.php'; include_once 'PhpExt/Data/ArrayReader.php'; include_once 'PhpExt/Data/JsonReader.php'; include_once 'PhpExt/Data/ScriptTagProxy.php'; include_once 'PhpExt/Data/FieldConfigObject.php'; include_once 'PhpExt/Data/StoreLoadOptions.php'; include_once 'PhpExt/Data/HttpProxy.php'; include_once 'PhpExt/Data/JsonStore.php'; include_once 'PhpExt/Button.php'; include_once 'PhpExt/Toolbar/PagingToolbar.php'; include_once 'PhpExt/Grid/ColumnModel.php'; include_once 'PhpExt/Grid/ColumnConfigObject.php'; include_once 'PhpExt/Grid/GridPanel.php'; include_once 'PhpExt/Window.php'; include_once 'PhpExt/Form/FormPanel.php'; include_once 'PhpExt/Ext.php'; include_once 'PhpExt/Data/Store.php'; include_once 'PhpExt/Data/ArrayReader.php'; include_once 'PhpExt/Data/FieldConfigObject.php'; include_once 'PhpExt/Grid/ColumnModel.php'; include_once 'PhpExt/Grid/ColumnConfigObject.php'; include_once 'PhpExt/Panel.php'; include_once 'PhpExt/Grid/GridPanel.php'; include_once 'PhpExt/Grid/RowSelectionModel.php'; include_once 'PhpExt/Listener.php'; include_once 'PhpExt/Config/ConfigObject.php'; include_once 'PhpExt/Form/FormPanel.php'; include_once 'PhpExt/Form/FieldSet.php'; include_once 'PhpExt/Form/TextField.php'; include_once 'PhpExt/QuickTips.php'; include_once 'PhpExt/Layout/ColumnLayout.php'; include_once 'PhpExt/Layout/ColumnLayoutData.php'; include_once 'PhpExt/Layout/FitLayout.php'; $reader = new PhpExt_Data_JsonReader(); $reader->setRoot("topics")->setTotalProperty("totalCount")->setId("ID"); foreach ($object->properties as $k => $v) { $reader->addField(new PhpExt_Data_FieldConfigObject($k)); } $store = new PhpExt_Data_Store(); $store->setUrl('action_main.php')->setReader($reader)->setBaseParams(array("limit" => $PageSize)); $colModel = new PhpExt_Grid_ColumnModel(); foreach ($object->properties as $k => $v) { if (strpos($k, "S_") !== 0) { $colModel->addColumn(PhpExt_Grid_ColumnConfigObject::createColumn($object->properties_desc[$k], $k, $k, null, null, null, true, true)); } } readfile(dirname(__FILE__) . "/local/Tmpl/PhpExt.tmpl"); $selModel = new PhpExt_Grid_RowSelectionModel(); $selModel->setSingleSelect(true)->attachListener("rowselect", new PhpExt_Listener(PhpExt_Javascript::functionDef(null, "Ext.getCmp(\"idGrid\").getForm().loadRecord(rec);", array("sm", "row", "rec")))); // Grid $grid = new PhpExt_Grid_GridPanel("idGrid"); $grid->setStore($store)->setColumnModel($colModel)->setStripeRows(true)->setWidth(500)->setHeight(350)->setTitle("Elementos"); $grid->setSelectionModel($selModel); $paging = new PhpExt_Toolbar_PagingToolbar(); $paging->setStore($store)->setPageSize($PageSize)->setDisplayInfo("Topics {0} - {1} of {2}")->setEmptyMessage("No topics to display"); $grid->setBottomToolbar($paging); $window = new PhpExt_Window(); $window->setTitle($Titulo)->setWidth(600)->setHeight(450)->setMinWidth(300)->setMinHeight(200)->setPlain(true)->setBodyStyle("padding:5px")->setButtonAlign(PhpExt_Ext::HALIGN_CENTER); $window->addButton(PhpExt_Button::createTextButton("Editar")); $window->addButton(PhpExt_Button::createTextButton("Borrar")); $window->addItem($grid); // Ext.OnReady ----------------------- echo PhpExt_Ext::onReady(null, null, $store->getJavascript(false, "store"), $store->load(new PhpExt_Data_StoreLoadOptions(array("start" => 0, "limit" => $PageSize))), $grid->getJavascript(false, "grid"), $window->getJavascript(false, "window"), $window->show()); echo "</script>"; }
$field_width = 180; //ancho de los controles $grid_id = ''; if (isset($_POST['gid'])) { $grid_id = $_POST['gid']; } //creacion de controles $txt_nombre = PhpExt_Form_TextField::createTextField("txt_nombre", "Nombre")->setMsgTarget(PhpExt_Form_FormPanel::MSG_TARGET_SIDE)->setWidth($field_width); $txt_descripcion = PhpExt_Form_TextArea::createTextArea("txt_descripcion", "Descripción")->setMsgTarget(PhpExt_Form_FormPanel::MSG_TARGET_SIDE)->setWidth($field_width); $chk_anonimo = PhpExt_Form_Checkbox::createCheckbox("chk_anonimo", "Anónimo")->setMsgTarget(PhpExt_Form_FormPanel::MSG_TARGET_SIDE)->setWidth($field_width); $chk_confiados = PhpExt_Form_Checkbox::createCheckbox("chk_confiados", "Confiado")->setMsgTarget(PhpExt_Form_FormPanel::MSG_TARGET_SIDE)->setWidth($field_width); //Boton grabar OnClick $handler_grabar = " \nfunction(){\nthis.findParentByType('form').getForm().submit(\n\t{ \t \n\t\t\t\t\t\t reset : true,\n\t\t\t\t\t waitMsg : 'Enviando Datos',\n\t\t\t\t\t waitTitle : 'Emporika',\t\t\t\t \n\t\t\t grid_reload_id : '{$grid_id}',\n\t\t\t\t new_tab_dir : '/seguridad/role/update',\n\t\t\t\t new_tab_title : 'Modificar Rol',\n new_tab_pass_response_params : { id : 'id'}, \n\t\t\t\t load_tab_here : true\t \n\t}\n\t\n\t);\t\t\t\t\n\t\n}"; $btn_grabar = PhpExt_Button::createTextButton("Grabar", new PhpExt_JavascriptStm($handler_grabar)); //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")); $error_reader->addField(new PhpExt_Data_FieldConfigObject("msg")); //formulario que contiene todos los controles $frm_nuevo_rol = new PhpExt_Form_FormPanel(); $frm_nuevo_rol->setErrorReader($error_reader)->setUrl("/seguridad/role/new_process")->setFrame(true)->setWidth(350)->setAutoHeight(true)->setTitle("Datos del Rol")->setMethod(PhpExt_Form_FormPanel::METHOD_POST); //marco para poner los controles $marco = new PhpExt_Form_FieldSet(); $marco->setDefaults(new PhpExt_Config_ConfigObject(array("width" => 210)))->setAutoHeight(true); //agrego todos los controles al marco $marco->addItem($txt_nombre); $marco->addItem($txt_descripcion); $marco->addItem($chk_anonimo); $marco->addItem($chk_confiados);
include_once 'PhpExt/Ext.php'; include_once 'PhpExt/Data/Store.php'; include_once 'PhpExt/Data/ScriptTagProxy.php'; include_once 'PhpExt/Data/JsonReader.php'; include_once 'PhpExt/Data/FieldConfigObject.php'; include_once 'PhpExt/Data/StoreLoadOptions.php'; include_once 'PhpExt/Config/ConfigObject.php'; include_once 'PhpExt/XTemplate.php'; include_once 'PhpExt/Panel.php'; include_once 'PhpExt/DataView.php'; include_once 'PhpExt/Toolbar/Toolbar.php'; include_once 'PhpExt/Toolbar/PagingToolbar.php'; // User Extension include_once "PhpExtUx/App/SearchField.php"; // Configure Reader and Store $reader = new PhpExt_Data_JsonReader(); $reader->setRoot("topics")->setTotalProperty("totalCount")->setId("post_id"); $reader->addField(new PhpExt_Data_FieldConfigObject("postId", "post_id")); $reader->addField(new PhpExt_Data_FieldConfigObject("title", "topic_title")); $reader->addField(new PhpExt_Data_FieldConfigObject("topicId", "topic_id")); $reader->addField(new PhpExt_Data_FieldConfigObject("author", "author")); $reader->addField(new PhpExt_Data_FieldConfigObject("lastPost", "post_time", "date", "timestamp")); $reader->addField(new PhpExt_Data_FieldConfigObject("excerpt", "post_text")); $ds = new PhpExt_Data_Store(); $ds->setProxy(new PhpExt_Data_ScriptTagProxy('http://extjs.com/forum/topics-remote.php'))->setReader($reader)->setBaseParams(array("limit" => 20, "forumId" => 21)); // ->setBaseParams(new PhpExt_Config_ConfigObject(array("limit"=>20,"forumId"=>21)); // Configure Custom SearchField $resultTpl = new PhpExt_XTemplate('<tpl for=".">', '<div class="search-item">', '<h3><span>{lastPost:date("M j, Y")}<br />by {author}</span>', '<a href="http://extjs.com/forum/showthread.php?t={topicId}&p={postId}" target="_blank">{title}</a></h3>', '<p>{excerpt}</p>', '</div></tpl>'); $panel = new PhpExt_Panel(); $panel->setApplyTo("search-panel")->setTitle("Forum Search")->setHeight(300)->setAutoScroll(true); $dv = new PhpExt_DataView("div.search-item");
$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")); $error_reader->addField(new PhpExt_Data_FieldConfigObject("msg")); $id_grupo = array(); $id_grupo["id"] = $grupo->get("group"); //formulario que contiene todos los controles $frm_update_group = new PhpExt_Form_FormPanel(); $frm_update_group->setErrorReader($error_reader)->setBaseParams($id_grupo)->setFrame(true)->setWidth(520)->setAutoHeight(true)->setTitle("Datos del Grupo")->setMethod(PhpExt_Form_FormPanel::METHOD_POST); //marco para contenener los controles $marco = new PhpExt_Form_FieldSet(); $marco->setAutoHeight(true); //agrego todos los controles al marco $marco->addItem($txt_nombre); $marco->addItem($txt_descripcion);
include_once 'PhpExt/Data/SimpleStore.php'; include_once 'PhpExt/Data/ArrayReader.php'; include_once 'PhpExt/Data/JsonReader.php'; include_once 'PhpExt/Data/ScriptTagProxy.php'; include_once 'PhpExt/Data/FieldConfigObject.php'; include_once 'PhpExt/Data/StoreLoadOptions.php'; include_once 'PhpExt/Data/HttpProxy.php'; include_once 'PhpExt/Data/JsonStore.php'; include_once 'PhpExt/Toolbar/PagingToolbar.php'; include_once 'PhpExt/Grid/ColumnModel.php'; include_once 'PhpExt/Grid/ColumnConfigObject.php'; include_once 'PhpExt/Grid/GridPanel.php'; $PageSize = 10; $changeRenderer = PhpExt_Javascript::functionDef("change", "if(val > 0){\r\n return '<span style=\"color:green;\">' + val + '</span>';\r\n }else if(val < 0){\r\n return '<span style=\"color:red;\">' + val + '</span>';\r\n }\r\n return val;", array("val")); $pctChangeRenderer = PhpExt_Javascript::functionDef("pctChange", "if(val > 0){\r\n return '<span style=\"color:green;\">' + val + '%</span>';\r\n }else if(val < 0){\r\n return '<span style=\"color:red;\">' + val + '%</span>';\r\n }\r\n return val;", array("val")); $reader = new PhpExt_Data_JsonReader(); $reader->setRoot("topics")->setTotalProperty("totalCount")->setId("id"); $reader->addField(new PhpExt_Data_FieldConfigObject("company")); $reader->addField(new PhpExt_Data_FieldConfigObject("price", null, "float")); $reader->addField(new PhpExt_Data_FieldConfigObject("change", null, "float")); $reader->addField(new PhpExt_Data_FieldConfigObject("pctChange", null, "float")); $reader->addField(new PhpExt_Data_FieldConfigObject("lastChange", null, "date", "n/j h:ia")); $reader->addField(new PhpExt_Data_FieldConfigObject("industry")); // Store $store = new PhpExt_Data_Store(); $store->setUrl($baseUrl . '/grid/json_exampledata.php')->setReader($reader)->setBaseParams(array("limit" => $PageSize)); // ColumnModel $colModel = new PhpExt_Grid_ColumnModel(); $colModel->addColumn(PhpExt_Grid_ColumnConfigObject::createColumn("Company", "company", "company", 160, null, null, true, false))->addColumn(PhpExt_Grid_ColumnConfigObject::createColumn("Price", "price", null, 75, null, PhpExt_Javascript::variable("Ext.util.Format.usMoney"), true, true))->addColumn(PhpExt_Grid_ColumnConfigObject::createColumn("Change", "change", null, 75, null, PhpExt_Javascript::variable('change'), null, true))->addColumn(PhpExt_Grid_ColumnConfigObject::createColumn("% Change", "pctChange", null, 75, null, PhpExt_Javascript::variable('pctChange'), null, true))->addColumn(PhpExt_Grid_ColumnConfigObject::createColumn("Last Updated", "lastChange", null, 85, null, PhpExt_Javascript::variable("Ext.util.Format.dateRenderer('m/d/Y')"), null, true))->addColumn(PhpExt_Grid_ColumnConfigObject::createColumn("Industry", "industry", null, 85, null, null, true, true)); // Grid $grid = new PhpExt_Grid_GridPanel();
$opt_group_predeterminada->attachListener("render", new PhpExt_Listener(PhpExt_Javascript::functionDef(null, $group_render, array("group")))); $opt_predeterminada_si->setEnableKeyEvents(true); //MONEDA PREDETERMINADA EN IDIOMA $idiomas_list = array(); if ($idiomas = $ari->get('agent')->getLanguages()) { foreach ($idiomas as $i) { $idiomas_list[] = array($i, $i); } } $select_idioma = new PhpExtUx_Itemselector(); $select_idioma->setName("idiomas")->setFieldLabel("Idioma")->setToLegend("Predeterminado")->setFromLegend("No")->settoData(array())->setfromData(PhpExt_Javascript::variable(json_encode($idiomas_list)))->setvalueField("id")->setdisplayField("name")->setmsHeight(150)->setmsWidth(120)->setdataFields(PhpExt_Javascript::variable('["id", "name"]'))->setimagePath("/scripts/ext/resources/extjs-ux/multiselect/"); //BOTON GRABAR ONCLICK $handler_save = " \nfunction(){\n\nvar form = this.findParentByType('form');\nvar selector = form.findBy(function(c){ return (c.xtype == 'itemselector') });\t\n\nif( selector[0].toStore.getCount() == 0 ){\n\tExt.MessageBox.alert( 'Emporika', 'Debe seleccionar un idioma' ); \n\treturn false;\n}\n\nvar a_params = '';\nvar field = form.getForm().findField('txt_valor');\n\nvar predeterminada = form.findBy(function(c){ return ( c.xtype == 'radiogroup' ) });\nvar opt = predeterminada[1].items.items[0];\t\n\nif( field.disabled ){\n\ta_params = { txt_valor : 1 , tipo : 'float', predeterminada : opt.getValue() }\n}else{\n\ta_params = { tipo : 'fixed', predeterminada : opt.getValue() }\n}\n\nform.getForm().submit(\n\t{ \n\t\t waitMsg : 'Enviando Datos',\n\t\t\treset : true,\n\t\t params : a_params,\n\t\twaitTitle : 'Emporika',\n\t success_msg : 'Moneda guardada correctamente',\n grid_reload_id : '{$grid_id}'\n\t \n\t}\n\t);\t\t\t\t\t\n}\n"; $save_button = PhpExt_Button::createTextButton("Grabar", new PhpExt_JavascriptStm($handler_save)); //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")); $error_reader->addField(new PhpExt_Data_FieldConfigObject("msg")); //FORMULARIO $frm_new_currency = new PhpExt_Form_FormPanel(); $frm_new_currency->setErrorReader($error_reader)->setFrame(true)->setUrl("/currency/currency/new_process")->setWidth(400)->setAutoHeight(true)->setTitle("Datos de la moneda")->setMethod(PhpExt_Form_FormPanel::METHOD_POST); //MARCO PARA CONTENER LOS CONTROLES $marco = new PhpExt_Form_FieldSet(); $marco->setAutoHeight(true); //AGREGO TODOS LOS CONTROLES AL MARCO $marco->addItem($txt_moneda); $marco->addItem($txt_signo); $marco->addItem($opt_group_tipo_cambio); $marco->addItem($txt_valor);
<?php set_include_path(get_include_path() . PATH_SEPARATOR . realpath('../../library')); include_once 'PhpExt/Javascript.php'; PhpExt_Javascript::sendContentType(); include_once 'PhpExt/Ext.php'; include_once 'PhpExt/Data/Store.php'; include_once 'PhpExt/Data/ScriptTagProxy.php'; include_once 'PhpExt/Data/JsonReader.php'; include_once 'PhpExt/Data/FieldConfigObject.php'; include_once 'PhpExt/Config/ConfigObject.php'; include_once 'PhpExt/XTemplate.php'; include_once 'PhpExt/Form/ComboBox.php'; include_once 'PhpExt/Listener.php'; $ds = new PhpExt_Data_Store(); $ds->setProxy(new PhpExt_Data_ScriptTagProxy('http://extjs.com/forum/topics-remote.php')); $reader = new PhpExt_Data_JsonReader(); $reader->setRoot("topics")->setTotalProperty("totalCount")->setId("post_id"); $reader->addField(new PhpExt_Data_FieldConfigObject("postId", "post_id")); $reader->addField(new PhpExt_Data_FieldConfigObject("title", "topic_title")); $reader->addField(new PhpExt_Data_FieldConfigObject("topicId", "topic_id")); $reader->addField(new PhpExt_Data_FieldConfigObject("author", "author")); $reader->addField(new PhpExt_Data_FieldConfigObject("lastPost", "post_time", "date", "timestamp")); $reader->addField(new PhpExt_Data_FieldConfigObject("excerpt", "post_text")); $ds->setReader($reader); $ds->setBaseParams(array("limit" => 20, "forumId" => 21)); $resultTpl = new PhpExt_XTemplate('<tpl for="."><div class="search-item">', '<h3><span>{lastPost:date("M j, Y")}<br />by {author}</span>{title}</h3>', '{excerpt}', '</div></tpl>'); $search = new PhpExt_Form_ComboBox(null, "searchbox"); $search->setStore($ds)->setDisplayField("title")->setTypeAhead(false)->setLoadingText("Searching...")->setWidth(570)->setPageSize(10)->setHideTrigger(true)->setTemplate($resultTpl)->setApplyTo("fsearch")->setItemCssSelector("div.search-item")->attachListener("onSelect", new PhpExt_Listener(PhpExt_Javascript::functionDef(null, "window.location =\r\n String.format('http://extjs.com/forum/showthread.php?t={0}&p={1}', record.data.topicId, record.id)", array("record")))); //------------ Ext.OnReady echo PhpExt_Ext::onReady($ds->getJavascript(false, "ds"), $resultTpl->getJavascript(false, "resultTpl"), $search->getJavascript(false, "search"));
$tree_loader = new PhpExt_Tree_TreeLoader(); $tree_loader->setDataUrl("/seguridad/role/get_modules")->setBaseParams(array("id" => $role->get("role"))); //armo el nodo root (no es visible) $root = new PhpExt_Tree_AsyncTreeNode(); $root->setText("Principal Node")->setDraggable(false)->setId("Principal_Node")->setExpanded(true)->expandChildNodes(true); $check_change = "\n\n\n\nif( n.isLeaf() ){\n\tvar contador = 0;\n\t\tn.bubble(function(c){\n\t\t\tif(c.getUI().checkbox){\n\t\t\t\tif(!c.isLeaf() ){\n\t\t\t\t\tif(n.getUI().checkbox.checked == true ){\n\t\t\t\t\t\tc.getUI().checkbox.checked = true;\n\t\t\t\t\t}\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tc.eachChild(function(nc){\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tif(!nc.isLeaf()){\n\t\t\t\t\t\t\t\t\tnc.eachChild(function(ncc){\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\tif( ncc.getUI().checkbox.checked == true ){\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\tcontador++;\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t});\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t}\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\tif(contador == 0){\n\t\t\t\t\t\t\t\t\t\tc.getUI().checkbox.checked = false;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t\n\n}\n\nif(!n.isLeaf()){\n\tn.eachChild(function(nc){\n\tif( n.getUI().checkbox.checked == false ){\n\t\tif(!nc.isLeaf()){\n\t\t\tnc.eachChild(function(ncc){\t\t\t\t\n\t\t\t\tncc.getUI().checkbox.checked = false;\n\t\t\t});\n\t\t}\n\t}\t\n\t});\n\t\n}\n\nvar cambios = new Array();\nvar entro = true;\nvar cont = this.findParentByType('form').getForm().findField('modulos');\n\n\nif(cont.getValue()!=''){\nvar cambios = cont.getValue().split(',');\n\nfor( i = 0; i < cambios.length; i++ ){\n\tif(n.id==cambios[i]){\n\t\t\tcambios[i+1] = c;\n\t\t\tentro = false;\n\t\t\t}\n\t\t\t}\n}\n\t\t\nif(entro){\n\tcambios.push(n.id);\n\tcambios.push(c);\n}\nif( cambios.length >1 ){\n\tcont.setValue(cambios.join(','));\n}\n\n\t\t "; $tree_modulos = new PhpExt_Tree_TreePanel(); $tree_modulos->setAnimate(true)->setHeight(250)->setWidth(530)->setRootVisible(false)->setEnableDd(false)->setRoot($root)->setContainerScroll(true)->setAutoScroll(true)->setLoader($tree_loader); $tree_modulos->attachListener("checkchange", new PhpExt_Listener(PhpExt_Javascript::functionDef(null, $check_change, array("n,c")))); $tab_modulos->addItem($tree_modulos); $tab_panel->addItem($tab_modulos); //Boton actualizar OnClick $handler_actualizar = "function(){\n\nthis.findParentByType('form').getForm().submit(\n\t{ \n\t\t\twaitMsg : 'Enviando Datos',\n\t\t waitTitle : 'Emporika',\n\t \tsuccess_msg : 'Rol guardado correctamente',\n\tgrid_reload_id : '{$grid_id}',\n\t\t success : function(){\t\t\t\t\n\t\t\t\tExt.getCmp('treePanel').getRootNode().reload();\t\t\t\t\n\t\t }\n\t}\n\t);\t\n\n\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")); $error_reader->addField(new PhpExt_Data_FieldConfigObject("msg")); $modulos = PhpExt_Form_Hidden::createHidden("modulos"); $id_role = array(); $id_role["id"] = $role->get("role"); //formulario que contiene todos los controles $frm_update_role = new PhpExt_Form_FormPanel(); $frm_update_role->setErrorReader($error_reader)->setBaseParams($id_role)->setUrl("/seguridad/role/update_process")->setFrame(true)->setWidth(580)->setHeight(400)->setTitle("Datos del rol")->setMethod(PhpExt_Form_FormPanel::METHOD_POST); $form_render = "\n\tvar chk = form.findBy( function(c){ return ( c.name == 'chk_anonimo' ); } );\t\t\t\n\tvar panel_usuarios = form.findBy( function(c){ return (c.xtype == 'panel' && c.title == 'Usuarios' ) } );\t\t\t\n\tvar panel_grupos = form.findBy( function(c){ return (c.xtype == 'panel' && c.title == 'Grupos' ) } );\t\t\t\n\n\tvar groups = form.findBy( function(c){ return ( c.name == 'grupos' ) } );\t\t\t\n\tvar users = form.findBy( function(c){ return ( c.name == 'usuarios' ) } );\t\t\t\n\t\n\tchk[0].on( 'check', function(t,c){\n\t\n\t\n\n\tif( ( groups[0].toStore.getCount() != 0 ) || ( users[0].toStore.getCount() != 0 ) ){\t\n\t\tt.setValue(false);\n\t\tpanel_usuarios[0].setDisabled(false);\n\t\tpanel_grupos[0].setDisabled(false);\n\t}\n\telse\n\t{\n\t\tpanel_usuarios[0].setDisabled(c);\n\t\tpanel_grupos[0].setDisabled(c);\n\t}\t\n});\n\n"; $frm_update_role->setEnableKeyEvents(true); $frm_update_role->attachListener("render", new PhpExt_Listener(PhpExt_Javascript::functionDef(null, $form_render, array("form")))); //marco para contenener los controles $marco = new PhpExt_Form_FieldSet();