Beispiel #1
0
<?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/Tree/TreePanel.php';
include_once 'PhpExt/Tree/TreeLoader.php';
include_once 'PhpExt/Tree/AsyncTreeNode.php';
$loader = new PhpExt_Tree_TreeLoader();
$loader->setDataUrl("examples/tree/get-nodes.php");
$tree = new PhpExt_Tree_TreePanel();
$tree->setUseArrows(true)->setAnimate(true)->setEnableDd(true)->setContainerScroll(true)->setLoader($loader)->setAutoScroll(true);
$root = new PhpExt_Tree_AsyncTreeNode();
$root->setText("PHP-Ext Examples")->setDraggable(false)->setId("examples");
echo PhpExt_Ext::OnReady($tree->getJavascript(false, "tree"), $root->getJavascript(false, "root"), $tree->setRootNode($root), $tree->render("tree-div"), $root->expand());
Beispiel #2
0
$boton_mi_cuenta = $sub_menu_bienvenido->getItem("Cuenta");
$boton_mi_cuenta->setIcon("/images/ext/user.png");
$BotonSalir2 = $sub_menu_bienvenido->getItem("Salir2");
$BotonSalir2->setIcon("/images/ext/exit.png");
//agrego el submenu
$boton_welcome = $menu->getItem("welcome");
$boton_welcome->setMenu($sub_menu_bienvenido);
//fin items
$menu_top = new PhpExt_Panel();
$menu_top->setHeader(true)->setBaseCssClass("PanelClass")->setHeight(70)->setTopToolbar($menu)->setIconCssClass("HeaderClass");
//--------------------------------------------MENU ACORDION-------------------------------------------------------------------------------------------------------//
//trae los items del menu
$tree_loader = new PhpExt_Tree_TreeLoader();
$tree_loader->setDataUrl("/admin/menu");
//armo el nodo root (no es visible)
$root = new PhpExt_Tree_AsyncTreeNode();
$root->setText("Principal Node")->setDraggable(false)->setId("Principal_Node")->setExpanded(true)->setCssClass("feeds-node")->expandChildNodes(false);
$menu_acordion = new PhpExt_Tree_TreePanel();
$menu_acordion->setTitle("Menu Principal")->setId("treePanel")->setWidth(250)->setHeight('fill')->setLines(false)->setAutoScroll(true)->setCollapseFirst(false)->setSingleExpand(true)->setUseArrows(true)->setRootVisible(false)->setRoot($root)->setLoader($tree_loader);
//----------------------------------------PANTALLA PRINCIPAL-------------------------------------------------------------------------------------------------------
$tab_layout = new PhpExt_Layout_TabLayout();
$tab_layout->setDeferredRender(false);
$principal = new PhpExt_TabPanel();
$principal->setActiveTab(0)->setId("TabPanel")->setHideMode(PhpExt_Component::HIDE_MODE_OFFSETS)->setLayout($tab_layout)->setEnableKeyEvents(true)->setenableTabScroll(true);
$onrender = "\n\n\n\n\n//beforeclose\nt.on( 'beforeremove', function(t,c){\n\nvar cnx = new Ext.data.Connection();\nExt.Ajax.request({ url : '/admin/closetab',\n\t\t\t\tmethod : 'POST',\n\t\t\t\tparams : 'tab_id=' + c.id \t\t\t\t\t   \n\t\t\t\t });\n\n});\n";
$principal->attachListener("render", new PhpExt_Listener(PhpExt_Javascript::functionDef(null, $onrender, array("t", "r", "i"))));
$module = new OOB_module('About');
$template_dir = $module->admintpldir() . "/about.tpl";
$html = $ari->t->fetch($template_dir);
$bienvenido = new PhpExt_Panel();
$bienvenido->setTitle("Bienvenido")->setId("panel_bienvenido")->setAutoScroll(true)->setBodyStyle("padding:10px 10px 0")->setHtml($html);
Beispiel #3
0
$grupos_to_store = new PhpExt_Data_JsonStore();
$grupos_to_store->setUrl("/seguridad/role/get_groups_members")->setRoot("topics")->setAutoLoad("true")->setBaseParams(array("id" => $role->get("role")))->setTotalProperty("totalCount");
$grupos_to_store->addField(new PhpExt_Data_FieldConfigObject("id", "id"));
$grupos_to_store->addField(new PhpExt_Data_FieldConfigObject("uname", "uname"));
//control para seleccionar los grupos
$select_grupos = new PhpExtUx_Itemselector();
$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"));