Esempio n. 1
0
 /**
  * Helper function to create an NumberField.  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).
  * @return PhpExt_Form_NumberField
  */
 public static function createNumberField($name, $label = null, $id = null)
 {
     $c = new PhpExt_Form_NumberField();
     $c->setName($name);
     if ($label !== null) {
         $c->setFieldLabel($label);
     }
     if ($id !== null) {
         $c->setId($id);
     }
     return $c;
 }
Esempio n. 2
0
include_once 'PhpExt/Form/DateField.php';
include_once 'PhpExt/Form/NumberField.php';
include_once 'PhpExtUx/App/FitToParent.php';
global $ari;
$ari->popup = 1;
// no mostrar el main_frame
$separador_decimal = trim($ari->locale->get('decimal', 'numbers'));
$store = new PhpExt_Data_JsonStore();
$store->setUrl("/currency/currency/get_currencys_change")->setRoot("topics")->setTotalProperty("totalCount");
//AGREGO LOS CAMPOS AL STORE
$store->addField(new PhpExt_Data_FieldConfigObject("id"));
$store->addField(new PhpExt_Data_FieldConfigObject("currency"));
$store->addField(new PhpExt_Data_FieldConfigObject("value"));
$store->addField(new PhpExt_Data_FieldConfigObject("date"));
$store->addField(new PhpExt_Data_FieldConfigObject("new"));
$txt_nuevo_valor = new PhpExt_Form_NumberField();
$txt_nuevo_valor->setDecimalSeparator($separador_decimal)->setMsgTarget(PhpExt_Form_FormPanel::MSG_TARGET_SIDE);
//AGREGO LAS COLUMNAS A LA GRILLA
$col_model = new PhpExt_Grid_ColumnModel();
$col_model->addColumn(PhpExt_Grid_ColumnConfigObject::createColumn("Id", "id", null, 35));
$col_model->addColumn(PhpExt_Grid_ColumnConfigObject::createColumn("Moneda", "currency"));
$col_model->addColumn(PhpExt_Grid_ColumnConfigObject::createColumn("Ultimo Valor", "value"));
$col_model->addColumn(PhpExt_Grid_ColumnConfigObject::createColumn("Fecha", "date", null, 110));
$col_model->addColumn(PhpExt_Grid_ColumnConfigObject::createColumn("Nuevo Valor", "new")->setEditor($txt_nuevo_valor));
$paging = new PhpExt_Toolbar_PagingToolbar();
$paging->setStore($store)->setDisplayInfo(true)->setEmptyMessage("No tiene monedas flotantes para definir el tipo de cambio");
//GRILLA
$grid = new PhpExt_Grid_EditorGridPanel();
$grid->setStore($store)->setColumnModel($col_model)->setSelectionModel(new PhpExt_Grid_RowSelectionModel())->setLoadMask(true)->setenableColLock(false);
$grid->setBottomToolbar($paging);
$grid->getPlugins()->add(new PhpExtUx_App_FitToParent());
Esempio n. 3
0
$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();
Esempio n. 4
0
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();
Esempio n. 5
0
$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);
}