Exemplo n.º 1
0
//LIBRERIAS
include_once 'PhpExt/Javascript.php';
PhpExt_Javascript::sendContentType();
include_once 'PhpExt/Ext.php';
include_once 'PhpExt/Button.php';
include_once 'PhpExt/Form/FormPanel.php';
include_once 'PhpExt/Form/Label.php';
global $ari;
$ari->popup = 1;
// no mostrar el main_frame
//BOTON BORRAR ONCLICK
$handler_clear = "function(){\n\t\t\n\tExt.MessageBox.confirm('Emporika', 'Esta seguro que desea borrar la cache?',\t\n\t\n\tfunction(e){\n\tif( e == 'yes'){\t\t\n\t this.findParentByType('form').getForm().submit({    \t     \n\t waitMsg:'Borrando cache..',\t       \n\t waitTitle:'Emporika'\n\t}\n\t);\n\t\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t},this);\t\t\n\t\n\t\t\t\t\t\t}";
//CREACION DE CONTROLES
//LABEL
$lbl_borrar = new PhpExt_Form_Label();
$lbl_borrar->setText("Al presionar el boton usted borrara la cache del sistema");
//BOTON BORRAR
$clear_button = PhpExt_Button::createTextButton("Borrar", new PhpExt_JavascriptStm($handler_clear));
//FORMULARIO
$frm_borrar_cache = new PhpExt_Form_FormPanel();
$frm_borrar_cache->setFrame(true)->setWidth(350)->setUrl("/admin/config/cache_process")->setAutoHeight(true)->setTitle("Borrar Cache")->setMethod(PhpExt_Form_FormPanel::METHOD_POST);
//AGREGO LOS CONTROLES
$frm_borrar_cache->addItem($lbl_borrar);
$frm_borrar_cache->addButton($clear_button);
//RESULTADO
$obj_comunication = new OOB_ext_comunication();
$obj_comunication->set_data($frm_borrar_cache->getJavascript(false, "contenido"));
$obj_comunication->send(true);
?>

Exemplo n.º 2
0
include_once 'PhpExt/Ext.php';
include_once 'PhpExt/Form/FormPanel.php';
include_once 'PhpExt/Data/XmlReader.php';
include_once 'PhpExt/Data/FieldConfigObject.php';
include_once 'PhpExt/Data/SimpleStore.php';
include_once 'PhpExt/Form/FieldSet.php';
include_once 'PhpExt/Form/TextField.php';
include_once 'PhpExt/Form/DateField.php';
include_once 'PhpExt/Form/ComboBox.php';
include_once 'PhpExt/Config/ConfigObject.php';
include_once 'PhpExt/Button.php';
include_once 'PhpExt/Handler.php';
include_once 'PhpExt/QuickTips.php';
include_once 'PhpExtUx/Form/XmlErrorReader.php';
$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));
Exemplo n.º 3
0
$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", null, null, null));
$store->setReader($reader)->setData(PhpExt_Javascript::variable("data"));
/* Data array could be used directly also as
 $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"));