public function __construct() { parent::__construct(); $this->setExtClassInfo("Ext.ux.MaskFormattedTextField", "MaskFormattedTextField"); $validProps = array("mask"); $this->addValidConfigProperties($validProps); }
/** * Helper function to create a TextField. Useful for quick adding it to a ComponentCollection * * @param string $name The field's HTML name attribute. * @param string $label The label text to display next to this field (defaults to '') * @param string $id The unique id of this component (defaults to an auto-assigned id). * @param string $vtype A validation type name as defined in PhpExt_Form_FormPanel. i.e. {@link PhpExt_Form_FormPanel::VTYPE_EMAIL} * @uses PhpExt_Form_FormPanel::VTYPE_ALPHAMASK * @uses PhpExt_Form_FormPanel::VTYPE_ALPHANUM * @uses PhpExt_Form_FormPanel::VTYPE_EMAIL * @uses PhpExt_Form_FormPanel::VTYPE_URL * @return PhpExt_Form_TextField */ public static function createTextField($name, $label = null, $id = null, $vtype = null) { $c = new PhpExt_Form_TextField(); $c->setName($name); if ($label !== null) { $c->setFieldLabel($label); } if ($id !== null) { $c->setId($id); } if ($vtype !== null) { $c->setVType($vtype); } return $c; }
$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"));
public function __construct() { parent::__construct(); $this->setExtClassInfo("Ext.form.NumberField", "numberfield"); $validProps = array("allowDecimals", "allowNegative", "baseChars", "decimalPrecision", "decimalSeparator", "fieldClass", "maxText", "maxValue", "minText", "minValue", "nanText"); $this->addValidConfigProperties($validProps); }
// Script que genera el FORM NUEVO ROL if (!seguridad::isAllowed(seguridad_action::nameConstructor('new', 'role', 'seguridad'))) { throw new OOB_exception("Acceso Denegado", "403", "Acceso Denegado. Consulte con su Administrador!", true); } PhpExt_Javascript::sendContentType(); global $ari; $ari->popup = 1; // no mostrar el main_frame $field_width = 180; //ancho de los controles $grid_id = ''; if (isset($_POST['gid'])) { $grid_id = $_POST['gid']; } //creacion de controles $txt_nombre = PhpExt_Form_TextField::createTextField("txt_nombre", "Nombre")->setMsgTarget(PhpExt_Form_FormPanel::MSG_TARGET_SIDE)->setWidth($field_width); $txt_descripcion = PhpExt_Form_TextArea::createTextArea("txt_descripcion", "Descripción")->setMsgTarget(PhpExt_Form_FormPanel::MSG_TARGET_SIDE)->setWidth($field_width); $chk_anonimo = PhpExt_Form_Checkbox::createCheckbox("chk_anonimo", "Anónimo")->setMsgTarget(PhpExt_Form_FormPanel::MSG_TARGET_SIDE)->setWidth($field_width); $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);
public function __construct() { parent::__construct(); $this->setExtClassInfo("Ext.form.TextArea", "textarea"); $validProps = array("autoCreate", "growMax", "growMin", "preventScrollbars"); $this->addValidConfigProperties($validProps); }
public function __construct() { parent::__construct(); $this->setExtClassInfo("Ext.form.TriggerField", "trigger"); $validProps = array("autoCreate", "hideTrigger", "triggerClass"); $this->addValidConfigProperties($validProps); }
$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"));
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());
$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')")));
public function __construct() { parent::__construct(); $this->setAutoCreate(new PhpExt_Config_ConfigObject(array('tag' => 'input', 'type' => 'password', 'size' => '20', 'autocomplete' => 'off'))); }
// no mostrar el main_frame $field_width = 180; //ancho de los controles $grid_id = ''; if (isset($_POST['gid'])) { $grid_id = $_POST['gid']; } //creacion de controles //usuario $txt_usuario = PhpExt_Form_TextField::createTextField("txt_usuario", "Usuario")->setWidth($field_width)->setMsgTarget(PhpExt_Form_FormPanel::MSG_TARGET_SIDE); //password $txt_password = PhpExt_Form_PasswordField::createPasswordField("txt_pass", "Contraseña")->setMsgTarget(PhpExt_Form_FormPanel::MSG_TARGET_SIDE)->setWidth($field_width); //repetir password $txt_repetir = PhpExt_Form_PasswordField::createPasswordField("txt_repetir", "Repetir")->setMsgTarget(PhpExt_Form_FormPanel::MSG_TARGET_SIDE)->setWidth($field_width); //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);
include_once 'PhpExt/Grid/EditorGridPanel.php'; include_once 'PhpExt/Form/TextField.php'; include_once 'PhpExt/Form/NumberField.php'; include_once 'PhpExt/Form/DateField.php'; include_once 'PhpExt/Form/ComboBox.php'; 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);
include_once 'PhpExtUx/Multiselect/Itemselector.php'; global $ari; $ari->popup = 1; // no mostrar el main_frame $field_width = 180; //ancho de los controles $separador_decimal = trim($ari->locale->get('decimal', 'numbers')); $grid_id = ''; if (isset($_POST['gid'])) { $grid_id = $_POST['gid']; } //CREACION DE LOS CONTROLES //MONEDA $txt_moneda = PhpExt_Form_TextField::createTextField("txt_moneda", "Moneda")->setMsgTarget(PhpExt_Form_FormPanel::MSG_TARGET_SIDE)->setWidth($field_width); //SIGNO $txt_signo = PhpExt_Form_TextField::createTextField("txt_signo", "Signo")->setMsgTarget(PhpExt_Form_FormPanel::MSG_TARGET_SIDE)->setWidth($field_width); //TIPO DE CAMBIO $opt_tipo_fijo = new PhpExt_Form_Radio(); $opt_tipo_fijo->setBoxLabel("Fijo")->setValue("fixed")->setName("opt-tipo-cambio"); $opt_tipo_flotante = new PhpExt_Form_Radio(); $opt_tipo_flotante->setBoxLabel("Flotante")->setValue("float")->setName("opt-tipo-cambio"); $opt_tipo_flotante->setChecked(true); $opt_group_tipo_cambio = new PhpExt_Form_RadioGroup(); $opt_group_tipo_cambio->setfieldLabel("Tipo de cambio"); $opt_group_tipo_cambio->addItem($opt_tipo_fijo); $opt_group_tipo_cambio->addItem($opt_tipo_flotante); $group_render = "\n\nvar formulario = this.findParentByType('form');\nvar group = formulario.findBy( function(c){ return ( c.xtype == 'radiogroup' );} );\nopt = this.items.items[0];\t\nvar opt2 = this.items.items[1];\t\n\nopt.on( 'check' , function(t,n,o){\n\tvar field = formulario.getForm().findField('txt_valor');\n\tif( !group[1].items.items[0].getValue() ){ \n\t\tif( t.getValue() )\n\t\t{\n\t\t\tfield.enable();\n\t\t\tfield.focus(true);\t\n\t\t}\n\t\telse\n\t\t{\n\t\t\tfield.setValue('1');\n\t\t\tfield.disable();\t\t\n\t\t}\n\t}\n});\n\nopt2.on( 'check', function(t,n,o){\n\nif( group[1].items.items[0].getValue() ){ \n\tt.setValue(false);\n\topt.setValue(true);\n}\n\n});\n\n"; $opt_group_tipo_cambio->attachListener("render", new PhpExt_Listener(PhpExt_Javascript::functionDef(null, $group_render, array("group")))); $opt_tipo_fijo->setEnableKeyEvents(true); //VALOR DE LA MONEDA $txt_valor = PhpExt_Form_NumberField::createNumberField("txt_valor", "Valor")->setMsgTarget(PhpExt_Form_FormPanel::MSG_TARGET_SIDE)->setDecimalSeparator($separador_decimal)->setValue(1)->setDisabled(true)->setWidth($field_width);
$grid_id = ''; if (isset($_POST['gid'])) { $grid_id = $_POST['gid']; } //CREO EL OBJECTO MONEDA CON EL ID QUE ME PASAN if (isset($_POST['id'])) { $currency = new currency_currency($_POST["id"]); } else { throw new OOB_Exception_400("La variable [id] no esta definida"); } PhpExt_Javascript::sendContentType(); //CREACION DE LOS CONTROLES //MONEDA $txt_moneda = PhpExt_Form_TextField::createTextField("txt_moneda", "Moneda")->setMsgTarget(PhpExt_Form_FormPanel::MSG_TARGET_SIDE)->setWidth($field_width)->setValue($currency->get("name")); //SIGNO $txt_signo = PhpExt_Form_TextField::createTextField("txt_signo", "Signo")->setMsgTarget(PhpExt_Form_FormPanel::MSG_TARGET_SIDE)->setWidth($field_width)->setValue($currency->get("sign")); //TIPO DE CAMBIO $opt_tipo_fijo = new PhpExt_Form_Radio(); $opt_tipo_fijo->setBoxLabel("Fijo")->setInputValue("fixed")->setName("opt-tipo-cambio"); if ($currency->get("type") == "1") { $opt_tipo_fijo->setChecked(true); } $opt_tipo_flotante = new PhpExt_Form_Radio(); $opt_tipo_flotante->setBoxLabel("Flotante")->setInputValue("float")->setName("opt-tipo-cambio"); $opt_group_tipo_cambio = new PhpExt_Form_RadioGroup(); $opt_group_tipo_cambio->setfieldLabel("Tipo de cambio"); $opt_group_tipo_cambio->addItem($opt_tipo_fijo); $opt_group_tipo_cambio->addItem($opt_tipo_flotante); $group_render = "\n\nvar formulario = this.findParentByType('form');\nvar group = formulario.findBy( function(c){ return ( c.xtype == 'radiogroup' );} );\nvar opt = this.items.items[0];\t\nvar opt2 = this.items.items[1];\t\n\nopt.on( 'check' , function(t,n,o){\n\n\tvar field = formulario.getForm().findField('txt_valor');\n\tif( !group[1].items.items[0].getValue() ){ \n\t\tif( t.getValue() )\n\t\t{\n\t\t\tfield.enable();\n\t\t\tfield.focus(true);\t\n\t\t}\n\t\telse\n\t\t{\n\t\t\tfield.setValue('1');\n\t\t\tfield.disable();\t\t\n\t\t\t\n\t\t}\n\t}\n\t\n});\n\n\nopt2.on( 'check', function(t,n,o){\n\nif( group[1].items.items[0].getValue() ){ \n\tt.setValue(false);\n\topt.setValue(true);\n}\n\n});\n\n"; $opt_group_tipo_cambio->attachListener("render", new PhpExt_Listener(PhpExt_Javascript::functionDef(null, $group_render, array("group")))); $opt_tipo_fijo->setEnableKeyEvents(true);