コード例 #1
0
 /**
  * Show the widget at the screen
  */
 public function show()
 {
     // include the needed libraries and styles
     if ($this->fields) {
         $table = new TTable();
         $mdr = array();
         // mandatory
         $fields = array();
         $i = 0;
         foreach ($this->fields as $name => $obj) {
             $row = $table->addRow();
             $label = new TLabel($obj->text);
             if ($obj->inform) {
                 $row->addCell($label);
                 $row->addCell($obj->field);
             }
             $fields[] = $name;
             $post_fields[$name] = 1;
             $obj->field->setName($this->name . '_' . $name);
             if (get_class($obj->field) == 'TComboCombined') {
                 $fields[] = $obj->field->getTextName();
                 $obj->field->setTextName($this->name . '_' . $obj->field->getTextName());
                 $i++;
             }
             $i++;
         }
         $table->show();
     }
     // check whether the widget is non-editable
     if (parent::getEditable()) {
         // create three buttons to control the MultiField
         $add = new TButton("{$this->name}btnStore");
         $add->setLabel(TAdiantiCoreTranslator::translate('Register'));
         //$add->setName("{$this->name}btnStore");
         $add->setImage('ico_save.png');
         $add->addFunction("mtf{$this->name}.addRowFromFormFields()");
         $del = new TButton("{$this->name}btnDelete");
         $del->setLabel(TAdiantiCoreTranslator::translate('Delete'));
         $del->setImage('ico_delete.png');
         $can = new TButton("{$this->name}btnCancel");
         $can->setLabel(TAdiantiCoreTranslator::translate('Cancel'));
         $can->setImage('ico_close.png');
         $table = new TTable();
         $row = $table->addRow();
         $row->addCell($add);
         $row->addCell($del);
         $row->addCell($can);
         $table->show();
     }
     // create the MultiField Panel
     $panel = new TElement('div');
     $panel->{'class'} = "multifieldDiv";
     $input = new THidden($this->name);
     $panel->add($input);
     // create the MultiField DataGrid Header
     $table = new TTable();
     $table->id = "{$this->name}mfTable";
     $head = new TElement('thead');
     $table->add($head);
     $row = new TTableRow();
     $head->add($row);
     // fill the MultiField DataGrid
     foreach ($this->fields as $obj) {
         $c = $obj->text;
         if (get_class($obj->field) == 'TComboCombined') {
             $row->addCell('ID');
         }
         $cell = $row->addCell($c);
         $cell->width = $obj->size . 'px';
     }
     $body = new TElement('tbody');
     $table->add($body);
     if ($this->objects) {
         foreach ($this->objects as $obj) {
             if (isset($obj->id)) {
                 $row = new TTableRow();
                 $row->dbId = $obj->id;
                 $body->add($row);
             } else {
                 $row = new TTableRow();
                 $body->add($row);
             }
             foreach ($fields as $name) {
                 $cell = $row->addCell(is_null($obj->{$name}) ? '' : $obj->{$name});
                 if (isset($this->fields[$name]->size)) {
                     $cell->style = 'width:' . $this->fields[$name]->size . 'px';
                 }
             }
         }
     }
     $panel->add($table);
     $panel->show();
     echo '<script type="text/javascript">';
     echo "var mtf{$this->name};";
     //echo '$(document).ready(function() {';
     echo "mtf{$this->name} = new MultiField('{$this->name}mfTable',{$this->width},{$this->height});\n";
     $s = implode("','", $fields);
     echo "mtf{$this->name}.formFieldsAlias = Array('{$s}');\n";
     $fields = implode("','{$this->name}_", $fields);
     echo "mtf{$this->name}.formFieldsName = Array('{$this->name}_{$fields}');\n";
     echo "mtf{$this->name}.formPostFields = Array();\n";
     foreach ($post_fields as $col => $value) {
         echo "mtf{$this->name}.formPostFields['{$col}'] = '{$value}';\n";
     }
     $mdr = implode(',', $mdr);
     echo "mtf{$this->name}.formFieldsMandatory = Array({$mdr});\n";
     echo "mtf{$this->name}.storeButton  = document.getElementsByName('{$this->name}btnStore')[0];\n";
     echo "mtf{$this->name}.deleteButton = document.getElementsByName('{$this->name}btnDelete')[0];\n";
     echo "mtf{$this->name}.cancelButton = document.getElementsByName('{$this->name}btnCancel')[0];\n";
     echo "mtf{$this->name}.inputResult  = document.getElementsByName('{$this->name}')[0];\n";
     //echo '});';
     echo '</script>';
 }
