Exemplo n.º 1
0
$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));
$col_model->addColumn(PhpExt_Grid_ColumnConfigObject::createColumn("Nombre", "nombre", null, 280)->setEditor($txt_nombre));
$col_model->addColumn(PhpExt_Grid_ColumnConfigObject::createColumn("Descripción", "descripcion", null, 280)->setEditor($txt_descripcion));
$col_model->addColumn(PhpExt_Grid_ColumnConfigObject::createColumn("Modulo", "modulo", null, 80, PhpExt_Ext::HALIGN_RIGHT, new PhpExt_JavascriptStm($format_modulo))->setEditor($cbo_modulo));
$grid = new PhpExt_Grid_EditorGridPanel();
$grid->setStore($store)->setColumnModel($col_model)->setSelectionModel(new PhpExt_Grid_RowSelectionModel())->setLoadMask(true)->setenableColLock(false);
$grid->getPlugins()->add($filter_plugin);
$grid->getPlugins()->add(new PhpExtUx_App_FitToParent());
$grid->setBottomToolbar($paging);
$grid_render = "\n\nvar store = grid.getStore();\n\ngrid.on('validateedit', function(e){\n    if(e.field == 'modulo'){\n\t\tvar combo = grid.getColumnModel().getCellEditor(e.column, e.row).field;\t\t\t\t \t\t \n        e.record.data['modulenicename'] = combo.getRawValue();\n    }\t\n});\n\n\nvar nuevo = function(){\n\nvar cmodel = Ext.data.Record.create([\n\t\t\t\t   {name: 'id'},\n\t\t\t\t   {name: 'nombre', type: 'string'},\n\t\t\t\t   {name: 'sucursal', type: 'string'},\n\t\t\t\t   {name: 'contacto', type: 'string'},\n\t\t\t\t   {name: 'sucursal::nombre'},\n\t\t\t\t   {name: 'contacto::apellido'}\n\t\t\t  ]);\n\nvar cm = new cmodel({\n\t\t\t\t\tid : '',\n\t\t\t    nombre : '',\t\t\t \n\t\t\t  sucursal : '',\n\t\t\t  contacto : '',\n\t'sucursal::nombre' : '',\n  'contacto::apellido' : ''\n\t\t\t\t\t});\n\t\t\t\t\n\tgrid.stopEditing();\n\tstore.insert(0, cm);\n\tgrid.startEditing(0, 1);\n\n}\n\nvar eliminar = function(){\n\n\t\tvar noborrar = 0;\n\t\tvar m = grid.getSelections();\n        if( m.length > 0 )\n        {\n\t\t\tvar msg = 'Esta seguro que desea ' + ((m.length > 1)?'los':'el') + ' deposito' + ((m.length > 1)?'s':'') + '?';\n\t\t\n        \tExt.MessageBox.confirm('Emporika', msg , function( btn ){\n\t\t\t\t\tif( btn == 'yes' )\n\t\t\t\t\t{\t\n\t\t\t\t\t\tvar m = grid.getSelections();\n\t\t\t\t\t\tvar items = Array();\n\t\t\t\t\t\tfor( var i = 0, len = m.length; i < len; i++ ){  \t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tvar item = { id : m[i].get('id') }\n\t\t\t\t\t\t\t\titems.push( item );\t\t\t\t\t\t\t\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t\tvar pag = grid.getStore().lastOptions.params['start'];\t\t\t\t\t\t\n\t\t\t\t\t\tstore.load( { params : { \n\t\t\t\t\t\t\t\t\t\t\t\tstart : pag, \n\t\t\t\t\t\t\t\t\t\t\t\tlimit : {$page_size}, \n\t\t\t\t\t\t\t\t\t\t   DeleteData : Ext.encode(items) }\n\t\t\t\t\t\t\t\t\t});\t\t\n\t\t\t\t\t}\t\t\t\n\t\t\t});\t\n        }\n        else\n        {\n        \tExt.MessageBox.alert('Emporika', 'Por favor seleccione un deposito');\n        }\n}\n\nvar save = function(){\n\n\tvar hab = true;\n\tvar store_changes = store.getModifiedRecords();\n\tvar items = Array();\t\n\t\n\tfor( var i = 0, len = store_changes.length; i < len; i++ ){\n\t\n\t\t\t\t\n\t\tif( store_changes[i].get('nombre') == '' ){\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\tgrid.startEditing(i, 1);\n\t\t\thab = false;\n\t\t}\n\t\t\n\t\tif( store_changes[i].get('contacto') == '' && hab ){\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\tgrid.startEditing(i, 2);\n\t\t\thab = false;\n\t\t}\n\t\t\n\t\tif( store_changes[i].get('sucursal') == '' && hab ){\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\tgrid.startEditing(i, 3);\n\t\t\thab = false;\n\t\t}\n\t\t\n\t\t\t\n\t\tvar item = { \n\t\t\t\t\t id : store_changes[i].get('id'),\n\t\t\t     nombre : store_changes[i].get('nombre'),\n\t\t\t   contacto : store_changes[i].get('contacto::apellido'),\n\t\t\t   sucursal : store_changes[i].get('sucursal::nombre')\n\t\t\t\t   }\t\n\t\titems.push(item);\t\t   \n\t}\t\n\t\n\tif(hab){\n\t\tvar pag = grid.getStore().lastOptions.params['start'];\n\t\tstore.load( { params:{ \n\t\t\t\t\t\t\tstart : pag, \n\t\t\t\t\t\t\tlimit : {$page_size} , \n\t\t\t\t   NewsValuesData : Ext.encode(items) }\n\t\t\t\t   } );\n\t\tstore.commitChanges();\n\t}\n\t\n}\n\nvar button1 = grid.getTopToolbar().items.find( function(c){ return ( c.text == 'Nuevo') } );\nbutton1.on( 'click', nuevo );\n\nvar button2 = grid.getTopToolbar().items.find( function(c){ return ( c.text == 'Borrar') } );\nbutton2.on( 'click', eliminar );\n\nvar button3 = grid.getTopToolbar().items.find( function(c){ return ( c.text == 'Guardar cambios') } );\nbutton3.on( 'click', save );\n\n";
$grid->setEnableKeyEvents(true);
Exemplo n.º 2
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/Handler.php';
include_once 'PhpExt/Template.php';
include_once 'PhpExt/XTemplate.php';
include_once 'PhpExt/Panel.php';
include_once 'PhpExt/Toolbar/Toolbar.php';
$data = array('name' => 'Jack Slocum', 'company' => 'Ext JS, LLC', 'address' => '4 Red Bulls Drive', 'city' => 'Cleveland', 'state' => 'Ohio', 'zip' => '44102', 'kids' => array(array('name' => 'Sara Grace', 'age' => 3), array('name' => 'Zachary', 'age' => 2), array('name' => 'John James', 'age' => 0)));
/* Example 1: Basic Template */
$t = new PhpExt_Template("<p>Name: {name}</p>", "<p>Company: {company}</p>", '<p>Location: {city}, {state}</p>');
$p = new PhpExt_Panel();
$p->setTitle('Basic Template')->setWidth('300')->setHtml('<p><i>Apply the template to see results here</i></p>');
$tb = $p->getTopToolbar();
$tb->addButton("apply", "Apply Template", null, new PhpExt_Handler(PhpExt_Javascript::stm($t->getJavascript(false, "tpl")), $t->overwrite(PhpExt_Javascript::variable("p.body"), PhpExt_Javascript::variable("data"))));
$p->setRenderTo(PhpExt_Javascript::inlineStm("Ext.get('centercolumn')"));
/** Example 2: XTemplate */
$t2 = new PhpExt_XTemplate('<p>Name: {name}</p>', '<p>Company: {company}</p>', '<p>Location: {city}, {state}</p>', '<p>Kids: ', '<tpl for="kids" if="name==\\\'Jack Slocum\\\'">', '<tpl if="age &gt; 1"><p>{#}. {parent.name}\\\'s kid - {name}</p></tpl>', '</tpl></p>');
//$t2->VarName = "tpl2";
$p2 = new PhpExt_Panel();
$p2->setTitle('XTemplate')->setWidth('300')->setHtml('<p><i>Apply the template to see results here</i></p>');
$tb2 = $p2->getTopToolbar();
$tb2->addButton("apply", "Apply Template", null, new PhpExt_Handler(PhpExt_Javascript::stm($t2->getJavascript(false, "tpl2")), $t2->overwrite(PhpExt_Javascript::variable("p2.body"), PhpExt_Javascript::variable("data"))));
$p2->setRenderTo(PhpExt_Javascript::variable("Ext.get('centercolumn')"));
echo PhpExt_Ext::onReady(PhpExt_Javascript::stm("var data = " . PhpExt_Javascript::jsonEncode($data) . ";"), $p->getJavascript(false, "p"), $p2->getJavascript(false, "p2"));
Exemplo n.º 3
0
 /**
  * Button config that displays Yes, No and Cancel buttons
  * @return PhpExt_JavascriptStm
  */
 public static function YESNOCANCEL()
 {
     return PhpExt_Javascript::variable("Ext.Msg.YESNOCANCEL");
 }
