/**
  * on ChangeRadio change
  * @param $param Action parameters
  */
 public static function onChangeRadio($param)
 {
     if ($param['enable'] == 1) {
         TCombo::enableField('form_enable_disable', 'block1_combo');
         TEntry::enableField('form_enable_disable', 'block1_entry');
         TSpinner::enableField('form_enable_disable', 'block1_spinner');
         TDate::disableField('form_enable_disable', 'block2_date');
         TEntry::disableField('form_enable_disable', 'block2_entry');
         TCheckGroup::disableField('form_enable_disable', 'block2_check');
         TDate::clearField('form_enable_disable', 'block2_date');
         TEntry::clearField('form_enable_disable', 'block2_entry');
         TCheckGroup::clearField('form_enable_disable', 'block2_check');
     } else {
         TCombo::disableField('form_enable_disable', 'block1_combo');
         TEntry::disableField('form_enable_disable', 'block1_entry');
         TSpinner::disableField('form_enable_disable', 'block1_spinner');
         TDate::enableField('form_enable_disable', 'block2_date');
         TEntry::enableField('form_enable_disable', 'block2_entry');
         TCheckGroup::enableField('form_enable_disable', 'block2_check');
         TCombo::clearField('form_enable_disable', 'block1_combo');
         TEntry::clearField('form_enable_disable', 'block1_entry');
         TSpinner::clearField('form_enable_disable', 'block1_spinner');
     }
 }
 /**
  * Class constructor
  * Creates the page
  */
 function __construct()
 {
     parent::__construct();
     // create the notebook
     $notebook = new TNotebook(620, 340);
     // create the form
     $this->form = new TForm();
     // creates the notebook page
     $table = new TTable();
     // add the notebook inside the form
     $this->form->add($table);
     // adds the notebook page
     $notebook->appendPage('Input elements', $this->form);
     // create the form fields
     $field1 = new TEntry('field1');
     $field2 = new TEntry('field2');
     $field3 = new TEntry('field3');
     $field4 = new TEntry('field4');
     $field5 = new TPassword('field5');
     $field6 = new TDate('field6');
     $field7 = new TSpinner('field7');
     $field8 = new TSlider('field8');
     $field9 = new TText('field9');
     $field1->setTip('Tip for field 1');
     $field2->setTip('Tip for field 2');
     $field3->setTip('Tip for field 3');
     $field4->setTip('Tip for field 4');
     $field5->setTip('Tip for field 5');
     $field6->setTip('Tip for field 6');
     $field7->setTip('Tip for field 7');
     $field8->setTip('Tip for field 8');
     $field9->setTip('Tip for field 9');
     $field2->setValue('123');
     $field2->setEditable(FALSE);
     $field3->setMask('99.999-999');
     $field4->setMaxLength(10);
     $field6->setSize(100);
     $field7->setRange(0, 100, 10);
     $field8->setRange(0, 100, 10);
     $field7->setValue(30);
     $field8->setValue(50);
     $field9->setSize(300, 50);
     // add rows for the fields
     $table->addRowSet(new TLabel('TEntry object:'), $field1);
     $table->addRowSet(new TLabel('TEntry not editable:'), $field2);
     $table->addRowSet(new TLabel('TEntry with mask:'), $field3, new TLabel('99.999-999'));
     $table->addRowSet(new TLabel('TEntry with maxlength (10):'), $field4);
     $table->addRowSet(new TLabel('TPassword object:'), $field5);
     $table->addRowSet(new TLabel('TDate Object:'), $field6);
     $table->addRowSet(new TLabel('Spinner Object:'), $field7);
     $table->addRowSet(new TLabel('Slider Object:'), $field8);
     $table->addRowSet(new TLabel('TText Object:'), $field9);
     // creates the action button
     $button1 = new TButton('action1');
     // define the button action
     $button1->setAction(new TAction(array($this, 'onSave')), 'Save');
     $button1->setImage('ico_save.png');
     // define wich are the form fields
     $this->form->setFields(array($field1, $field2, $field3, $field4, $field5, $field6, $field7, $field8, $field9, $button1));
     // add a row for the button
     $row = $table->addRow();
     $row->addCell($button1);
     // wrap the page content using vertical box
     $vbox = new TVBox();
     $vbox->add(new TXMLBreadCrumb('menu.xml', __CLASS__));
     $vbox->add($notebook);
     parent::add($vbox);
 }
 /**
  * 
  */
 public function makeTSpinner($properties)
 {
     $widget = new TSpinner((string) $properties->{'name'});
     $widget->setRange((int) $properties->{'min'}, (int) $properties->{'max'}, (int) $properties->{'step'});
     $widget->setValue((string) $properties->{'value'});
     $widget->setSize((int) $properties->{'width'});
     if (isset($properties->{'tip'})) {
         $widget->setTip((string) $properties->{'tip'});
     }
     $widget->setEditable((string) $properties->{'editable'});
     $this->fields[] = $widget;
     $this->fieldsByName[(string) $properties->{'name'}] = $widget;
     return $widget;
 }
 /**
  * Class constructor
  * Creates the page
  */
 function __construct()
 {
     parent::__construct();
     // create the notebook
     $notebook = new TNotebook(620, 410);
     // create the form
     $this->form = new TForm();
     // creates the notebook page
     $table = new TTable();
     // add the notebook inside the form
     $this->form->add($table);
     // adds the notebook page
     $notebook->appendPage('Input elements', $this->form);
     // create the form fields
     $field1 = new TEntry('field1');
     $field2 = new TEntry('field2');
     $field3 = new TEntry('field3');
     $field4 = new TEntry('field4');
     $field5 = new TEntry('field5');
     $field6 = new TPassword('field6');
     $field7 = new TDate('field7');
     $field8 = new TSpinner('field8');
     $field9 = new TSlider('field9');
     $field10 = new TText('field10');
     $field1->setTip('Tip for field 1');
     $field2->setTip('Tip for field 2');
     $field3->setTip('Tip for field 3');
     $field4->setTip('Tip for field 4');
     $field5->setTip('Tip for field 5');
     $field6->setTip('Tip for field 6');
     $field7->setTip('Tip for field 7');
     $field8->setTip('Tip for field 8');
     $field9->setTip('Tip for field 9');
     $field10->setTip('Tip for field 10');
     $field2->setValue('123');
     $field2->setEditable(FALSE);
     $field3->setMask('99.999-999');
     $field4->setMaxLength(10);
     $field5->setCompletion(array('Allen', 'Albert', 'Alberto', 'Alladin'));
     $field7->setSize(100);
     $field8->setRange(0, 100, 10);
     $field9->setRange(0, 100, 10);
     $field8->setValue(30);
     $field9->setValue(50);
     $field10->setSize(300, 80);
     // add a row for one field
     $row = $table->addRow();
     $row->addCell(new TLabel('TEntry object:'));
     $cell = $row->addCell($field1);
     // add a row for one field
     $row = $table->addRow();
     $row->addCell(new TLabel('TEntry not editable:'));
     $cell = $row->addCell($field2);
     // add a row for one field
     $row = $table->addRow();
     $row->addCell(new TLabel('TEntry with mask:'));
     $cell = $row->addCell($field3);
     $cell = $row->addCell(new TLabel('99.999-999'));
     // add a row for one field
     $row = $table->addRow();
     $row->addCell(new TLabel('TEntry with maxlength (10):'));
     $cell = $row->addCell($field4);
     // add a row for one field
     $row = $table->addRow();
     $row->addCell(new TLabel('TEntry with completion (a..):'));
     $cell = $row->addCell($field5);
     // add a row for one field
     $row = $table->addRow();
     $row->addCell(new TLabel('TPassword object:'));
     $cell = $row->addCell($field6);
     // add a row for one field
     $row = $table->addRow();
     $row->addCell(new TLabel('TDate Object:'));
     $cell = $row->addCell($field7);
     // add a row for one field
     $row = $table->addRow();
     $row->addCell(new TLabel('Spinner Object:'));
     $cell = $row->addCell($field8);
     // add a row for one field
     $row = $table->addRow();
     $row->addCell(new TLabel('Slider Object:'));
     $cell = $row->addCell($field9);
     // add a row for one field
     $row = $table->addRow();
     $row->addCell(new TLabel('TText Object:'));
     $cell = $row->addCell($field10);
     // creates the action button
     $button1 = new TButton('action1');
     // define the button action
     $button1->setAction(new TAction(array($this, 'onSave')), 'Save');
     $button1->setImage('ico_save.png');
     // define wich are the form fields
     $this->form->setFields(array($field1, $field2, $field3, $field4, $field5, $field6, $field7, $field8, $field9, $field10, $button1));
     // add a row for the button
     $row = $table->addRow();
     $row->addCell($button1);
     // add the form inside the page
     parent::add($notebook);
 }