コード例 #2
0
 /**
  * Class constructor
  * Creates the page and the registration form
  */
 function __construct()
 {
     parent::__construct();
     // creates the form
     $this->form = new TForm('form_Ticket');
     $this->form->class = 'tform';
     // CSS class
     $table = new TTable();
     $table->style = 'width: 600px';
     $tablePagamento = new TTable();
     $tablePagamento->style = 'width: 600px';
     $notebook = new TNotebook(600, 650);
     $notebook->appendPage('Ticket - Cadastramento', $table);
     $notebook->appendPage('Ticket - Orçamento / Pagamento', $tablePagamento);
     // create the form fields
     $id = new TEntry('id');
     $id->setEditable(FALSE);
     $titulo = new TEntry('titulo');
     $origem = new TCombo('origem');
     $combo_origem = array();
     $combo_origem['I'] = 'Interno';
     $combo_origem['E'] = 'Externo';
     $origem->addItems($combo_origem);
     $origem->setDefaultOption(FALSE);
     $solicitacao_descricao = new TText('solicitacao_descricao');
     $providencia = new TText('providencia');
     $orcamento_horas = new TEntry('orcamento_horas');
     $orcamento_horas->setMask('999999');
     $orcamento_valor_hora = new TEntry('orcamento_valor_hora');
     $orcamento_valor_hora->setNumericMask(2, ',', '.');
     $valor_desconto = new TEntry('valor_desconto');
     $valor_desconto->setNumericMask(2, ',', '.');
     $valor_total = new TEntry('valor_total');
     $valor_total->setNumericMask(2, ',', '.');
     $valor_total->setEditable(FALSE);
     $forma_pagamento = new TEntry('forma_pagamento');
     $data_ultimo_pgto = new TEntry('data_ultimo_pgto');
     $data_ultimo_pgto->setEditable(FALSE);
     $valor_ultimo_pgto = new TEntry('valor_ultimo_pgto');
     $valor_ultimo_pgto->setNumericMask(2, ',', '.');
     $valor_ultimo_pgto->setEditable(FALSE);
     $valor_total_pago = new TEntry('valor_total_pago');
     $valor_total_pago->setNumericMask(2, ',', '.');
     $valor_total_pago->setEditable(FALSE);
     $data_pagamento = new TDate('data_pagamento');
     $data_pagamento->setMask('dd/mm/yyyy');
     $valor_pagamento = new TEntry('valor_pagamento');
     $valor_pagamento->setNumericMask(2, ',', '.');
     $valor_total_parcial = new TEntry('valor_total_parcial');
     $valor_total_parcial->setNumericMask(2, ',', '.');
     $valor_total_parcial->setEditable(FALSE);
     $valor_saldo = new TEntry('valor_saldo');
     $valor_saldo->setNumericMask(2, ',', '.');
     $valor_saldo->setEditable(FALSE);
     $data_cadastro = new TEntry('data_cadastro');
     $data_cadastro->setEditable(FALSE);
     $data_cadastro->setMask('dd/mm/yyyy');
     $data_cadastro->setValue(date('d/m/Y'));
     $data_inicio = new TDate('data_inicio');
     $data_inicio->setMask('dd/mm/yyyy');
     $data_inicio_oculta = new THidden('data_inicio_oculta');
     $data_cancelamento = new TDate('data_cancelamento');
     $data_cancelamento->setMask('dd/mm/yyyy');
     $data_encerramento = new TDate('data_encerramento');
     $data_encerramento->setMask('dd/mm/yyyy');
     $data_prevista = new TDate('data_prevista');
     $data_prevista->setMask('dd/mm/yyyy');
     $data_aprovacao = new TDate('data_aprovacao');
     $data_aprovacao->setMask('dd/mm/yyyy');
     $observacao = new TText('observacao');
     $nome_dtr = new TEntry('nome_dtr');
     $nome_dtr->setEditable(FALSE);
     $criteria = new TCriteria();
     $criteria->add(new TFilter("origem", "=", 1));
     $criteria->add(new TFilter("ativo", "=", 1));
     $criteria->add(new TFilter("codigo_cadastro_origem", "=", 100));
     $responsavel_id = new TDBCombo('responsavel_id', 'atividade', 'Pessoa', 'pessoa_codigo', 'pessoa_nome', 'pessoa_nome', $criteria);
     $tipo_ticket_id = new TDBCombo('tipo_ticket_id', 'atividade', 'TipoTicket', 'id', 'nome');
     $tipo_ticket_id->setDefaultOption(FALSE);
     $sistema_id = new TDBCombo('sistema_id', 'atividade', 'Sistema', 'id', 'nome');
     $status_ticket_id = new TDBCombo('status_ticket_id', 'atividade', 'StatusTicket', 'id', 'nome');
     $status_ticket_id->setValue(2);
     $status_ticket_id->setEditable(FALSE);
     $prioridade_id = new TDBCombo('prioridade_id', 'atividade', 'Prioridade', 'id', 'nome');
     $prioridade_id->setDefaultOption(FALSE);
     $prioridade_id->setValue(3);
     $combo_tipo_origens = new TCombo('tipo_origens');
     $combo_tipo_origens->addItems(array(1 => 'Entidade', 2 => 'Estabelecimento', 3 => 'Empresa'));
     $combo_codigo_origem = new TCombo('codigo_cadastro_origem');
     $combo_solicitante_id = new TCombo('solicitante_id');
     try {
         TTransaction::open('atividade');
         $logado = Pessoa::retornaUsuario();
         TTransaction::close();
     } catch (Exception $e) {
         new TMessage('error', '<b>Error</b> ' . $e->getMessage());
         // shows the exception error message
     }
     $logado_id = new THidden('logado_id');
     $logado_id->setValue($logado->pessoa_codigo);
     // define the sizes
     $id->setSize(100);
     $origem->setSize(200);
     $solicitacao_descricao->setSize(400, 180);
     $data_inicio->setSize(90);
     $data_encerramento->setSize(90);
     $data_cancelamento->setSize(90);
     $providencia->setSize(400, 80);
     $orcamento_horas->setSize(100);
     $orcamento_valor_hora->setSize(100);
     $valor_desconto->setSize(100);
     $valor_total->setSize(100);
     $valor_saldo->setSize(121);
     $forma_pagamento->setSize(400);
     $data_ultimo_pgto->setSize(100);
     $data_pagamento->setSize(100);
     $valor_pagamento->setSize(121);
     $valor_ultimo_pgto->setSize(100);
     $valor_total_pago->setSize(100);
     $valor_total_parcial->setSize(121);
     $data_cadastro->setSize(100);
     $data_prevista->setSize(100);
     $data_aprovacao->setSize(100);
     $observacao->setSize(400, 80);
     $nome_dtr->setSize(400);
     $titulo->setSize(390);
     $responsavel_id->setSize(390);
     $tipo_ticket_id->setSize(200);
     $sistema_id->setSize(200);
     $status_ticket_id->setSize(200);
     $prioridade_id->setSize(200);
     $combo_tipo_origens->setSize(135);
     $combo_codigo_origem->setSize(250);
     $combo_solicitante_id->setSize(390);
     // validações
     $titulo->addValidation('Titulo', new TRequiredValidator());
     $combo_solicitante_id->addValidation('Solicitante', new TRequiredValidator());
     $responsavel_id->addValidation('Responsável', new TRequiredValidator());
     $sistema_id->addValidation('Sistema', new TRequiredValidator());
     $gerar_dr = TButton::create('gerar_dr', array('RequisitoDesenvolvimentoForm', 'onEdit'), 'Gerar DTR', 'ico_add.png');
     $link_dtr = new TButton('link_dtr');
     $link_dtr->setImage('bs:edit green');
     $link_dtr->setLabel('ir para DTR');
     $link_dtr->addFunction("__adianti_load_page('index.php?class=RequisitoDesenvolvimentoForm&method=onBuscaDTR&key={$_REQUEST['key']}');");
     $this->form->addField($gerar_dr);
     $this->form->addField($link_dtr);
     TButton::disableField('form_Ticket', 'gerar_dr');
     TButton::disableField('form_Ticket', 'link_dtr');
     // add one row for each form field
     // notebook Cadastramento
     $table->addRowSet(new TLabel('Ticket:'), array($id, new TLabel('Data Cadastro'), $data_cadastro));
     $table->addRowSet($label_combo_origem = new TLabel('Origem:'), array($combo_tipo_origens, $combo_codigo_origem));
     $label_combo_origem->setFontColor('#FF0000');
     $table->addRowSet($label_solicitante = new TLabel('Solicitante:'), $combo_solicitante_id);
     $label_solicitante->setFontColor('#FF0000');
     $table->addRowSet($label_responsavel = new TLabel('Responsável:'), $responsavel_id);
     $label_responsavel->setFontColor('#FF0000');
     $table->addRowSet($label_titulo = new TLabel('Título:'), $titulo);
     $label_titulo->setFontColor('#FF0000');
     $table->addRowSet(new TLabel('Data Inicio'), array($data_inicio, $label_status = new TLabel('Status:'), $status_ticket_id));
     $label_status->setSize(70);
     $table->addRowSet(new TLabel('Data Encerramento:'), array($data_encerramento, $label_data_cancelamento = new TLabel('Data Cancelamento:'), $data_cancelamento));
     $label_data_cancelamento->setSize(160);
     $table->addRowSet(new TLabel('Prioridade:'), $prioridade_id);
     $table->addRowSet(new TLabel('Origem:'), $origem);
     $table->addRowSet(new TLabel('Tipo Ticket:'), $tipo_ticket_id);
     $table->addRowSet($label_sistema = new TLabel('Sistema:'), $sistema_id);
     $label_sistema->setFontColor('#FF0000');
     $table->addRowSet(new TLabel('Descrição Solicitação:'), $solicitacao_descricao);
     $table->addRowSet(new TLabel('DR.:'), $nome_dtr);
     $table->addRowSet(new TLabel(''), array($gerar_dr, $link_dtr));
     $table->addRowSet(new TLabel(''), $data_inicio_oculta);
     // notebook Pagamento
     $tablePagamento->addRowSet(new TLabel('Data Prevista:'), $data_prevista);
     $tablePagamento->addRowSet(new TLabel('Data Aprovação:'), $data_aprovacao);
     $tablePagamento->addRowSet(new TLabel('Qte Horas:'), $orcamento_horas);
     $tablePagamento->addRowSet(new TLabel('Valor Hora:'), $orcamento_valor_hora);
     $tablePagamento->addRowSet(new TLabel('Valor Desconto:'), $valor_desconto);
     $tablePagamento->addRowSet(new TLabel('Valor Total:'), $valor_total);
     $tablePagamento->addRowSet(new TLabel('Forma de Pgto:'), $forma_pagamento);
     $tablePagamento->addRowSet(new TLabel('Descrição Providência:'), $providencia);
     $tablePagamento->addRowSet(new TLabel('Observação:'), $observacao);
     // creates a frame
     $frame = new TFrame();
     $frame->oid = 'frame-measures';
     $frame->setLegend('Pagamentos:');
     $row = $tablePagamento->addRow();
     $cell = $row->addCell($frame);
     $cell->colspan = 2;
     $page2 = new TTable();
     $frame->add($page2);
     $page2->addRowSet(new TLabel('Valor Pgto:'), array($valor_pagamento, $tamanho_label = new TLabel('Valor Ultimo Pgto:'), $valor_ultimo_pgto));
     $tamanho_label->setSize(150);
     $page2->addRowSet(new TLabel('Data Pgto:'), array($data_pagamento, $tamanho_label = new TLabel('Data Ultimo Pgto:'), $data_ultimo_pgto));
     $tamanho_label->setSize(150);
     $page2->addRowSet(new TLabel('Valor Total:'), array($valor_total_parcial, $tamanho_label = new TLabel('Valor Total Pago: '), $valor_total_pago));
     $tamanho_label->setSize(150);
     $page2->addRowSet(new TLabel('Saldo a pagar:'), $valor_saldo);
     $tablePagamento->addRowSet(new TLabel(''), $logado_id);
     // Envia campos para o formulario
     $this->form->setFields(array($id, $titulo, $data_inicio, $data_inicio_oculta, $data_encerramento, $data_cancelamento, $origem, $solicitacao_descricao, $nome_dtr, $providencia, $orcamento_horas, $orcamento_valor_hora, $valor_desconto, $valor_total, $forma_pagamento, $data_ultimo_pgto, $valor_ultimo_pgto, $valor_total_pago, $data_cadastro, $data_prevista, $data_aprovacao, $observacao, $tipo_ticket_id, $sistema_id, $status_ticket_id, $prioridade_id, $responsavel_id, $valor_total_parcial, $valor_pagamento, $data_pagamento, $valor_saldo, $combo_tipo_origens, $combo_codigo_origem, $combo_solicitante_id, $logado_id));
     // create the form actions
     $save_button = TButton::create('save', array($this, 'onSave'), _t('Save'), 'fa:floppy-o');
     $new_button = TButton::create('new', array($this, 'onEdit'), _t('New'), 'fa:plus-square green');
     $del_button = TButton::create('delete', array($this, 'onDelete'), _t('Delete'), 'fa:trash-o red fa-lg');
     $list_button = TButton::create('list', array('TicketList', 'onReload'), _t('List'), 'fa:table blue');
     $enviar_email = TButton::create('email', array($this, 'onEnviaEmail'), 'Enviar Email', 'ico_email.png');
     $sincronizar = TButton::create('sincronizar', array($this, 'onSincronizarContatos'), 'Sincronizar Contatos', 'sincronizar.png');
     $this->form->addField($save_button);
     $this->form->addField($new_button);
     $this->form->addField($del_button);
     $this->form->addField($list_button);
     $this->form->addField($enviar_email);
     $this->form->addField($sincronizar);
     $subtable = new TTable();
     $row = $subtable->addRow();
     $row->addCell($save_button);
     $row->addCell($new_button);
     $row->addCell($del_button);
     $row->addCell($list_button);
     $row->addCell($enviar_email);
     $row->addCell($sincronizar);
     $pretable = new TTable();
     $pretable->style = 'width: 100%';
     $row = $pretable->addRow();
     $row->class = 'tformtitle';
     // CSS class
     $row->addCell(new TLabel('Cadastro de Ticket'))->colspan = 2;
     $change_action = new TAction(array($this, 'onCalculaValorTotal'));
     $orcamento_horas->setExitAction($change_action);
     $orcamento_valor_hora->setExitAction($change_action);
     $valor_desconto->setExitAction($change_action);
     $change_data_action = new TAction(array($this, 'onChangeDataAction'));
     $data_aprovacao->setExitAction($change_data_action);
     $change_data_prev = new TAction(array($this, 'onChangeDataPrevista'));
     $data_prevista->setExitAction($change_data_prev);
     $change_data_pagamento = new TAction(array($this, 'onChangeDataPagamento'));
     $data_pagamento->setExitAction($change_data_pagamento);
     $change_valor = new TAction(array($this, 'onCalculaValorParcial'));
     $valor_pagamento->setExitAction($change_valor);
     $change_status = new TAction(array($this, 'onChangeDataInicio'));
     $data_inicio->setExitAction($change_status);
     $change_status = new TAction(array($this, 'onChangeDataCancelamento'));
     $data_cancelamento->setExitAction($change_status);
     $change_status = new TAction(array($this, 'onChangeDataEncerramento'));
     $data_encerramento->setExitAction($change_status);
     $change_origem = new TAction(array($this, 'onChangeOrigem'));
     $combo_tipo_origens->setChangeAction($change_origem);
     $change_tipo_origem = new TAction(array($this, 'onChangeTipoOrigem'));
     $combo_codigo_origem->setChangeAction($change_tipo_origem);
     $vbox = new TVBox();
     $vbox->add($pretable);
     $vbox->add($notebook);
     $vbox->add($subtable);
     $this->form->add($vbox);
     parent::add($this->form);
 }