Exemplo n.º 4
0
include_once 'PhpExt/Grid/ColumnConfigObject.php';
include_once 'PhpExt/Grid/GridPanel.php';
include_once 'PhpExt/Grid/GroupingView.php';
// Sample Data
$myData = array(array('3m Co', 71.72, 0.02, 0.03, '4/2 12:00am', 'Manufacturing'), array('Alcoa Inc', 29.01, 0.42, 1.47, '4/1 12:00am', 'Manufacturing'), array('Altria Group Inc', 83.81, 0.28, 0.34, '4/3 12:00am', 'Manufacturing'), array('American Express Company', 52.55, 0.01, 0.02, '4/8 12:00am', 'Finance'), array('American International Group, Inc.', 64.13, 0.31, 0.49, '4/1 12:00am', 'Services'), array('AT&T Inc.', 31.61, -0.48, -1.54, '4/8 12:00am', 'Services'), array('Boeing Co.', 75.43000000000001, 0.53, 0.71, '4/8 12:00am', 'Manufacturing'), array('Caterpillar Inc.', 67.27, 0.92, 1.39, '4/1 12:00am', 'Services'), array('Citigroup, Inc.', 49.37, 0.02, 0.04, '4/4 12:00am', 'Finance'), array('E.I. du Pont de Nemours and Company', 40.48, 0.51, 1.28, '4/1 12:00am', 'Manufacturing'), array('Exxon Mobil Corp', 68.09999999999999, -0.43, -0.64, '4/3 12:00am', 'Manufacturing'), array('General Electric Company', 34.14, -0.08, -0.23, '4/3 12:00am', 'Manufacturing'), array('General Motors Corporation', 30.27, 1.09, 3.74, '4/3 12:00am', 'Automotive'), array('Hewlett-Packard Co.', 36.53, -0.03, -0.08, '4/3 12:00am', 'Computer'), array('Honeywell Intl Inc', 38.77, 0.05, 0.13, '4/3 12:00am', 'Manufacturing'), array('Intel Corporation', 19.88, 0.31, 1.58, '4/2 12:00am', 'Computer'), array('International Business Machines', 81.41, 0.44, 0.54, '4/1 12:00am', 'Computer'), array('Johnson & Johnson', 64.72, 0.06, 0.09, '4/2 12:00am', 'Medical'), array('JP Morgan & Chase & Co', 45.73, 0.07000000000000001, 0.15, '4/2 12:00am', 'Finance'), array('McDonald\'s Corporation', 36.76, 0.86, 2.4, '4/2 12:00am', 'Food'), array('Merck & Co., Inc.', 40.96, 0.41, 1.01, '4/2 12:00am', 'Medical'), array('Microsoft Corporation', 25.84, 0.14, 0.54, '4/2 12:00am', 'Computer'), array('Pfizer Inc', 27.96, 0.4, 1.45, '4/8 12:00am', 'Services', 'Medical'), array('The Coca-Cola Company', 45.07, 0.26, 0.58, '4/1 12:00am', 'Food'), array('The Home Depot, Inc.', 34.64, 0.35, 1.02, '4/8 12:00am', 'Retail'), array('The Procter & Gamble Company', 61.91, 0.01, 0.02, '4/1 12:00am', 'Manufacturing'), array('United Technologies Corporation', 63.26, 0.55, 0.88, '4/1 12:00am', 'Computer'), array('Verizon Communications', 35.57, 0.39, 1.11, '4/3 12:00am', 'Services'), array('Wal-Mart Stores, Inc.', 45.45, 0.73, 1.63, '4/3 12:00am', 'Retail'), array('Walt Disney Company (The) (Holding Company)', 29.89, 0.24, 0.8100000000000001, '4/1 12:00am', 'Services'));
$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"));
$reader = new PhpExt_Data_ArrayReader();
$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_GroupingStore();
$store->setSortInfo(new PhpExt_Data_SortInfoConfigObject("company"));
$store->setGroupField("industry");
$store->setReader($reader);
$store->setData($myData);
// ColumnModel
$colModel = new PhpExt_Grid_ColumnModel();
$colModel->addColumn(PhpExt_Grid_ColumnConfigObject::createColumn("Company", "company", "company", 60, null, null, true, false))->addColumn(PhpExt_Grid_ColumnConfigObject::createColumn("Price", "price", null, 20, null, PhpExt_Javascript::variable("Ext.util.Format.usMoney"), true))->addColumn(PhpExt_Grid_ColumnConfigObject::createColumn("Change", "change", null, 20, null, PhpExt_Javascript::variable('change'), true))->addColumn(PhpExt_Grid_ColumnConfigObject::createColumn("Industry", "industry", null, 20, null, null, true))->addColumn(PhpExt_Grid_ColumnConfigObject::createColumn("Last Updated", "lastChange", null, 20, null, PhpExt_Javascript::variable("Ext.util.Format.dateRenderer('m/d/Y')"), true));
// View
$view = new PhpExt_Grid_GroupingView();
$view->setForceFit(true);
$view->setGroupTextTemplate('{text} ({[values.rs.length]} {[values.rs.length > 1 ? "Items" : "Item"]})');
// Grid
$grid = new PhpExt_Grid_GridPanel();
$grid->setStore($store)->setColumnModel($colModel)->setView($view)->setFrame(true)->setCollapsible(true)->setAnimCollapse(true)->setTitle("Grouping Example")->setIconCssClass("icon-grid")->setRenderTo("grouping-example")->setWidth(700)->setHeight(450);
// Ext.OnReady -----------------------
echo PhpExt_Ext::onReady(PhpExt_Javascript::assignNew("myData", PhpExt_Javascript::valueToJavascript($myData)), $changeRenderer, $store->getJavascript(false, "store"), $grid->getJavascript(false, "grid"));
Exemplo n.º 5
0
$fs = new PhpExt_Form_FormPanel();
$fs->setFrame(true)->setTitle("XML Form")->setLabelAlign(PhpExt_Form_FormPanel::LABEL_ALIGN_RIGHT)->setLabelWidth(85)->setWidth(340)->setWaitMsgTarget(true);
// configure how to read the XML Data
$reader = new PhpExt_Data_XmlReader();
$reader->setRecord("contact")->setSuccess("@success");
$reader->addField(new PhpExt_Data_FieldConfigObject("first", "name/first"));
// custom mapping
$reader->addField(new PhpExt_Data_FieldConfigObject("last", "name/last"));
$reader->addField(new PhpExt_Data_FieldConfigObject("company", "company"));
$reader->addField(new PhpExt_Data_FieldConfigObject("email", "email"));
$reader->addField(new PhpExt_Data_FieldConfigObject("state", "state"));
$reader->addField(new PhpExt_Data_FieldConfigObject("dob", "dob", "date", "m/d/Y"));
// custom data types
$fs->setReader($reader);
$fs->setErrorReader(new PhpExtUx_Form_XmlErrorReader());
$fset = new PhpExt_Form_FieldSet();
$fset->setTitle("Contact Information")->setAutoHeight(true)->setDefaultType("textfield")->setDefaults(new PhpExt_Config_ConfigObject(array("width" => 190)))->addItem(PhpExt_Form_TextField::createTextField("first", "First Name"))->addItem(PhpExt_Form_TextField::createTextField("last", "Last Name"))->addItem(PhpExt_Form_TextField::createTextField("company", "Company"))->addItem(PhpExt_Form_TextField::createTextField("email", "Email", null, PhpExt_Form_FormPanel::VTYPE_EMAIL));
$combo = PhpExt_Form_ComboBox::createComboBox("state", "State")->setValueField("abbr")->setDisplayField("state")->setTypeAhead(true)->setMode(PhpExt_Form_ComboBox::MODE_LOCAL)->setTriggerAction(PhpExt_Form_ComboBox::TRIGGER_ACTION_ALL)->setEmptyText("Select a state...")->setSelectOnFocus(true);
$store = new PhpExt_Data_SimpleStore();
$store->addField("abbr");
$store->addField("state");
$store->setData(PhpExt_Javascript::variable("Ext.exampledata.states"));
$combo->setStore($store);
$fset->addItem($combo);
$fset->addItem(PhpExt_Form_DateField::createDateField("dob", "Data of Birth")->setAllowBlank(false));
$fs->addItem($fset);
$fs->addButton(PhpExt_Button::createTextButton("Load", new PhpExt_Handler(PhpExt_Javascript::stm("fs.getForm().load({url:'examples/form/xml-form.xml', waitMsg:'Loading',method: 'GET'})"))));
$submitBtn = PhpExt_Button::createTextButton("Submit", new PhpExt_Handler(PhpExt_Javascript::stm("fs.getForm().submit({url:'examples/form/xml-errors.xml', waitMsg:'Saving Data...'})")));
$fs->addButton($submitBtn);
//****************************** onReady
echo PhpExt_Ext::onReady(PhpExt_Javascript::stm(PhpExt_QuickTips::init()), PhpExt_Javascript::assign("Ext.form.Field.prototype.msgTarget", PhpExt_Javascript::valueToJavascript(PhpExt_Form_FormPanel::MSG_TARGET_SIDE)), $fs->getJavascript(false, "fs"), PhpExt_Javascript::assignNew("submit", $submitBtn->getJavascript()), $fs->render("form-ct"));
Exemplo n.º 6
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/Panel.php';
$p = new PhpExt_Panel();
$p->setTitle("My Panel")->setCollapsible(true)->setRenderTo(PhpExt_Javascript::variable("Ext.get('centercolumn')"))->setWidth(400)->setHtml(PhpExt_Javascript::variable("Ext.example.bogusMarkup"));
echo PhpExt_Ext::OnReady($p->getJavascript(false, "p"));
Exemplo n.º 7
0
<?php

