$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); //MONEDA PREDETERMINADA $opt_predeterminada_si = new PhpExt_Form_Radio(); $opt_predeterminada_si->setBoxLabel("Si")->setValue("yes")->setName("opt-predeterminada"); $opt_predeterminada_no = new PhpExt_Form_Radio(); $opt_predeterminada_no->setBoxLabel("No")->setValue("no")->setName("opt-predeterminada"); $opt_predeterminada_no->setChecked(true); $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();
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); // Reader $reader = new PhpExt_Data_XmlReader();
$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); //VALOR DE LA MONEDA $txt_valor = PhpExt_Form_NumberField::createNumberField("txt_valor", "Valor")->setMsgTarget(PhpExt_Form_FormPanel::MSG_TARGET_SIDE)->setWidth($field_width)->setDecimalSeparator($separador_decimal)->setValue($currency->get("value")); if ($currency->get("type") == "2") { $opt_tipo_flotante->setChecked(true); $txt_valor->setDisabled(true); } //MONEDA PREDETERMINADA $opt_predeterminada_si = new PhpExt_Form_Radio(); $opt_predeterminada_si->setBoxLabel("Si")->setInputValue("yes")->setName("opt-predeterminada"); if ($currency->get("default") == "1") { $opt_predeterminada_si->setChecked(true); } $opt_predeterminada_no = new PhpExt_Form_Radio(); $opt_predeterminada_no->setBoxLabel("No")->setInputValue("no")->setName("opt-predeterminada"); if ($currency->get("default") == "0") { $opt_predeterminada_no->setChecked(true); }