コード例 #3
0
 public function __construct()
 {
     parent::__construct();
     parent::include_css('app/resources/myframe.css');
     $vbox = new TVBox();
     $bt1a = new TButton('bt1a');
     $bt1b = new TButton('bt1b');
     $bt1c = new TButton('bt1c');
     $bt1a->setLabel('BS disk');
     $bt1b->setLabel('BS edit');
     $bt1c->setLabel('BS remove');
     $bt1a->setImage('bs:floppy-disk red');
     $bt1b->setImage('bs:edit green');
     $bt1c->setImage('bs:remove-circle blue');
     $hbox1 = new THBox();
     $hbox1->addRowSet($bt1a, $bt1b, $bt1c);
     $frame1 = new TFrame();
     $frame1->setLegend('Bootstrap Glyphicons');
     $frame1->add($hbox1);
     $bt2a = new TButton('bt2a');
     $bt2b = new TButton('bt2b');
     $bt2c = new TButton('bt2c');
     $bt2a->setLabel('FA save');
     $bt2b->setLabel('FA edit');
     $bt2c->setLabel('FA trash');
     $bt2a->setImage('fa:save red');
     $bt2b->setImage('fa:edit green');
     $bt2c->setImage('fa:trash-o blue');
     $hbox2 = new THBox();
     $hbox2->addRowSet($bt2a, $bt2b, $bt2c);
     $frame2 = new TFrame();
     $frame2->setLegend('Font awesome icons');
     $frame2->add($hbox2);
     $bt3a = new TButton('bt3a');
     $bt3b = new TButton('bt3b');
     $bt3c = new TButton('bt3c');
     $bt3a->setLabel('Warning');
     $bt3b->setLabel('Info');
     $bt3c->setLabel('Success');
     $bt3a->class = 'btn btn-warning btn-sm';
     $bt3b->class = 'btn btn-info';
     $bt3c->class = 'btn btn-success btn-lg';
     $hbox3 = new THBox();
     $hbox3->addRowSet($bt3a, $bt3b, $bt3c);
     $frame3 = new TFrame();
     $frame3->setLegend('Bootstrap styles and sizes');
     $frame3->add($hbox3);
     $bt4a = new TButton('bt4a');
     $bt4b = new TButton('bt4b');
     $bt4c = new TButton('bt4c');
     $bt4a->setLabel('Popover 1');
     $bt4b->setLabel('Popover 2');
     $bt4c->setLabel('Popover 3');
     $bt4a->popover = 'true';
     $bt4a->poptitle = 'Pop title 1';
     $bt4a->popcontent = 'This is the <br>popover for button 1';
     $bt4b->popover = 'true';
     $bt4b->poptitle = 'Pop title 2';
     $bt4b->popcontent = 'This is the <br>popover for button 2';
     $bt4c->popover = 'true';
     $bt4c->poptitle = 'Pop title 3';
     $bt4c->popcontent = 'This is the <br>popover for button 3';
     $hbox4 = new THBox();
     $hbox4->addRowSet($bt4a, $bt4b, $bt4c);
     $frame4 = new TFrame();
     $frame4->setLegend('Buttons with popover');
     $frame4->add($hbox4);
     $bt5a = new TButton('bt5a');
     $bt5b = new TButton('bt5b');
     $bt5c = new TButton('bt5c');
     $bt5a->setLabel('Action 1');
     $bt5b->setLabel('Action 2');
     $bt5c->setLabel('Action 3');
     $bt5a->addFunction("alert('action 1');");
     $bt5b->addFunction("alert('going to another page');__adianti_load_page('index.php?class=FormQuickView');");
     $bt5c->addFunction("if (confirm('Want to go?') == true) { __adianti_load_page('index.php?class=ContainerWindowView'); }");
     $hbox5 = new THBox();
     $hbox5->addRowSet($bt5a, $bt5b, $bt5c);
     $frame5 = new TFrame();
     $frame5->setLegend('Buttons with Javascript actions');
     $frame5->add($hbox5);
     $vbox->add($frame1);
     $vbox->add($frame2);
     $vbox->add($frame3);
     $vbox->add($frame4);
     $vbox->add($frame5);
     parent::add($vbox);
 }