#OOB/N1 Framework [2008 - Nutus] - PM
// Código por JPCOSEANI
// Script que genera el MAIN FRAME
global $ari;
$ari->popup = 1;
// no mostrar el main_frame
PhpExt_Javascript::sendContentType();
//--------------------------------------------------MENU TOP-----------------------------------------------------------------------------------------------------------//
//items del panel top
//Boton_Salir OnClick
$msg_config = PhpExt_MessageBoxOptions::createMsgOptions()->setTitle($ari->title)->setMsg("¿Est&aacute; seguro que desea salir?")->setWidth(300)->setButtons(new PhpExt_JavascriptStm("{ cancel:'Cancelar', yes:'Salir', ok:'Salir y Guardar' }"))->setMultiline(false)->setFn(PhpExt_Javascript::variable("function( Result ){\n\t\t\t\t\tif(Result == 'yes'){\n\t\t\t\t\t\twindow.location = '/seguridad/logout';\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tif(Result == 'ok'){\n\t\t\t\t\t\twindow.location = '/seguridad/logoutsave';\n\t\t\t\t\t}\t\t\t  \t\t\t  \n\t\t\t\t}"));
$msgbox = PhpExt_Javascript::functionDef(null, PhpExt_MessageBox::show($msg_config));
//Boton_Mi_Cuenta OnClick // function addTab( Title, Url, Add, Params, cache, tab_id ) // addTab(i.title,i.url,true,i.params,true,i.id);
$function_add_tab = PhpExt_Javascript::callfunction("addTab", array("'Mi Cuenta'", "'/seguridad/user/update'", "true"));
$handler_mi_cuenta = PhpExt_Javascript::functionDef("", $function_add_tab, array("e"));
$sub_menu_bienvenido = new PhpExt_Menu_Menu();
$sub_menu_bienvenido->addCheckItem("Cuenta", "Mi Cuenta", $handler_mi_cuenta);
$sub_menu_bienvenido->addCheckItem("Salir2", "Salir", $msgbox);
$menu = new PhpExt_Toolbar_Toolbar();
$menu->addFill("leftfill");
//para que los botones estena a la derecha
$menu->addButton("welcome", "<u>Bienvenido " . $ari->get("user")->name() . "</u>");
$menu->addButton("Salir", "Salir", null, $msgbox);
//pongo los iconos
$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
Exemplo n.º 8
0
include_once 'PhpExt/Handler.php';
include_once 'PhpExt/MessageBox.php';
include_once 'PhpExt/MessageBoxOptions.php';
include_once 'PhpExt/ProgressBarWaitConfig.php';
$mb1Element = PhpExt_Element::getById('mb1');
$mb1Handler = PhpExt_Javascript::functionDef(null, PhpExt_MessageBox::confirm("Confirm", "Are you sure you want to do that", PhpExt_Javascript::variable('showResult')), array("e"));
$mb2Element = PhpExt_Element::getById('mb2');
$mb2Handler = PhpExt_Javascript::functionDef(null, PhpExt_MessageBox::prompt("Name", "Please enter your name:", PhpExt_Javascript::variable('showResultText')), array("e"));
$mb3Element = PhpExt_Element::getById('mb3');
$mb3Options = PhpExt_MessageBoxOptions::createMsgOptions()->setTitle('Address')->setMsg('Please enter your address:')->setWidth(300)->setButtons(PhpExt_MessageBox::OKCANCEL())->setMultiline(true)->setFn(PhpExt_Javascript::variable('showResultText'))->setAnimEl('mb3');
$mb3Handler = PhpExt_Javascript::functionDef(null, PhpExt_MessageBox::show($mb3Options));
$mb4Element = PhpExt_Element::getById('mb4');
$mb4Options = PhpExt_MessageBoxOptions::createMsgOptions()->setTitle('Save Changes?')->setMsg('You are closing a tab that has unsaved changes. <br />Would you like to save your changes?')->setButtons(PhpExt_MessageBox::YESNOCANCEL())->setFn(PhpExt_Javascript::variable('showResult'))->setAnimEl('mb4')->setIcon(PhpExt_MessageBox::QUESTION());
$mb4Handler = PhpExt_Javascript::functionDef(null, PhpExt_MessageBox::show($mb4Options));
$mb6Element = PhpExt_Element::getById('mb6');
$mb6Options = PhpExt_MessageBoxOptions::createMsgOptions()->setTitle('Please wait')->setMsg('Loading items...')->setProgressText('Initializing...')->setWidth(300)->setProgress(true)->setClosable(false)->setAnimEl('mb6');
$mb6Hide = PhpExt_MessageBox::hide()->output();
$mb6Progress = PhpExt_MessageBox::updateProgress(PhpExt_Javascript::variable("i"), PhpExt_Javascript::inlineStm("Math.round(100*i)+'% completed'"))->output();
$mb6Handler = PhpExt_Javascript::functionDef(null, PhpExt_MessageBox::show($mb6Options)->output() . "\r\n\t\t// this hideous block creates the bogus progress\r\n       var f = function(v){\r\n            return function(){\r\n                if(v == 12){\r\n                    " . $mb6Hide . ";\r\n                    Ext.example.msg('Done', 'Your fake items were loaded!');\r\n                }else{\r\n                    var i = v/11;\r\n\t\t\t\t\t" . $mb6Progress . ";                    \r\n                }\r\n           };\r\n       };\r\n       for(var i = 1; i < 13; i++){\r\n           setTimeout(f(i), i*500);\r\n       }");
$mb7Element = PhpExt_Element::getById('mb7');
$mb7Options = PhpExt_MessageBoxOptions::createMsgOptions()->setMsg('Saving your data, please wait...')->setProgressText('Saving...')->setWait(true)->setWaitConfig(PhpExt_ProgressBarWaitConfig::createWaitConfig()->setInterval(200))->setIcon('ext-mb-download')->setAnimEl('mb7');
$mb7Handler = PhpExt_Javascript::functionDef(null, PhpExt_MessageBox::show($mb7Options)->output() . "\r\n\t\tsetTimeout(function(){\r\n            //This simulates a long-running operation like a database save or XHR call.\r\n            //In real code, this would be in a callback function.\r\n            " . PhpExt_MessageBox::hide()->output() . ";\r\n            Ext.example.msg('Done', 'Your fake data was saved!');\r\n        }, 8000);");
$mb8Element = PhpExt_Element::getById('mb8');
$mb8Handler = PhpExt_Javascript::functionDef(null, PhpExt_MessageBox::alert("Status", "Changes saved successfully.", PhpExt_Javascript::variable('showResult')));
$comboValues = PhpExt_Javascript::stm("\r\n\t//Add these values dynamically so they aren't hard-coded in the html\r\n    Ext.fly('info').dom.value = Ext.MessageBox.INFO;\r\n    Ext.fly('question').dom.value = Ext.MessageBox.QUESTION;\r\n    Ext.fly('warning').dom.value = Ext.MessageBox.WARNING;\r\n    Ext.fly('error').dom.value = Ext.MessageBox.ERROR;\r\n");
$mb9Element = PhpExt_Element::getById('mb9');
$mb9Options = PhpExt_MessageBoxOptions::createMsgOptions()->setTitle('Icon Support')->setMsg('Here is a message with an icon!')->setButtons(PhpExt_MessageBox::OK())->setFn(PhpExt_Javascript::variable('showResult'))->setAnimEl('mb9')->setIcon(PhpExt_Javascript::variable("Ext.get('icons').dom.value"));
$mb9Handler = PhpExt_Javascript::functionDef(null, PhpExt_MessageBox::show($mb9Options));
$showResult = PhpExt_Javascript::stm("function showResult(btn){\r\n        Ext.example.msg('Button Click', 'You clicked the {0} button', btn);\r\n    };");
$showResultText = PhpExt_Javascript::stm("function showResultText(btn, text){\r\n        Ext.example.msg('Button Click', 'You clicked the {0} button and entered the text \"{1}\".', btn, text);\r\n    };");
echo PhpExt_Ext::OnReady($mb1Element->on("click", $mb1Handler), $mb2Element->on("click", $mb2Handler), $mb3Element->on("click", $mb3Handler), $mb4Element->on("click", $mb4Handler), $mb6Element->on("click", $mb6Handler), $mb7Element->on("click", $mb7Handler), $mb8Element->on("click", $mb8Handler), $comboValues, $mb9Element->on("click", $mb9Handler), $showResult, $showResultText);
Exemplo n.º 9
0
//descripcion del grupo
$txt_descripcion = PhpExt_Form_TextArea::createTextArea("txt_descripcion", "Descripci&oacute;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"));
$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
Exemplo n.º 10
0
$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"));
$tabPanel2->addItem($detailsTab2);
$tabPanel2->addItem($phonesTab2);
$tabPanel2->addItem($bioTab);
$tabs2->addItem($tabPanel2);
$tabs2->addButton(PhpExt_Button::createTextButton("Save"));
$tabs2->addButton(PhpExt_Button::createTextButton("Cancel"));
//****************************** onReady
echo PhpExt_Ext::onReady(PhpExt_QuickTips::init(), PhpExt_Javascript::assign("bd", "Ext.get('centercolumn')"), PhpExt_Javascript::stm("bd.createChild({tag: 'h2', html: 'Form 1 - Very Simple'})"), $simple->getJavascript(false, "simple"), $simple->render(PhpExt_Javascript::variable("Ext.get('centercolumn')")), PhpExt_Javascript::stm("bd.createChild({tag: 'h2', html: 'Form 2 - Adding fieldsets'})"), $fsf->getJavascript(false, "fsf"), $fsf->render(PhpExt_Javascript::variable("Ext.get('centercolumn')")), PhpExt_Javascript::stm("bd.createChild({tag: 'h2', html: 'Form 3 - A little more complex'})"), $top->getJavascript(false, "top"), $top->render(PhpExt_Javascript::variable("Ext.get('centercolumn')")), PhpExt_Javascript::stm("bd.createChild({tag: 'h2', html: 'Form 4 - Forms can be a TabPanel...'})"), $tabs->getJavascript(false, "tabs"), $tabs->render(PhpExt_Javascript::variable("Ext.get('centercolumn')")), PhpExt_Javascript::stm("bd.createChild({tag: 'h2', html: 'Form 5 - ... and forms can contain TabPanel(s)'})"), $tabs2->getJavascript(false, "tabs2"), $tabs2->render(PhpExt_Javascript::variable("Ext.get('centercolumn')")));
Exemplo n.º 11
0
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/SimpleStore.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/Grid/GridPanel.php';
// Sample Data
$myData = array(array('3m Co', 71.72, 0.02, 0.03, '9/1 12:00am'), array('Alcoa Inc', 29.01, 0.42, 1.47, '9/1 12:00am'), array('Altria Group Inc', 83.81, 0.28, 0.34, '9/1 12:00am'), array('American Express Company', 52.55, 0.01, 0.02, '9/1 12:00am'), array('American International Group, Inc.', 64.13, 0.31, 0.49, '9/1 12:00am'), array('AT&T Inc.', 31.61, -0.48, -1.54, '9/1 12:00am'), array('Boeing Co.', 75.43000000000001, 0.53, 0.71, '9/1 12:00am'), array('Caterpillar Inc.', 67.27, 0.92, 1.39, '9/1 12:00am'), array('Citigroup, Inc.', 49.37, 0.02, 0.04, '9/1 12:00am'), array('E.I. du Pont de Nemours and Company', 40.48, 0.51, 1.28, '9/1 12:00am'), array('Exxon Mobil Corp', 68.09999999999999, -0.43, -0.64, '9/1 12:00am'), array('General Electric Company', 34.14, -0.08, -0.23, '9/1 12:00am'), array('General Motors Corporation', 30.27, 1.09, 3.74, '9/1 12:00am'), array('Hewlett-Packard Co.', 36.53, -0.03, -0.08, '9/1 12:00am'), array('Honeywell Intl Inc', 38.77, 0.05, 0.13, '9/1 12:00am'), array('Intel Corporation', 19.88, 0.31, 1.58, '9/1 12:00am'), array('International Business Machines', 81.41, 0.44, 0.54, '9/1 12:00am'), array('Johnson & Johnson', 64.72, 0.06, 0.09, '9/1 12:00am'), array('JP Morgan & Chase & Co', 45.73, 0.07000000000000001, 0.15, '9/1 12:00am'), array('McDonald\'s Corporation', 36.76, 0.86, 2.4, '9/1 12:00am'), array('Merck & Co., Inc.', 40.96, 0.41, 1.01, '9/1 12:00am'), array('Microsoft Corporation', 25.84, 0.14, 0.54, '9/1 12:00am'), array('Pfizer Inc', 27.96, 0.4, 1.45, '9/1 12:00am'), array('The Coca-Cola Company', 45.07, 0.26, 0.58, '9/1 12:00am'), array('The Home Depot, Inc.', 34.64, 0.35, 1.02, '9/1 12:00am'), array('The Procter & Gamble Company', 61.91, 0.01, 0.02, '9/1 12:00am'), array('United Technologies Corporation', 63.26, 0.55, 0.88, '9/1 12:00am'), array('Verizon Communications', 35.57, 0.39, 1.11, '9/1 12:00am'), array('Wal-Mart Stores, Inc.', 45.45, 0.73, 1.63, '9/1 12:00am'));
$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"));
// Store
$store = new PhpExt_Data_SimpleStore();
$store->addField(new PhpExt_Data_FieldConfigObject("company"));
$store->addField(new PhpExt_Data_FieldConfigObject("price", null, "float"));
$store->addField(new PhpExt_Data_FieldConfigObject("change", null, "float"));
$store->addField(new PhpExt_Data_FieldConfigObject("pctChange", null, "float"));
$store->addField(new PhpExt_Data_FieldConfigObject("lastChange", null, "date", "n/j h:ia"));
// 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, 85, null, PhpExt_Javascript::variable("Ext.util.Format.dateRenderer('m/d/Y')"), null, true));
// Grid
$grid = new PhpExt_Grid_GridPanel();
$grid->setStore($store)->setColumnModel($colModel)->setStripeRows(true)->setAutoExpandColumn("company")->setHeight(350)->setWidth(600)->setTitle("Array Grid");
// Ext.OnReady -----------------------
echo PhpExt_Ext::onReady(PhpExt_Javascript::assignNew("myData", PhpExt_Javascript::valueToJavascript($myData)), $changeRenderer, $pctChangeRenderer, $store->getJavascript(false, "store"), $store->loadData(PhpExt_Javascript::variable("myData")), $grid->getJavascript(false, "grid"), $grid->render("grid-example"));
Exemplo n.º 12
0
$paging->getPlugins()->add($filter_plugin);
//GRILLA
$grid = new PhpExt_Grid_GridPanel();
$grid->setStore($store)->setSelectionModel($check_select)->setColumnModel($col_model)->setLoadMask(true)->setenableColLock(false);
$grid->getPlugins()->add($filter_plugin);
$grid->getPlugins()->add(new PhpExtUx_App_FitToParent());
$grid_render = "\n\nvar combo = grid.getTopToolbar().items.find( function(c){ return ( c.xtype == 'combo') } );\nvar store = grid.getStore();\n\n\tvar nuevo = function(){\n\t\tvar id = 'gid=' + grid.id ;\n\t\taddTab( 'Nuevo Usuario', '/seguridad/user/new', true, id );\n\t}\n\nvar edit = function(){\n\t\n\t\t\tvar id;\n\t\t\tvar m = grid.getSelections();\n\n\t\t\tif( m.length >= 1 ){\t\n\t\t\t\tfor( var i = 0, len = m.length; i < len; i++ ){\t\t\t\t\t\n\t\t\t\t\t\tvar id = 'id=' + m[i].get('id') + '&gid=' + grid.id ;\n\t\t\t\t\t\taddTab('Modificar Usuario','/seguridad/user/update',true,id);\t\t\t\t\t\t\n\t\t\t\t}\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tExt.MessageBox.alert('Emporika', 'Por favor seleccione un item');\n\t\t\t}\t\t\t\n}\n\n\tvar save = function(){\n\t\n\tif( combo.getValue() == '' ){\n\t\tExt.Msg.alert('Nutus Econom&iacute;a', 'Debe seleccionar un estado' );\t\n\t}\n\telse\n\t{\n\t\n\t\tvar m = grid.getSelections();\n        if(m.length > 0)\n        {\n        \tExt.MessageBox.confirm( 'Emporika', 'Esta seguro que desea cambiar el estado?' , function(btn){\n\t\t\t\t\n\t\t\t\tif( btn == 'yes' ){\t\n\t\t\t\t\tvar m = grid.getSelections();\n\t\t\t\t\t\n\t\t\t\t\tvar items = Array();\n\t\t\t\t\tfor(var i = 0, len = m.length; i < len; i++){  \n\t\t\t\t\t\tvar item = { id : m[i].get('id') };\n\t\t\t\t\t\titems.push(item);\n\t\t\t\t\t}\n\t\t\t\t\tvar json = { \n\t\t\t\t\t\t\t\t status : combo.getRawValue() ,\n\t\t\t\t\t\t\t\t  items : items\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t   }\t\t\t\t\t\n\t\t\t\t\t\t   \n\t\t\t\t\tvar pag = grid.getStore().lastOptions.params['start'];\n\t\t\t\t\tgrid.getStore().load( { params : { start : pag, limit: {$page_size} , UpdateStateData: Ext.encode(json) } } );\t\t\n\t\t\t\t}\n\t\t\t\t\n\t\t\t}, this );\t\n        }\n        else\n        {\n        \tExt.MessageBox.alert('Emporika', 'Por favor seleccione un item');\n        }\n\n\t}\n\t\n\t}\n\n\nvar eliminar = function(){\n\t\n\tvar m = grid.getSelections();\n        if(m.length > 0)\n        {\n\t\t\tvar msg = 'Esta seguro que desea eliminar ' + ((m.length>1)?'los':'el') + ' usuario' + ((m.length>1)?'s':'') + '?';\n        \tExt.MessageBox.confirm('Emporika', msg , \n\t\t\tfunction(btn){\n\t\t\t\t\tif( btn == 'yes' ){\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tvar items = Array();\n\t\t\t\t\t\t\tfor(var i = 0, len = m.length; i < len; i++){  \n\t\t\t\t\t\t\t\tvar item = { id: m[i].get('id') };\n\t\t\t\t\t\t\t\titems.push( item );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tvar pag = grid.getStore().lastOptions.params['start'];\t\n\t\t\t\t\t\t\tstore.load( { params:{ \n\t\t\t\t\t\t\t\t\t\t\t\tstart: pag,\n\t\t\t\t\t\t\t\t\t\t\t\tlimit: {$page_size} , \n\t\t\t\t\t\t\t\t\t\tDeleteUserData: Ext.encode(items) \n\t\t\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\n\t\t\t\t\t\t\t\t\t  });\t\t\n\t\t\t\t\t}\t\t\n\t\t\t}, this );\t\n        }\n        else\n        {\n        \tExt.MessageBox.alert('Emporika', 'Por favor seleccione un item');\n        }\n}\t\n\t\nvar button1 = grid.getTopToolbar().items.find( function(c){ return ( c.text == 'Nuevo') } );\nbutton1.on( 'click', nuevo );\n\nvar button2 = grid.getTopToolbar().items.find( function(c){ return ( c.text == 'Modificar') } );\nbutton2.on( 'click', edit );\n\nvar button3 = grid.getTopToolbar().items.find( function(c){ return ( c.text == 'Guardar cambios') } );\nbutton3.on( 'click', save );\n\nvar button4 = grid.getTopToolbar().items.find( function(c){ return ( c.text == 'Eliminar') } );\nbutton4.on( 'click', eliminar );\n\ngrid.on( 'celldblclick', edit );\n\n";
$grid->setEnableKeyEvents(true);
$grid->attachListener("render", new PhpExt_Listener(PhpExt_Javascript::functionDef(null, $grid_render, array("grid"))));
//SETEO LA BARRA DE PAGINACION
$grid->setBottomToolbar($paging);
//Data_Store para llenar el combo con los datos
$store_estados = new PhpExt_Data_SimpleStore();
$store_estados->addField("id");
$store_estados->addField("descripcion");
$store_estados->setData(PhpExt_Javascript::variable(json_encode($estados)));
$cbo_estados = PhpExt_Form_ComboBox::createComboBox(null, "Estado")->setWidth(80)->setStore($store_estados)->setDisplayField("descripcion")->setValueField("id")->setEditable(false)->setForceSelection(true)->setSingleSelect(true)->setEmptyText("seleccionar")->setMode(PhpExt_Form_ComboBox::MODE_LOCAL)->setTriggerAction(PhpExt_Form_ComboBox::TRIGGER_ACTION_ALL);
$txt_busqueda = new PhpExtUx_App_SearchField();
$txt_busqueda->setStore($store);
$tb = $grid->getTopToolbar();
$tb->addButton("new", "Nuevo", "images/add.png");
$tb->addSeparator("sep1");
$tb->addButton("modificar", "Modificar", "images/edit.gif");
$tb->addSeparator("sep2");
$tb->addButton("delete", "Eliminar", "images/no_.gif");
$tb->addSeparator("sep3");
$tb->addTextItem("text2", "Buscar:");
$tb->addItem("txt_busqueda", $txt_busqueda);
$tb->addFill("fill");
$tb->addTextItem("text", "Modificar estado:");
$tb->addItem("estados", $cbo_estados);
Exemplo n.º 13
0
 /**
  * Static method to retrieve Ext.Element objects.
  * Uses simple caching to consistently return the same object. Automatically fixes if an object was recreated with the same id via AJAX or DOM.
  * To retrieve an element by Id use {@link PhpExt_Element::getById}
  * @param string $id The DOM node to retrieve
  * @return PhpExt_Element
  */
 public static function getByDOM($domNode)
 {
     if (!PhpExt_Javascript::isJavascriptStm($domNode)) {
         $domNode = PhpExt_Javascript::variable($domNode);
     }
     $e = new PhpExt_Element();
     $e->domNode = $domNode;
     $args = array($domNode);
     $methodSig = $e->createMethodSignature("get", $args, true);
     $e->createMethod = $e->getMethodInvokeStm('Ext.Element', $methodSig, true);
     return $e;
 }
