$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); $frm_update_perspective->addButton($btn_actualizar); $frm_update_perspective->addButton(PhpExt_Button::createTextButton("Cancelar")); $resultado = ''; $resultado .= $roles_to_store->getJavascript(false, "roles_tostore"); $resultado .= $roles_from_store->getJavascript(false, "roles_fromstore");
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"); $dv->setStore($ds)->setTemplate($resultTpl); $panel->addItem($dv); $searchField = new PhpExtUx_App_SearchField(); $searchField->setStore($ds)->setWidth(320); $tb = $panel->getTopToolbar(); $tb->addTextItem(1, "Search: "); $tb->addSpacer(2); $tb->addItem(3, $searchField); $paging = new PhpExt_Toolbar_PagingToolbar(); $paging->setStore($ds)->setPageSize(20)->setDisplayInfo("Topics {0} - {1} of {2}")->setEmptyMessage("No topics to display"); $panel->setBottomToolbar($paging); //------------ Ext.OnReady echo PhpExt_Ext::onReady($ds->getJavascript(false, "ds"), $resultTpl->getJavascript(false, "resultTpl"), $panel->getJavascript(false, "panel"), $ds->load(new PhpExt_Data_StoreLoadOptions(array("start" => 0, "limit" => 0, "forumId" => 21, "query" => "\"PHP-Ext 0.\""))));
->setHeight(600); $accordion = new PhpExt_Layout_AccordionLayout(); $accordion->setTitleCollapse(true) ->setActiveOnTop(true) ->setAnimate(true) ; $accordionPanel->setLayout($accordion); $p1 = new PhpExt_Panel(); $p1->setTitle("Navigation") ->setHtml("This <bt>is the navigation panel"); $p2 = new PhpExt_Panel(); $p2->setTitle("Settings") ->setHtml("This <br>is the settings panel"); $accordionPanel->addItem($p1); $accordionPanel->addItem($p2); $accordionPanel->setRenderTo(PhpExt_Javascript::inlineStm("Ext.get('centercolumn')")); */ $accordionPanel = new PhpExt_Panel(); $accordionPanel->setTitle("Accordion Sample")->setWidth(500)->setHeight(300); $accordion = new PhpExt_Layout_AccordionLayout(); $accordion->setTitleCollapse(true)->setAnimate(true); $accordionPanel->setLayout($accordion); $p1 = new PhpExt_Panel(); $p1->setTitle("Navigation")->setHtml("This <bt>is the navigation panel"); $p2 = new PhpExt_Panel(); $p2->setTitle("Settings")->setHtml("This <br>is the settings panel"); $accordionPanel->addItem($p1); $accordionPanel->addItem($p2); $accordionPanel->setRenderTo(PhpExt_Javascript::inlineStm("Ext.get('centercolumn')")); echo PhpExt_Ext::onReady($accordionPanel->getJavascript(false, "accordionPanel"));
$store->setData($myData) */ $italicRenderer = PhpExt_Javascript::functionDef("italic", "return '<i>' + value + '</i>'", array("value")); $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")); // 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"), null, 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, 75, null, PhpExt_Javascript::variable("Ext.util.Format.dateRenderer('m/d/Y')"), null, true)); // Form Panel $gridForm = new PhpExt_Form_FormPanel("company-form"); $gridForm->setFrame(true)->setLabelAlign(PhpExt_Form_FormPanel::LABEL_ALIGN_LEFT)->setTitle("Company Data")->setBodyStyle("padding: 5px;")->setWidth(750)->setLayout(new PhpExt_Layout_ColumnLayout()); // Setup Grid $leftPanel = new PhpExt_Panel(); $leftPanel->setLayout(new PhpExt_Layout_FitLayout()); $selModel = new PhpExt_Grid_RowSelectionModel(); $selModel->setSingleSelect(true)->attachListener("rowselect", new PhpExt_Listener(PhpExt_Javascript::functionDef(null, "Ext.getCmp(\"company-form\").getForm().loadRecord(rec);", array("sm", "row", "rec")))); $grid = new PhpExt_Grid_GridPanel(); $grid->setStore($store)->setColumnModel($colModel)->setSelectionModel($selModel)->setAutoExpandColumn("company")->setHeight(350)->setTitle("Company Data")->setBorder(true)->attachListener("render", new PhpExt_Listener(PhpExt_Javascript::functionDef(null, "g.getSelectionModel().selectRow(0);", array("g")), null, 10)); $leftPanel->addItem($grid); $gridForm->addItem($leftPanel, new PhpExt_Layout_ColumnLayoutData(0.6)); // Setup Fields $rightPanel = new PhpExt_Form_FieldSet(); $rightPanel->setLabelWidth(90)->setTitle("Company Details")->setDefaults(new PhpExt_Config_ConfigObject(array("width" => 140)))->setDefaultType("textfield")->setAutoHeight(true)->setBodyStyle(PhpExt_Javascript::inlineStm("Ext.isIE ? 'padding:0 0 5px 15px;' : 'padding:10px 15px;'"))->setBorder(false)->setCssStyle(new PhpExt_Config_ConfigObject(array("margin-left" => "10px", "margin-right" => PhpExt_Javascript::inlineStm('Ext.isIE6 ? (Ext.isStrict ? "-10px" : "-13px") : "0"')))); $rightPanel->addItem(PhpExt_Form_TextField::createTextField("company", "Name")); $rightPanel->addItem(PhpExt_Form_TextField::createTextField("price", "Price")); $rightPanel->addItem(PhpExt_Form_TextField::createTextField("pctChange", "% Change")); $rightPanel->addItem(PhpExt_Form_TextField::createTextField("lastChange", "Last Updated")); $gridForm->addItem($rightPanel, new PhpExt_Layout_ColumnLayoutData(0.4)); $gridForm->setRenderTo(PhpExt_Javascript::variable("Ext.get('centercolumn')")); //****************************** onReady echo PhpExt_Ext::onReady(PhpExt_Javascript::stm(PhpExt_QuickTips::init()), PhpExt_Javascript::assign("data", PhpExt_Javascript::valueToJavascript($myData)), $store->getJavascript(false, "ds"), $italicRenderer, $changeRenderer, $pctChangeRenderer, $colModel->getJavascript(false, "colModel"), $gridForm->getJavascript(false, "gridForm"));
$tabs->addItem($tabPanel); $tabs->addButton(PhpExt_Button::createTextButton("Save")); $tabs->addButton(PhpExt_Button::createTextButton("Cancel")); //******************************* Form Tabs 2 $tabs2 = new PhpExt_Form_FormPanel(); $tabs2->setLabelAlign(PhpExt_Form_FormPanel::LABEL_ALIGN_TOP)->setTitle("Inner Tabs")->setBodyStyle("padding:5px")->setWidth(600); $columnPanel2 = new PhpExt_Panel(); // using ColumnLayout $columnPanel2->setBorder(false)->setLayout(new PhpExt_Layout_ColumnLayout()); $tabs2->addItem($columnPanel2); //- First column $firstColumn2 = new PhpExt_Panel(); // Use FormLayout to enable field labels and autoarrange fields on the panel $firstColumn2->setBorder(false)->setLayout(new PhpExt_Layout_FormLayout()); // Anchor the field to 95% of the panel by setting AnchorLayoutData (FormLayout extends AnchorLayout) $firstColumn2->addItem(PhpExt_Form_TextField::createTextField("first", "First Name"), new PhpExt_Layout_AnchorLayoutData("95%"))->addItem(PhpExt_Form_TextField::createTextField("company", "Company"), new PhpExt_Layout_AnchorLayoutData("95%")); // adds the panel as a 50% column using ColumnLayoutData $columnPanel2->addItem($firstColumn2, new PhpExt_Layout_ColumnLayoutData(0.5)); //- Second column $secondColumn2 = new PhpExt_Panel(); $secondColumn2->setBorder(false)->setLayout(new PhpExt_Layout_FormLayout())->addItem(PhpExt_Form_TextField::createTextField("last", "Last Name"), new PhpExt_Layout_AnchorLayoutData("95%"))->addItem(PhpExt_Form_TextField::createTextField("email", "Email")->setVType(PhpExt_Form_FormPanel::VTYPE_EMAIL), new PhpExt_Layout_AnchorLayoutData("95%")); $columnPanel2->addItem($secondColumn2, new PhpExt_Layout_ColumnLayoutData(0.5)); //- Tab Panel $tabPanel2 = new PhpExt_TabPanel(); $tabPanel2->setPlain(true)->setActiveTab(0)->setHeight(235)->setDefaults(new PhpExt_Config_ConfigObject(array("bodyStyle" => "padding:10px"))); $detailsTab2 = new PhpExt_Panel(); $detailsTab2->setTitle("Personal Details")->setLayout(new PhpExt_Layout_FormLayout())->setDefaults(new PhpExt_Config_ConfigObject(array("width" => 230)))->setDefaultType("textfield")->addItem(PhpExt_Form_TextField::createTextField("first", "First Name")->setAllowBlank(false)->setValue("Jack"))->addItem(PhpExt_Form_TextField::createTextField("company", "Company")->setValue("Slocum"))->addItem(PhpExt_Form_TextField::createTextField("last", "Last Name")->setValue("Ext JS"))->addItem(PhpExt_Form_TextField::createTextField("email", "Email")->setVType(PhpExt_Form_FormPanel::VTYPE_EMAIL)); $phonesTab2 = new PhpExt_Panel(); $phonesTab2->setTitle("Phone Numbers")->setLayout(new PhpExt_Layout_FormLayout())->setDefaults(new PhpExt_Config_ConfigObject(array("width" => 230)))->setDefaultType("textfield")->addItem(PhpExt_Form_TextField::createTextField("home", "Home")->setValue("(888) 555-1212"))->addItem(PhpExt_Form_TextField::createTextField("business", "Business"))->addItem(PhpExt_Form_TextField::createTextField("mobile", "Mobile"))->addItem(PhpExt_Form_TextField::createTextField("fax", "Fax")); $bioTab = new PhpExt_Panel(); $bioTab->setCssClass("x-plain")->setTitle("Biography")->setLayout(new PhpExt_Layout_FitLayout())->addItem(PhpExt_Form_HtmlEditor::createHtmlEditor("bio2", "Biography", "bio2"));
include_once 'PhpExt/Layout/TabLayoutData.php'; include_once 'PhpExt/Grid/PropertyGrid.php'; /* * The container component for the border layout can also be a PhpExt_Viewport which will * fill the space provided by the browser. In these example a Panel is used to keep the website layout. * See API Documentation for more info on Viewport. * */ $viewport = new PhpExt_Panel(); $viewport->setHeight(600); $viewport->setLayout(new PhpExt_Layout_BorderLayout()); // Norht Region $north = new PhpExt_BoxComponent(); $north->setEl("north"); $north->setHeight(32); $viewport->addItem($north, PhpExt_Layout_BorderLayoutData::createNorthRegion()); // South Region $south = new PhpExt_Panel(); $south->setContentElement("south")->setCollapsible(true)->setTitle("South")->setHeight(100); $viewport->addItem($south, PhpExt_Layout_BorderLayoutData::createSouthRegion()->setSplit(true)->setMinSize(100)->setMaxSize(200)->setMargins("0 0 0 0")); // East Region $east = new PhpExt_Panel(); $east->setTitle("East Size")->setCollapsible(true)->setWidth(225)->setLayout(new PhpExt_Layout_FitLayout()); $eastTabs = new PhpExt_TabPanel(); $eastTabs->setActiveTab(1)->setTabPosition(PhpExt_TabPanel::TAB_POSITON_BOTTOM)->setBorder(false); // Tab 1 $t1 = new PhpExt_Panel(); $t1->setHtml('<p>A TabPanel component can be a region.</p>')->setTitle("A Tab")->setAutoScroll(true); $eastTabs->addItem($t1); // Tab 2 $propGrid = new PhpExt_Grid_PropertyGrid();
$select_grupos->setName("grupos")->setFieldLabel("Grupos")->setToLegend("Miembros")->setFromLegend("No Miembros")->setvalueField("id")->setdisplayField("uname")->setmsHeight(260)->setmsWidth($field_width)->setToStore($grupos_to_store)->setFromStore($grupos_from_store)->setdataFields(PhpExt_Javascript::variable('["id", "uname"]'))->setimagePath("/scripts/ext/resources/extjs-ux/multiselect/"); $tab_grupos->addItem($select_grupos); $tab_panel->addItem($tab_grupos); $tab_modulos = new PhpExt_Panel(); $tab_modulos->setTitle("Modulos")->setLayout(new PhpExt_Layout_FormLayout()); //trae los items del menu $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();