Example #5
0
 /**
  * Class constructor
  * Creates the page and the registration form
  */
 function __construct()
 {
     parent::__construct();
     // creates the form
     $this->form = new TForm('form_crm');
     // creates a table
     $table = new TTable();
     $table_contact = new TTable();
     $table_skill = new TTable();
     $notebook = new TNotebook(500, 500);
     // add the notebook inside the form
     $this->form->add($notebook);
     $notebook->appendPage('Cadastro Cliente', $table);
     // $notebook->appendPage('Cidade', $table_contact);
     //        $notebook->appendPage('Skill (aggregation)', $table_skill);
     // create the form fields
     $code = new TEntry('id');
     $projeto_id = new TDBCombo('projeto_id', 'db_crmbf', 'Projeto', 'id', 'nome');
     $titulo = new TEntry('titulo');
     $data = new TEntry('data');
     $data->setEditable(false);
     $responsavel_id = new TDBCombo('responsavel_id', 'db_crmbf', 'user', 'id', 'name');
     $tempo = new TSpinner('tempo');
     $porcentagem = new TSlider('porcentagem');
     $descricao = new TText('descricao');
     $tipo_id = new TDBCombo('tipo_id', 'db_crmbf', 'Tipo', 'id', 'nome');
     $cliente_id = new TDBCombo('cliente_id', 'db_crmbf', 'Cliente', 'id', 'nome');
     $prioridade_id = new TDBCombo('prioridade_id', 'db_crmbf', 'Prioridade', 'id', 'nome');
     $status_id = new TDBCombo('status_id', 'db_crmbf', 'Status', 'id', 'nome');
     $usuarioalteracao = new THidden('usuarioalteracao');
     $solicitante = new TEntry('solicitante');
     // add field validators
     $titulo->addValidation('Nome', new TRequiredValidator());
     // $cidade_id->addValidation('Cidade', new TRequiredValidator);
     // $birthdate->addValidation('Birthdate', new TRequiredValidator);
     //        $cidade_id->addValidation('Category', new TRequiredValidator);
     //$obj = new CidadeFormList;
     //$cidade_id->setAction(new TAction(array($obj, 'onReload')));
     //        $itemGender = array();
     //        $itemGender['M'] = 'Male';
     //        $itemGender['F'] = 'Female';
     //        // add the combo options
     //        $gender->addItems($itemGender);
     //        $gender->setLayout('horizontal');
     //
     //        $itemStatus = array();
     //        $itemStatus['S'] = 'Single';
     //        $itemStatus['C'] = 'Committed';
     //        $itemStatus['M'] = 'Married';
     //        $status->addItems($itemStatus);
     // define some properties for the form fields
     $code->setEditable(FALSE);
     $code->setSize(100);
     $projeto_id->setSize(320);
     $titulo->setSize(320);
     $data->setSize(160);
     $data->setValue(date("d/m/Y H:i:s"));
     $responsavel_id->setSize(160);
     $tempo->setRange(0, 1000, 1);
     $tempo->setSize(160);
     $porcentagem->setRange(0, 100, 1);
     $porcentagem->setSize(150);
     $porcentagem->setTip('Porcentagem %');
     $descricao->setSize(320);
     $tipo_id->setSize(150);
     $cliente_id->setSize(150);
     $prioridade_id->setSize(150);
     $status_id->setSize(150);
     $solicitante->setSize(150);
     $row = $table->addRow();
     $row->addCell(new TLabel('Code:'));
     $row->addCell($code);
     // add a row for the field name
     $row = $table->addRow();
     $row->addCell(new TLabel('Projeto:'));
     $cell = $row->addCell($projeto_id);
     // add a row for the field name
     $row = $table->addRow();
     $row->addCell(new TLabel('Titulo:'));
     $cell = $row->addCell($titulo);
     // add a row for the field Email
     $row = $table->addRow();
     $row->addCell(new TLabel('Data:'));
     $cell = $row->addCell($data);
     // add a row for the field Telefone
     $row = $table->addRow();
     $row->addCell(new TLabel('Responsavel:'));
     $cell = $row->addCell($responsavel_id);
     // add a row for the field celular
     $row = $table->addRow();
     $row->addCell(new TLabel('Tempo:'));
     $cell = $row->addCell($tempo);
     // add a row for the field skype
     $row = $table->addRow();
     $row->addCell(new TLabel('Porcentagem:'));
     $cell = $row->addCell($porcentagem);
     // add a row for the field endereco
     $row = $table->addRow();
     $row->addCell(new TLabel('Tipo:'));
     $row->addCell($tipo_id);
     // add a row for the field endereco
     $row = $table->addRow();
     $row->addCell(new TLabel('Cliente:'));
     $row->addCell($cliente_id);
     // add a row for the field endereco
     $row = $table->addRow();
     $row->addCell(new TLabel('Prioridade:'));
     $row->addCell($prioridade_id);
     // add a row for the field endereco
     $row = $table->addRow();
     $row->addCell(new TLabel('Solicitante:'));
     $row->addCell($solicitante);
     // add a row for the field endereco
     $row = $table->addRow();
     $row->addCell(new TLabel('Descrição:'));
     $row->addCell($descricao);
     // add a row for the field celular
     $row = $table->addRow();
     $row->addCell(new TLabel('Status:'));
     $cell = $row->addCell($status_id);
     // add a row for the field Category
     //        $row = $table_data->addRow();
     //        $row->addCell(new TLabel('Cidade:'));
     //        $cell = $row->addCell($cidade_id);
     // add a row for the field city
     //        $row=$table_data->addRow();
     //        $row->addCell(new TLabel('Cidade:'));
     //        $cell = $row->addCell($cidade_id);
     /*
             // add a row for the field Phone
             $row = $table_data->addRow();
             $row->addCell(new TLabel('Phone:'));
             $row->addCell($phone);
     
             // add a row for the field BirthDate
             $row->addCell(new TLabel('BirthDate:'));
             $row->addCell($birthdate);
     
             // add a row for the field status
             $row = $table_data->addRow();
             $row->addCell(new TLabel('Status:'));
             $cell = $row->addCell($status);
     
             // add a row for the field Email
             $row->addCell(new TLabel('Email:'));
             $cell = $row->addCell($email);
     
             // add a row for the field gender
             $row->addCell(new TLabel('Gender:'));
             $row->addCell($gender);
     
             $row = $table_contact->addRow();
             $cell = $row->addCell(new TLabel('<b>Contact</b>'));
             $cell->valign = 'top';
     
             // add two fields inside the multifield in the second sheet
             $contacts_list->setHeight(100);
             $contacts_list->setClass('Contact'); // define the returning class
             $contacts_list->addField('type', 'Contact Type: ', new TEntry('type'), 200);
             $contacts_list->addField('value', 'Contact Value: ', new TEntry('value'), 200);
             $row = $table_contact->addRow();
             $row->addCell($contacts_list);
     
             // create the radio button for the skills list
             $skill_list = new TDBCheckGroup('skill_list', 'samples', 'Skill', 'id', 'name');
             $table_skill->addRow()->addCell($lbl = new TLabel('Skills'));
             $table_skill->addRow()->addCell($skill_list);
             $lbl->setFontStyle('b');
             
     * 
     */
     // create an action button
     $button1 = new TButton('action1');
     $button1->setAction(new TAction(array($this, 'onSave')), 'Save');
     $button1->setImage('ico_save.png');
     //create an action button (go to list)
     $button2 = new TButton('list');
     $button2->setAction(new TAction(array('CRMList', 'onReload')), 'Ir para Listagem');
     $button2->setImage('ico_datagrid.gif');
     // define wich are the form fields
     $this->form->setFields(array($code, $projeto_id, $titulo, $data, $responsavel_id, $tempo, $porcentagem, $descricao, $tipo_id, $cliente_id, $prioridade_id, $status_id, $usuarioalteracao, $solicitante, $button1, $button2));
     $subtable = new TTable();
     $row = $subtable->addRow();
     $row->addCell($button1);
     $row->addCell($button2);
     $table_layout = new TTable();
     $table_layout->addRow()->addCell($this->form);
     $table_layout->addRow()->addCell($subtable);
     // add the form inside the page
     parent::add($table_layout);
 }