Exemplo n.º 14
0
include_once 'PhpExtUx/Grid/CheckColumn.php';
$formatDate = PhpExt_Javascript::functionDef("formatDate", "return value ? value.dateFormat('M d, Y') : '';", array("value"));
// custom column plugin example
$checkColumn = new PhpExtUx_Grid_CheckColumn("Indoor?");
$checkColumn->setDataIndex("indoor");
$checkColumn->setWidth(55);
// the column model has information about grid columns
//dataIndex maps the column to the specific data field in
// the data store (created below)
// ColumnModel
$txtCommon = PhpExt_Form_TextField::createTextField('txtCommon')->setAllowBlank(false);
$cmbLight = PhpExt_Form_ComboBox::createComboBox("cmbLight")->setTypeAhead(true)->setTriggerAction(PhpExt_Form_ComboBox::TRIGGER_ACTION_ALL)->setTransform("light")->setLazyRender(true)->setListCssClass('x-combo-list-small');
$txtPrice = PhpExt_Form_NumberField::createNumberField("txtPrice")->setAllowBlank(false)->setAllowNegative(false)->setMaxValue(100000);
$dtAvailable = PhpExt_Form_DateField::createDateField("dtAvaliable")->setFormat("m/d/y")->setMinValue("01/01/06")->setDisabledDays(array(0, 6))->setDisabledDaysText("Plants are not available on the weekends");
$colModel = new PhpExt_Grid_ColumnModel();
$colModel->addColumn(PhpExt_Grid_ColumnConfigObject::createColumn("Common Name", "common", "common", 220)->setEditor($txtCommon))->addColumn(PhpExt_Grid_ColumnConfigObject::createColumn("Light", "light", null, 130)->setEditor($cmbLight))->addColumn(PhpExt_Grid_ColumnConfigObject::createColumn("Price", "price", "price", 70, PhpExt_Ext::HALIGN_RIGHT, "usMoney")->setEditor($txtPrice))->addColumn(PhpExt_Grid_ColumnConfigObject::createColumn("Avaliable", "availDate", "availDate", 95, null, PhpExt_Javascript::variable('formatDate'))->setEditor($dtAvailable))->addColumn($checkColumn);
// this could be inline, but we want to define the Plant record
// type so we can add records dynamically
$fields = new PhpExt_Data_FieldConfigObjectCollection();
$fields->add(new PhpExt_Data_FieldConfigObject("common", null, PhpExt_Data_FieldConfigObject::TYPE_STRING));
$fields->add(new PhpExt_Data_FieldConfigObject("botanical", null, PhpExt_Data_FieldConfigObject::TYPE_STRING));
$fields->add(new PhpExt_Data_FieldConfigObject("light"));
$fields->add(new PhpExt_Data_FieldConfigObject("price", null, PhpExt_Data_FieldConfigObject::TYPE_FLOAT));
$fields->add(new PhpExt_Data_FieldConfigObject("availDate", "availability", PhpExt_Data_FieldConfigObject::TYPE_DATE, "m/d/Y"));
$fields->add(new PhpExt_Data_FieldConfigObject("indoor", null, PhpExt_Data_FieldConfigObject::TYPE_BOOLEAN));
$plant = PhpExt_Data_Record::create($fields);
// Reader
$reader = new PhpExt_Data_XmlReader();
$reader->setRecord("plant");
$reader->setRecordType("Plant");
// Store
Exemplo n.º 15
0
$opt_group_predeterminada = new PhpExt_Form_RadioGroup();
$opt_group_predeterminada->setfieldLabel("Predeterminada");
$opt_group_predeterminada->addItem($opt_predeterminada_si);
$opt_group_predeterminada->addItem($opt_predeterminada_no);
$group_render = "\n\nvar formulario = this.findParentByType('form');\n\t\nvar group = formulario.findBy( function(c){ return ( c.xtype == 'radiogroup' );} );\n\nopt = this.items.items[0];\t\n\nopt.on( 'check' , function(t,n,o){\t\n\tvar field = formulario.getForm().findField('txt_valor');\n\tif( t.getValue() )\n\t{\n\t\tgroup[0].items.items[0].setValue(true);\n\t\tgroup[0].items.items[1].setValue(false);\n\t\tfield.setValue('1');\n\t\tfield.disable();\t\t\n\t}\n\telse\n\t{\n\t\tif( group[0].items.items[0].getValue() ){\n\t\t\tfield.enable();\n\t\t\tfield.focus(true);\t\t\n\t\t}else{\n\t\t\tfield.setValue('1');\n\t\t\tfield.disable();\t\t\n\t\t}\n\t}\n},this);\n";
$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);
Exemplo n.º 16
0
$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();
$paging->setStore($store)->setPageSize($page_size)->setDisplayInfo(true)->setEmptyMessage("No se encontraron Monedas");
$paging->getPlugins()->add($filter_plugin);
$check_select = new PhpExt_Grid_CheckboxSelectionModel();
//AGREGO LAS COLUMNAS QUE VA USAR EL GRID
$col_model = new PhpExt_Grid_ColumnModel();
$col_model->addColumn($check_select)->addColumn(PhpExt_Grid_ColumnConfigObject::createColumn("Id", "id"))->addColumn(PhpExt_Grid_ColumnConfigObject::createColumn("Moneda", "name"))->addColumn(PhpExt_Grid_ColumnConfigObject::createColumn("Predeterminada", "default"))->addColumn(PhpExt_Grid_ColumnConfigObject::createColumn("Tipo", "type"))->addColumn(PhpExt_Grid_ColumnConfigObject::createColumn("Ultima cotizaci&oacute;n", "cotizacion"));
//CREACION DEL GRID
$grid = new PhpExt_Grid_EditorGridPanel();
$grid->setStore($store)->setSelectionModel($check_select)->setColumnModel($col_model)->setLoadMask(true)->setenableColLock(false);
$grid->getPlugins()->add($filter_plugin);
$grid->getPlugins()->add(new PhpExtUx_App_FitToParent());
$grid->setBottomToolbar($paging);