示例#1
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"));
示例#2
0
$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);
$frm_nuevo_rol->addItem($marco);
$frm_nuevo_rol->addButton($btn_grabar);
$frm_nuevo_rol->addButton(PhpExt_Button::createTextButton("Cancelar"));
//RESULTADO
$obj_comunication = new OOB_ext_comunication();
$obj_comunication->set_data($frm_nuevo_rol->getJavascript(false, "contenido"));
$obj_comunication->send(true);
?>

示例#3
0
 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>";
 }
示例#4
0
$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);
$marco->addItem($txt_buscar_usuario);
$marco->addItem($select);
$frm_update_group->addButton($btn_actualizar);
$frm_update_group->addButton(PhpExt_Button::createTextButton("Cancelar"));
$frm_update_group->addItem($marco);
$resultado = '';
$resultado .= $to_store->getJavascript(false, "tostore");
$resultado .= $from_store->getJavascript(false, "fromstore");
$resultado .= $frm_update_group->getJavascript(false, "contenido");
//RESULTADO
$obj_comunication = new OOB_ext_comunication();
$obj_comunication->set_data($resultado);
$obj_comunication->send(true);
示例#5
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);
?>

示例#6
0
$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");
$resultado .= $modulos_to_store->getJavascript(false, "modulos_tostore");
$resultado .= $modulos_from_store->getJavascript(false, "modulos_fromstore");
$resultado .= $frm_update_perspective->getJavascript(false, "contenido");
//RESULTADO
$obj_comunication = new OOB_ext_comunication();
$obj_comunication->set_data($resultado);
$obj_comunication->send(true);
示例#7
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/Window.php';
include_once 'PhpExt/Form/FormPanel.php';
include_once 'PhpExt/Form/TextField.php';
include_once 'PhpExt/Form/TextArea.php';
include_once 'PhpExt/Button.php';
include_once 'PhpExt/Layout/FitLayout.php';
include_once 'PhpExt/Layout/AnchorLayoutData.php';
$form = new PhpExt_Form_FormPanel();
// Properties can be set by using the closures...
$form->setBaseCssClass("x-plain")->setLabelWidth(55)->setUrl("save-form.php")->setDefaultType("textfield");
// or in the traditional way.
$textfield1 = new PhpExt_Form_TextField();
$textfield1->setName("to");
$textfield1->setFieldLabel("Send To");
$form->addItem($textfield1, new PhpExt_Layout_AnchorLayoutData("100%"));
// anchor width by percentage
$textfield2 = PhpExt_Form_TextField::createTextField("subject", "Subject");
$form->addItem($textfield2, new PhpExt_Layout_AnchorLayoutData("100%"));
$textarea = PhpExt_Form_TextArea::createTextArea("msg")->setHideLabel(true);
$form->addItem($textarea, new PhpExt_Layout_AnchorLayoutData("100% -53"));
$window = new PhpExt_Window();
$window->setTitle("Resize Me")->setWidth(500)->setHeight(300)->setMinWidth(300)->setMinHeight(200)->setLayout(new PhpExt_Layout_FitLayout())->setPlain(true)->setBodyStyle("padding:5px")->setButtonAlign(PhpExt_Ext::HALIGN_CENTER);
$window->addButton(PhpExt_Button::createTextButton("Send"));
$window->addButton(PhpExt_Button::createTextButton("Cancel"));
$window->addItem($form);
echo PhpExt_Ext::onReady($form->getJavascript(false, "form"), $window->getJavascript(false, "window"), $window->show());
示例#8
0
$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"));
$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')")));
示例#9
0
//e-mail
$txt_email = PhpExt_Form_TextField::createTextField("txt_email", "E-mail", null, PhpExt_Form_FormPanel::VTYPE_EMAIL)->setWidth($field_width)->setMsgTarget(PhpExt_Form_FormPanel::MSG_TARGET_SIDE);
//Boton actualizar OnClick
$handler_grabar = "\nfunction(){\n\nthis.findParentByType('form').getForm().submit(\n\t{    \n\t\t\treset : true,\n\t\t  waitMsg : 'Enviando Datos',\n\t\twaitTitle : 'Emporika',\n\t  success_msg : 'Usuario creado correctamente',\n  grid_reload_id  : '{$grid_id}'\t\t\t\t \t   \n\t}\t\n\t);\t\t\t\t\n\t\t}";
$btn_grabar = PhpExt_Button::createTextButton("Grabar", new PhpExt_JavascriptStm($handler_grabar));
//JSON_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_usuario = new PhpExt_Form_FormPanel();
$frm_nuevo_usuario->setUrl("/seguridad/user/new_process")->setErrorReader($error_reader)->setFrame(true)->setWidth(350)->setAutoHeight(true)->setTitle("Datos del usuario")->setMethod(PhpExt_Form_FormPanel::METHOD_POST);
//marco para contenener los controles
$marco = new PhpExt_Form_FieldSet();
$marco->setDefaults(new PhpExt_Config_ConfigObject(array("width" => 210)))->setAutoHeight(true);
//se agregan todos los controles al marco
$marco->addItem($txt_usuario);
$marco->addItem($txt_password);
$marco->addItem($txt_repetir);
$marco->addItem($txt_email);
//se agrega el marco al formulario
$frm_nuevo_usuario->addItem($marco);
//se agregan los botones al formulario
$frm_nuevo_usuario->addButton($btn_grabar);
$frm_nuevo_usuario->addButton(PhpExt_Button::createTextButton("Cancelar"));
//RESULTADO
$obj_comunication = new OOB_ext_comunication();
$obj_comunication->set_data($frm_nuevo_usuario->getJavascript(false, "contenido"));
$obj_comunication->send(true);
示例#10
0
//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);
$marco->addItem($opt_group_predeterminada);
$marco->addItem($select_idioma);
//AGREGO EL MARCO AL FORMULARIO
$frm_new_currency->addItem($marco);
//AGREGO LOS BOTONES AL FORMULARIO
$frm_new_currency->addButton($save_button);
$frm_new_currency->addButton(PhpExt_Button::createTextButton("Cancelar"));
//RESULTADO
$obj_comunication = new OOB_ext_comunication();
$obj_comunication->set_data($frm_new_currency->getJavascript(false, "contenido"));
$obj_comunication->send(true);