コード例 #4
0
 /**
  * Class constructor
  * Creates the page
  */
 function __construct()
 {
     parent::__construct();
     // creates a notebook
     $notebook = new TNotebook(500, 250);
     // creates the notebook page
     $page = new TTable();
     // adds the notebook page
     $notebook->appendPage('Register data', $page);
     // create the form fields
     $field1 = new TEntry('field1');
     $field2 = new TEntry('field2');
     $field3 = new TEntry('field3');
     $field4 = new TCombo('field4');
     $field5 = new TEntry('field5');
     $field6 = new TEntry('field6');
     $field7 = new TEntry('field7');
     $field8 = new TEntry('field8');
     $field9 = new TEntry('field9');
     // creates an array with items
     $units = array();
     $units['PC'] = 'Piece';
     $units['LT'] = 'Liter';
     $units['ML'] = 'Milliliter';
     $units['GL'] = 'Gallon';
     $units['KG'] = 'Kilogram';
     $units['GR'] = 'Gram';
     // add the items to the combo
     $field4->addItems($units);
     // define some sizes
     $field1->setEditable(FALSE);
     $field1->setSize(100);
     $field2->setSize(300);
     $field4->setSize(100);
     $field3->setSize(100);
     $field5->setSize(100);
     $field6->setSize(100);
     $field7->setSize(100);
     $field8->setSize(100);
     $field9->setSize(300);
     // add a row for one field
     $row = $page->addRow();
     $row->addCell(new TLabel('Id:'));
     $cell = $row->addCell($field1);
     // add a row for one field
     $row = $page->addRow();
     $row->addCell(new TLabel('Description:'));
     $cell = $row->addCell($field2);
     // creates a frame
     $frame = new TFrame();
     $frame->oid = 'frame-measures';
     $frame->setLegend('Measures');
     $button = new TButton('show_hide');
     $button->class = 'btn btn-default btn-sm active';
     $button->setLabel('Show/hide measures');
     $button->addFunction("\$('[oid=frame-measures]').slideToggle(); \$(this).toggleClass( 'active' )");
     $row = $page->addRow();
     $row->addCell($button);
     // add the frame inside the table
     $row = $page->addRow();
     $cell = $row->addCell($frame);
     $cell->colspan = 2;
     // adds another table inside the frame
     $page2 = new TTable();
     $frame->add($page2);
     // add a row for tow fields
     $row = $page2->addRow();
     $row->addCell(new TLabel('Stock:'));
     $row->addCell($field3);
     $row->addCell(new TLabel('Unit:'));
     $row->addCell($field4);
     // add a row for tow fields
     $row = $page2->addRow();
     $row->addCell(new TLabel('Cost Price:'));
     $row->addCell($field5);
     $row->addCell(new TLabel('Sell Price:'));
     $row->addCell($field6);
     // add a row for tow fields
     $row = $page2->addRow();
     $row->addCell(new TLabel('Net Weight:'));
     $row->addCell($field7);
     $row->addCell(new TLabel('Gross Weight:'));
     $row->addCell($field8);
     // add just another field
     $row = $page->addRow();
     $row->addCell(new TLabel('Another field:'));
     $cell = $row->addCell($field9);
     // wrap the page content using vertical box
     $vbox = new TVBox();
     $vbox->add(new TXMLBreadCrumb('menu.xml', __CLASS__));
     $vbox->add($notebook);
     parent::add($vbox);
 }