function onStep2()
 {
     try {
         $data = $this->form->getData();
         $this->form->validate();
         $page2 = new TTable();
         $this->notebook->appendPage('Page 2', $page2);
         $gender_options = array('M' => 'Male', 'F' => 'Female');
         $ocupation_optins = array('S' => 'Self employed', 'B' => 'Business', 'R' => 'Retired');
         switch ($data->field1) {
             case 'combo':
                 $field3 = new TCombo('field3');
                 break;
             case 'radio':
                 $field3 = new TRadioGroup('field3');
                 $field3->setLayout('horizontal');
                 break;
             case 'check':
                 $field3 = new TCheckGroup('field3');
                 $field3->setLayout('horizontal');
                 break;
         }
         $field3->addValidation('Field 3', new TRequiredValidator());
         switch ($data->field2) {
             case '1':
                 $label = 'Gender';
                 $field3->addItems($gender_options);
                 break;
             case '2':
                 $label = 'Ocupation';
                 $field3->addItems($ocupation_optins);
                 break;
         }
         $field4 = new TEntry('field4');
         $field4->addValidation('Field 4', new TRequiredValidator());
         // add a row for one field
         $row = $page2->addRow();
         $row->addCell($l3 = new TLabel($label . ':'));
         $cell = $row->addCell($field3);
         // add a row for one field
         $row = $page2->addRow();
         $row->addCell($l4 = new TLabel('Next tab title:'));
         $cell = $row->addCell($field4);
         $l3->setFontColor('#FF0000');
         $l4->setFontColor('#FF0000');
         // creates the action button
         $button2 = new TButton('action2');
         $button2->setAction(new TAction(array($this, 'onStep3')), 'Next');
         $button2->setImage('ico_next.png');
         $row = $page2->addRow();
         $row->addCell($button2);
         $this->form->addField($field3);
         $this->form->addField($field4);
         $this->form->addField($button2);
         $this->notebook->setCurrentPage(1);
         $this->form->setData($data);
     } catch (Exception $e) {
         new TMessage('error', $e->getMessage());
     }
 }
 /**
  * Class constructor
  * Creates the page and the registration form
  */
 function __construct()
 {
     parent::__construct();
     parent::setDatabase('esales');
     // defines the database
     parent::setActiveRecord('Pessoa');
     // defines the active record
     // creates the form
     $this->form = new TQuickForm('form_Pessoa');
     $this->form->class = 'tform';
     // CSS class
     $this->form->style = 'width: 500px';
     // define the form title
     $this->form->setFormTitle('Pessoa');
     // create the form fields
     $id = new TEntry('id');
     $nome = new TEntry('nome');
     $telefone = new TEntry('telefone');
     $email = new TEntry('email');
     $endereco = new TEntry('endereco');
     $numero = new TEntry('numero');
     $cidade_id = new TSeekButton('cidade_id');
     $cidade_id->addValidation('Cidade', new TRequiredValidator());
     $cidade_name = new TEntry('cidade_name');
     $obj = new TStandardSeek();
     $action = new TAction(array($obj, 'onSetup'));
     $action->setParameter('database', 'esales');
     $action->setParameter('parent', 'form_Pessoa');
     $action->setParameter('model', 'Cidade');
     $action->setParameter('display_field', 'descricao');
     $action->setParameter('receive_key', 'cidade_id');
     $action->setParameter('receive_field', 'cidade_name');
     $cidade_id->setAction($action);
     $cep = new TEntry('cep');
     $cpf_cnpj = new TEntry('cpf_cnpj');
     $tipo_pessoa = new TRadioGroup('tipo_pessoa');
     $tipo_pessoa->addItems(array('F' => 'Fisica', 'J' => 'Juridica'));
     // add the fields
     $this->form->addQuickField('Codigo', $id, 100);
     $this->form->addQuickField('Nome', $nome, 200);
     $this->form->addQuickField('Telefone', $telefone, 200);
     $this->form->addQuickField('Email', $email, 200);
     $this->form->addQuickField('Endereço', $endereco, 200);
     $this->form->addQuickField('Numero', $numero, 200);
     $this->form->addQuickFields('Cidade', array($cidade_id, $cidade_name), true);
     $this->form->addQuickField('CEP', $cep, 200);
     $this->form->addQuickField('CPF/CNPJ', $cpf_cnpj, 100);
     $this->form->addQuickField('Tipo de pessoa', $tipo_pessoa, 200);
     // create the form actions
     $this->form->addQuickAction('Salvar', new TAction(array($this, 'onSave')), 'ico_save.png');
     $this->form->addQuickAction('Novo', new TAction(array($this, 'onEdit')), 'ico_new.png');
     // add the form to the page
     parent::add($this->form);
 }
 /**
  * Class constructor
  * Creates the page and the registration form
  */
 function __construct()
 {
     parent::__construct();
     // creates the form
     $this->form = new TForm('form_Customer_Report');
     $this->form->class = 'tform';
     // CSS class
     // creates a table
     $table = new TTable();
     $table->width = '100%';
     // add the table inside the form
     $this->form->add($table);
     // create the form fields
     $name = new TEntry('name');
     $city_id = new TDBSeekButton('city_id', 'samples', 'form_Customer_Report', 'City', 'name', 'city_id', 'city_name');
     $city_name = new TEntry('city_name');
     $category_id = new TDBCombo('category_id', 'samples', 'Category', 'id', 'name');
     $output_type = new TRadioGroup('output_type');
     $options = array('html' => 'HTML', 'pdf' => 'PDF', 'rtf' => 'RTF');
     $output_type->addItems($options);
     $output_type->setValue('pdf');
     $output_type->setLayout('horizontal');
     // define the sizes
     $name->setSize(200);
     $city_id->setSize(100);
     $category_id->setSize(100);
     $city_name->setEditable(FALSE);
     // add a row for the field name
     $row = $table->addRowSet(new TLabel('Report filters'), '');
     $row->class = 'tformtitle';
     // CSS class
     // add the fields into the table
     $table->addRowSet(new TLabel('Name' . ': '), $name);
     $table->addRowSet(new TLabel('City' . ': '), array($city_id, $city_name));
     $table->addRowSet(new TLabel('Category' . ': '), $category_id);
     $table->addRowSet(new TLabel('Output' . ': '), $output_type);
     // create an action button (save)
     $save_button = new TButton('generate');
     $save_button->setAction(new TAction(array($this, 'onGenerate')), 'Generate');
     $save_button->setImage('ico_save.png');
     // add a row for the form action
     $row = $table->addRowSet($save_button, '');
     $row->class = 'tformaction';
     // define wich are the form fields
     $this->form->setFields(array($name, $city_id, $city_name, $category_id, $output_type, $save_button));
     // wrap the page content using vertical box
     $vbox = new TVBox();
     $vbox->add(new TXMLBreadCrumb('menu.xml', __CLASS__));
     $vbox->add($this->form);
     parent::add($vbox);
 }
 /**
  * Class constructor
  * Creates the page and the registration form
  */
 function __construct()
 {
     parent::__construct();
     // creates the form
     $this->form = new TQuickForm('form_Servidor');
     $this->form->setFormTitle('Servidores');
     $this->form->class = 'tform';
     // CSS class
     // defines the database
     parent::setDatabase('lacenrh');
     // defines the active record
     parent::setActiveRecord('Servidor');
     // create the form fields
     $id = new TEntry('id');
     $identificacao = new TEntry('identificacao');
     $servidor = new TEntry('servidor');
     $unidade = new TRadioGroup('unidade');
     $id->setEditable(false);
     //create the combo Unidade
     $itemUnidade = array();
     $itemUnidade['XV'] = ' Alto da XV ';
     $itemUnidade['GT'] = ' Guatupê';
     // add the combo options
     $unidade->addItems($itemUnidade);
     //$unidade->setLayout('horizontal');
     // add the fields
     $this->form->addQuickField('ID', $id, 50);
     $this->form->addQuickField('Identificação', $identificacao, 150);
     $this->form->addQuickField('Nome do Servidor', $servidor, 200);
     $this->form->addQuickField('Unidade', $unidade, 200);
     // validations
     $identificacao->addValidation('Identificação', new TRequiredValidator());
     $servidor->addValidation('Nome', new TRequiredValidator());
     $unidade->addValidation('Unidade', new TRequiredValidator());
     // add form actions
     $this->form->addQuickAction(_t('Save'), new TAction(array($this, 'onSave')), 'fa:floppy-o fa-lg');
     $this->form->addQuickAction(_t('New'), new TAction(array($this, 'onEdit')), 'fa:plus-square green fa-lg');
     $this->form->addQuickAction(_t('Back to the listing'), new TAction(array('ServidorList', 'onReload')), 'fa:table blue fa-lg');
     $container = new TTable();
     $container->style = 'width: 80%';
     $container->addRow()->addCell(new TXMLBreadCrumb('menu.xml', 'ServidorList'));
     $container->addRow()->addCell($this->form);
     // add the form to the page
     parent::add($container);
 }
 /**
  * Class constructor
  * Creates the page and the registration form
  */
 function __construct()
 {
     parent::__construct();
     // creates the form
     $this->form = new TForm('form_Ponto_report');
     $this->form->class = 'tform';
     // CSS class
     $this->form->style = 'width: 500px';
     $this->string = new StringsUtil();
     // creates the table container
     $table = new TTable();
     $table->width = '100%';
     // add the table inside the form
     $this->form->add($table);
     // define the form title
     $row = $table->addRow();
     $row->class = 'tformtitle';
     $cell = $row->addCell(new TLabel('Indicador de produtividade por colaborador'));
     $cell->colspan = 2;
     // create the form fields
     $mes_atividade = new TCombo('mes_atividade');
     $mes_atividade->addItems($this->string->array_meses());
     $mes_atividade->setDefaultOption(FALSE);
     $mes_atividade->setValue(date('m'));
     $mes_atividade->setSize(250);
     $output_type = new TRadioGroup('output_type');
     $output_type->setSize(100);
     // validations
     $output_type->addValidation('Saida', new TRequiredValidator());
     // add one row for each form field
     $table->addRowSet(new TLabel('Mês referencia:'), $mes_atividade);
     $table->addRowSet($label_output_type = new TLabel('Saida:'), $output_type);
     $label_output_type->setFontColor('#FF0000');
     $this->form->setFields(array($mes_atividade, $output_type));
     $output_type->addItems(array('html' => 'HTML', 'pdf' => 'PDF', 'rtf' => 'RTF'));
     $output_type->setValue('html');
     $output_type->setLayout('horizontal');
     $generate_button = TButton::create('generate', array($this, 'onGenerate'), _t('Generate'), 'fa:check-circle-o green');
     $this->form->addField($generate_button);
     // add a row for the form action
     $table->addRowSet($generate_button, '')->class = 'tformaction';
     parent::add($this->form);
 }
 /**
  * Class constructor
  * Creates the page and the registration form
  */
 function __construct()
 {
     parent::__construct();
     // creates the form
     $this->form = new TForm('form_RegistroLogin_report');
     $this->form->class = 'tform';
     // CSS class
     $this->form->style = 'width: 500px';
     // creates the table container
     $table = new TTable();
     $table->width = '100%';
     // add the table inside the form
     $this->form->add($table);
     // define the form title
     $row = $table->addRow();
     $row->class = 'tformtitle';
     // CSS class
     $row->addCell(new TLabel('Registro de acessos ao sistema'))->colspan = 2;
     // create the form fields
     //$name                           = new TEntry('name');
     $name = new TDBCombo('login', 'atividade', 'SystemUser', 'login', 'name');
     $data_ponto = new TDate('data_ponto');
     $data_ponto->setMask('dd/mm/yyyy');
     $output_type = new TRadioGroup('output_type');
     // define the sizes
     $data_ponto->setSize(100);
     $output_type->setSize(100);
     // add one row for each form field
     $table->addRowSet(new TLabel('Nome:'), $name);
     $table->addRowSet(new TLabel('Data:'), $data_ponto);
     $table->addRowSet(new TLabel('Saida:'), $output_type);
     $this->form->setFields(array($name, $data_ponto, $output_type));
     $output_type->addItems(array('html' => 'HTML', 'pdf' => 'PDF', 'rtf' => 'RTF'));
     $output_type->setValue('html');
     $output_type->setLayout('horizontal');
     $generate_button = TButton::create('generate', array($this, 'onGenerate'), _t('Generate'), 'fa:check-circle-o green');
     $this->form->addField($generate_button);
     // add a row for the form action
     $table->addRowSet($generate_button, '')->class = 'tformaction';
     parent::add($this->form);
 }
 /**
  * Class constructor
  * Creates the page
  */
 function __construct()
 {
     parent::__construct();
     // create the form using TQuickForm class
     $this->form = new TQuickForm('form_enable_disable');
     $this->form->setFormTitle('Enable/disable');
     $this->form->class = 'tform';
     // create the form fields
     $radio_enable = new TRadioGroup('enable');
     $radio_enable->addItems(array('1' => 'Enable group 1', '2' => 'Enable group 2'));
     $radio_enable->setLayout('horizontal');
     $radio_enable->setValue(1);
     $block1_combo = new TCombo('block1_combo');
     $block1_entry = new TEntry('block1_entry');
     $block1_spinner = new TSpinner('block1_spinner');
     $block2_date = new TDate('block2_date');
     $block2_entry = new TEntry('block2_entry');
     $block2_check = new TCheckGroup('block2_check');
     $block1_combo->addItems(array(1 => 'One', 2 => 'Two'));
     $block1_spinner->setRange(1, 100, 10);
     $block2_check->addItems(array('Y' => 'Yes', 'N' => 'No'));
     // add the fields inside the form
     $this->form->addQuickField('', $radio_enable, 200);
     $this->form->addQuickField('group #1', $block1_combo, 200);
     $this->form->addQuickField('', $block1_entry, 200);
     $this->form->addQuickField('', $block1_spinner, 200);
     $this->form->addQuickField('group #2', $block2_date, 80);
     $this->form->addQuickField('', $block2_entry, 200);
     $this->form->addQuickField('', $block2_check, 200);
     $radio_enable->setChangeAction(new TAction(array($this, 'onChangeRadio')));
     self::onChangeRadio(array('enable' => 1));
     // wrap the page content using vertical box
     $vbox = new TVBox();
     $vbox->add(new TXMLBreadCrumb('menu.xml', __CLASS__));
     $vbox->add($this->form);
     parent::add($vbox);
 }
Esempio n. 8
0
 /**
  * Class Constructor
  * @param  $name     widget's name
  * @param  $database database name
  * @param  $model    model class name
  * @param  $key      table field to be used as key in the combo
  * @param  $value    table field to be listed in the combo
  * @param  $ordercolumn column to order the fields (optional)
  */
 public function __construct($name, $database, $model, $key, $value, $ordercolumn = NULL)
 {
     // executes the parent class constructor
     parent::__construct($name);
     // carrega objetos do banco de dados
     TTransaction::open($database);
     // instancia um repositório de Estado
     $repository = new TRepository($model);
     $criteria = new TCriteria();
     $criteria->setProperty('order', isset($ordercolumn) ? $ordercolumn : $key);
     // carrega todos objetos
     $collection = $repository->load($criteria);
     // adiciona objetos na combo
     if ($collection) {
         $items = array();
         foreach ($collection as $object) {
             $items[$object->{$key}] = $object->{$value};
         }
         parent::addItems($items);
     }
     TTransaction::close();
 }
 /**
  * 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
     $this->form->style = 'width: 500px';
     // creates the table container
     $table = new TTable();
     $table->width = '110%';
     // add the table inside the form
     $this->form->add($table);
     // define the form title
     $row = $table->addRow();
     $row->class = 'tformtitle';
     // CSS class
     $row->addCell(new TLabel('Resumo de Tickets e Atividades'))->colspan = 3;
     // create the form fields
     $ticket = new TEntry('ticket_id');
     $ticket->setMask('99999');
     $solicitante_id = new TSeekButton('solicitante_id');
     $solicitante_nome = new TEntry('solicitante_nome');
     $obj = new TicketPessoaSeek();
     $action = new TAction(array($obj, 'onReload'));
     $solicitante_id->setAction($action);
     $solicitante_nome->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);
     $criteria = new TCriteria();
     $criteria->add(new TFilter('enttipent', '=', 1));
     $entcodent = new TDBComboMultiValue('entcodent', 'atividade', 'Entidade', 'entcodent', array(0 => 'entcodent', 1 => 'entrazsoc'), 'entcodent', $criteria);
     $status_ticket_id = new TDBCombo('status_ticket_id', 'atividade', 'StatusTicket', 'id', 'nome');
     $prioridade_id = new TDBCombo('prioridade_id', 'atividade', 'Prioridade', 'id', 'nome');
     $tipo_ticket_id = new TDBCombo('tipo_ticket_id', 'atividade', 'TipoTicket', 'id', 'nome');
     $ticket_sistema_id = new TDBCombo('ticket_sistema_id', 'atividade', 'Sistema', 'id', 'nome');
     $atividade_sistema_id = new TDBCombo('atividade_sistema_id', 'atividade', 'Sistema', 'id', 'nome');
     $saldo = new TCombo('saldo');
     $combo_saldo = array();
     $combo_saldo['c'] = 'Com saldo';
     $saldo->addItems($combo_saldo);
     $data_prevista = new TDate('data_prevista');
     $data_prevista->setMask('dd/mm/yyyy');
     $dataAtividadeInicio = new TDate('data_atividade_inicio');
     $dataAtividadeInicio->setMask('dd/mm/yyyy');
     $dataAtividadeInicio->setValue('01/' . date('m/Y'));
     $dataAtividadeFinal = new TDate('data_atividade_final');
     $dataAtividadeFinal->setMask('dd/mm/yyyy');
     $dataAtividadeFinal->setValue(date('d/m/Y'));
     $criteria = new TCriteria();
     $criteria->add(new TFilter("origem", "=", 1));
     $criteria->add(new TFilter("ativo", "=", 1));
     $criteria->add(new TFilter("codigo_cadastro_origem", "=", 100));
     $colaborador_id = new TDBCombo('colaborador_id', 'atividade', 'Pessoa', 'pessoa_codigo', 'pessoa_nome', 'pessoa_nome', $criteria);
     $tipo_atividade_id = new TDBCombo('tipo_atividade_id', 'atividade', 'TipoAtividade', 'id', 'nome', 'nome');
     $pesquisa_master = new TEntry('pesquisa_master');
     $tipo = new TRadioGroup('tipo');
     $output_type = new TRadioGroup('output_type');
     // define the sizes
     $ticket->setSize(100);
     $solicitante_id->setSize(30);
     $solicitante_nome->setSize(245);
     $responsavel_id->setSize(300);
     $colaborador_id->setSize(300);
     $entcodent->setSize(300);
     $status_ticket_id->setSize(100);
     $prioridade_id->setSize(100);
     $tipo_ticket_id->setSize(200);
     $ticket_sistema_id->setSize(200);
     $atividade_sistema_id->setSize(200);
     $saldo->setSize(100);
     $data_prevista->setSize(100);
     $dataAtividadeInicio->setSize(100);
     $dataAtividadeFinal->setSize(100);
     $tipo->setSize(100);
     $output_type->setSize(100);
     // validations
     $output_type->addValidation('Output', new TRequiredValidator());
     // add one row for each form field
     // creates a frame
     $frame = new TFrame();
     $frame->oid = 'frame-measures';
     $frame->setLegend('Tickets:');
     $row = $table->addRow();
     $cell = $row->addCell($frame);
     $cell->colspan = 2;
     $frame1 = new TTable();
     $frame->add($frame1);
     $frame1->addRowSet(new TLabel('Ticket inicial:'), $ticket);
     $frame1->addRowSet(new TLabel('Solicitante:'), array($solicitante_id, $solicitante_nome));
     $frame1->addRowSet(new TLabel('Responsável:'), $responsavel_id);
     $frame1->addRowSet(new TLabel('Cliente:'), $entcodent);
     $frame1->addRowSet(new TLabel('Tipo:'), $tipo_ticket_id);
     $frame1->addRowSet(new TLabel('Sistema:'), $ticket_sistema_id);
     $frame1->addRowSet(new TLabel('Status:'), $status_ticket_id);
     $frame1->addRowSet(new TLabel('Prioridade:'), $prioridade_id);
     $frame1->addRowSet(new TLabel('Saldo:'), $saldo);
     $frame1->addRowSet(new TLabel('Dt. Prevista limite:'), $data_prevista);
     // creates a frame
     $frame = new TFrame();
     $frame->oid = 'frame-measures';
     $frame->setLegend('Atividades:');
     $row = $table->addRow();
     $cell = $row->addCell($frame);
     $cell->colspan = 2;
     $frame2 = new TTable();
     $frame->add($frame2);
     $frame2->addRowSet(new TLabel('Dt. Atividades inicio:'), array($dataAtividadeInicio, $label_data_fim = new TLabel('Fim:'), $dataAtividadeFinal));
     $label_data_fim->setSize(48);
     $frame2->addRowSet(new TLabel('Atividades colaborador:'), $colaborador_id);
     $frame2->addRowSet(new TLabel('Tipo atividade:'), $tipo_atividade_id);
     $frame2->addRowSet(new TLabel('Sistema:'), $atividade_sistema_id);
     // creates a frame
     $frame = new TFrame();
     $frame->oid = 'frame-measures';
     $frame->setLegend('Pesquisa Master:');
     $row = $table->addRow();
     $cell = $row->addCell($frame);
     $cell->colspan = 2;
     $frame3 = new TTable();
     $frame->add($frame3);
     $frame3->addRowSet(new TLabel('<nobr>Por palavra:</nobr>'), $pesquisa_master);
     $frame3->addRowSet(new TLabel(''), new TLabel('Essa pesquisa busca pelo titulo do ticket e da descrição da atividade'));
     $table->addRowSet(new TLabel('Relatório'), $tipo);
     $table->addRowSet(new TLabel('Output:'), $output_type);
     $this->form->setFields(array($ticket, $solicitante_id, $solicitante_nome, $responsavel_id, $entcodent, $status_ticket_id, $prioridade_id, $saldo, $tipo_ticket_id, $ticket_sistema_id, $data_prevista, $dataAtividadeInicio, $dataAtividadeFinal, $colaborador_id, $tipo_atividade_id, $atividade_sistema_id, $pesquisa_master, $tipo, $output_type));
     $tipo->addItems(array('s' => 'Sintético', 'a' => 'Analitico'));
     $tipo->setValue('s');
     $tipo->setLayout('horizontal');
     //$output_type->addItems(array('html'=>'HTML', 'pdf'=>'PDF', 'rtf'=>'RTF'));
     $output_type->addItems(array('html' => 'HTML'));
     $output_type->setValue('html');
     $output_type->setLayout('horizontal');
     $generate_button = TButton::create('generate', array($this, 'onGenerate'), _t('Generate'), 'fa:check-circle-o green');
     $this->form->addField($generate_button);
     $change_data = new TAction(array($this, 'onChangeData'));
     $dataAtividadeInicio->setExitAction($change_data);
     $dataAtividadeFinal->setExitAction($change_data);
     // add a row for the form action
     $table->addRowSet($generate_button, '')->class = 'tformaction';
     parent::add($this->form);
 }
// instancia um formulário
$form = new TForm('form_pessoas');
// instancia uma tabela
$table = new TTable();
// define algumas propriedades da tabela
$table->bgcolor = '#f0f0f0';
$table->style = 'border:2px solid grey';
$table->width = 400;
// adiciona a tabela ao formulário
$form->add($table);
// cria os campos do formulário
$codigo = new TEntry('id');
$nome = new TEntry('nome');
$endereco = new TEntry('endereco');
$datanasc = new TEntry('datanasc');
$sexo = new TRadioGroup('sexo');
$linguas = new TCheckGroup('linguas');
$qualifica = new TText('qualifica');
// define tamanho para campo código
$codigo->setSize(100);
// define como somente leitura
$codigo->setEditable(FALSE);
// cria um vetor com as opções de sexo
$items = array();
$items['M'] = 'Masculino';
$items['F'] = 'Feminino';
// define tamanho para campo data de nascimento
$datanasc->setSize(100);
// adiciona as opções ao radio button
$sexo->addItems($items);
// define a opção ativa
 public function __construct()
 {
     parent::__construct();
     $this->form = new TQuickForm('matricula');
     $this->form->class = 'tform';
     $this->form->setFormTitle('Formulário de matrícula');
     $nome = new TEntry('nome');
     $cpf = new TEntry('cpf');
     $date = new TDate('date');
     $date->setMask('dd/mm/yyyy');
     $telefone = new TEntry('telefone1');
     $telefone->setMask('(99) 9999-999');
     $telefone2 = new TEntry('telefone2');
     $telefone2->setMask('(99) 99999-999');
     $email = new TEntry('email');
     $escolaOrigem = new TEntry('escolaDeOrigem');
     $tipoSanguineo = new TCombo('tipoSanguineo');
     $alergia = new TRadioGroup('alergia');
     $alergia->setLayout('horizontal');
     $descAlergia = new TText('descAlergia');
     $descAlergia->setSize(450, 100);
     TText::disableField('matricula', 'descAlergia');
     $combo_items = array();
     $combo_items['A+'] = 'A+';
     $combo_items['A-'] = 'A-';
     $combo_items['B+'] = 'B+';
     $combo_items['B-'] = 'B-';
     $combo_items['O+'] = 'O+';
     $combo_items['O-'] = 'O-';
     $combo_items['AB+'] = 'AB+';
     $combo_items['AB-'] = 'AB-';
     $tipoSanguineo->addItems($combo_items);
     $combo_items = array();
     $combo_items[1] = 'Sim';
     $combo_items[2] = 'Não';
     $alergia->addItems($combo_items);
     $this->form->addQuickField('Nome', $nome, 559);
     $this->form->addQuickFields('CPF', array($cpf, new TLabel('Data de Nascimento'), $date));
     $this->form->addQuickFields('Telefone', array($telefone, new TLabel('Celular'), $telefone2));
     $this->form->addQuickField('Email', $email, 250);
     $this->form->addQuickField('Escola de Origem', $escolaOrigem, 400);
     $row = $this->form->addRow();
     $row->addCell(' ');
     $row = $this->form->addRow();
     $row->class = 'tformsection';
     $thidden = new TLabel('Informações médicas');
     $thidden->setSize(800);
     $row->addCell($thidden)->colspan = 2;
     $this->form->addQuickField('Tipo sanguíneo', $tipoSanguineo, 100);
     $this->form->addQuickField('Alergia?', $alergia, 200);
     //$this->form->addQuickField('',$descAlergia,450);
     $row = $this->form->addRow();
     $row->addCell('');
     $row->addCell($descAlergia);
     $row = $this->form->addRow();
     $row->class = 'tformsection';
     $thidden = new TLabel('Dados cadastrais da Mãe');
     $thidden->setSize(800);
     $row->addCell($thidden)->colspan = 2;
     $nomeMae = new TEntry('nomeMae');
     $telMae = new TEntry('TelMae');
     $telMae->setMask('(99) 99999-999');
     $telMae2 = new Tentry('TelMae2');
     $telMae2->setMask('(99) 99999-999');
     $emailMae = new TEntry('emailMae');
     $this->form->addQuickField('Nome', $nomeMae, 559);
     $this->form->addQuickFields('Telefone', array($telMae, new TLabel('Tel. Alternativo'), $telMae2));
     $this->form->addQuickField('Email', $emailMae, 559);
     $row = $this->form->addRow();
     $row->addCell(' ');
     $row = $this->form->addRow();
     $row->class = 'tformsection';
     $thidden = new TLabel('Dados cadastrais do Pai');
     $thidden->setSize(800);
     $row->addCell($thidden)->colspan = 2;
     $nomePai = new TEntry('nomePai');
     $telPai = new TEntry('TelPai');
     $telPai->setMask('(99) 99999-999');
     $telPai2 = new Tentry('TelPai2');
     $telPai2->setMask('(99) 99999-999');
     $emailPai = new TEntry('emailPai');
     $this->form->addQuickField('Nome', $nomePai, 559);
     $this->form->addQuickFields('Telefone', array($telPai, new TLabel('Tel. Alternativo'), $telPai2));
     $this->form->addQuickField('Email', $emailPai, 559);
     $row = $this->form->addRow();
     $thidden = new TLabel('');
     $thidden->setSize(800);
     $row->addCell($thidden)->colspan = 2;
     $alergia->setChangeAction(new TAction(array($this, 'onChangeRadio')));
     $this->form->addQuickAction('Salvar', new TAction(array($this, 'onSave')), 'ico_save.png');
     parent::add($this->form);
 }
Esempio n. 12
0
 /**
  * 
  */
 public function makeTRadioGroup($properties)
 {
     $widget = new TRadioGroup((string) $properties->{'name'});
     $widget->setLayout('vertical');
     $pieces = explode("\n", (string) $properties->{'items'});
     $items = array();
     if ($pieces) {
         foreach ($pieces as $line) {
             $part = explode(':', $line);
             $items[$part[0]] = $part[1];
         }
     }
     $widget->addItems($items);
     $widget->setValue((string) $properties->{'value'});
     if (isset($properties->{'tip'})) {
         $widget->setTip((string) $properties->{'tip'});
     }
     $this->fields[] = $widget;
     $this->fieldsByName[(string) $properties->{'name'}] = $widget;
     return $widget;
 }
 /**
  * Class constructor
  * Creates the page and the registration form
  */
 function __construct()
 {
     parent::__construct();
     $this->string = new StringsUtil();
     // creates the form
     $this->form = new TForm('form_Atividade_Cliente');
     $this->form->class = 'tform';
     // CSS class
     $this->form->style = 'width: 500px';
     // creates the table container
     $table = new TTable();
     $table->width = '100%';
     // add the table inside the form
     $this->form->add($table);
     // define the form title
     $row = $table->addRow();
     $row->class = 'tformtitle';
     $cell = $row->addCell(new TLabel('Indicador por Periodo'));
     $cell->colspan = 2;
     // create the form fields
     // cria array para popular as combos
     TTransaction::open('atividade');
     $criteria = new TCriteria();
     $criteria->add(new TFilter("origem", "=", 1));
     $criteria->add(new TFilter("codigo_cadastro_origem", "=", 100));
     $criteria->add(new TFilter("ativo", "=", 1));
     $newparam['order'] = 'pessoa_nome';
     $newparam['direction'] = 'asc';
     $criteria->setProperties($newparam);
     // order, offset
     $repo = new TRepository('Pessoa');
     $pessoas = $repo->load($criteria);
     $arrayPessoas[-1] = 'TODOS COLABORADORES';
     foreach ($pessoas as $pessoa) {
         $arrayPessoas[$pessoa->pessoa_codigo] = $pessoa->pessoa_nome;
     }
     $criteria = new TCriteria();
     $criteria->add(new TFilter("enttipent", "=", "1"));
     $newparam['order'] = 'entcodent';
     $newparam['direction'] = 'asc';
     $criteria->setProperties($newparam);
     // order, offset
     $repo = new TRepository('Entidade');
     $clientes = $repo->load($criteria);
     $arrayClientes[-1] = 'TODOS CLIENTES';
     foreach ($clientes as $cliente) {
         $arrayClientes[$cliente->entcodent] = str_pad($cliente->entcodent, 4, '0', STR_PAD_LEFT) . ' - ' . $cliente->entrazsoc;
     }
     $arrayClientes[999] = 'ECS 999';
     TTransaction::close();
     $colaborador_id = new TCombo('colaborador_id');
     $colaborador_id->setDefaultOption(FALSE);
     $colaborador_id->addItems($arrayPessoas);
     $cliente_id = new TCombo('cliente_id');
     $cliente_id->setDefaultOption(FALSE);
     $cliente_id->addItems($arrayClientes);
     $anos = array(2015 => '2015');
     $mes_atividade_inicial = new TCombo('mes_atividade_inicial');
     $mes_atividade_inicial->addItems($this->string->array_meses());
     $mes_atividade_inicial->setDefaultOption(FALSE);
     $mes_atividade_inicial->setValue(date('m'));
     $ano_atividade_inicial = new TCombo('ano_atividade_inicial');
     $ano_atividade_inicial->addItems($anos);
     $ano_atividade_inicial->setDefaultOption(FALSE);
     $mes_atividade_final = new TCombo('mes_atividade_final');
     $mes_atividade_final->addItems($this->string->array_meses());
     $mes_atividade_final->setDefaultOption(FALSE);
     $mes_atividade_final->setValue(date('m'));
     $ano_atividade_final = new TCombo('ano_atividade_final');
     $ano_atividade_final->addItems($anos);
     $ano_atividade_final->setDefaultOption(FALSE);
     $output_type = new TRadioGroup('output_type');
     // define the sizes
     $colaborador_id->setSize(353);
     $cliente_id->setSize(353);
     $mes_atividade_inicial->setSize(250);
     $ano_atividade_inicial->setSize(100);
     $mes_atividade_final->setSize(250);
     $ano_atividade_final->setSize(100);
     $output_type->setSize(100);
     // validations
     $output_type->addValidation('Output', new TRequiredValidator());
     // add one row for each form field
     $table->addRowSet(new TLabel('Colaborador:'), $colaborador_id);
     $table->addRowSet(new TLabel('Cliente:'), $cliente_id);
     $table->addRowSet(new TLabel('Mês ano inicial:'), array($mes_atividade_inicial, $ano_atividade_inicial));
     $table->addRowSet(new TLabel('Mês ano final:'), array($mes_atividade_final, $ano_atividade_final));
     $table->addRowSet(new TLabel('Output:'), $output_type);
     $this->form->setFields(array($colaborador_id, $cliente_id, $mes_atividade_inicial, $mes_atividade_final, $ano_atividade_inicial, $ano_atividade_final, $output_type));
     $output_type->addItems(array('html' => 'HTML', 'pdf' => 'PDF', 'rtf' => 'RTF'));
     $output_type->setValue('html');
     $output_type->setLayout('horizontal');
     $generate_button = TButton::create('generate', array($this, 'onGenerate'), _t('Generate'), 'fa:check-circle-o green');
     $this->form->addField($generate_button);
     // add a row for the form action
     $table->addRowSet($generate_button, '')->class = 'tformaction';
     parent::add($this->form);
 }
Esempio n. 14
0
 /**
  * Class constructor
  * Creates the page and the registration form
  */
 function __construct()
 {
     parent::__construct();
     // security check
     if (TSession::getValue('logged') !== TRUE) {
         throw new Exception(_t('Not logged'));
     }
     // security check
     TTransaction::open('library');
     if (User::newFromLogin(TSession::getValue('login'))->role->mnemonic !== 'OPERATOR' and User::newFromLogin(TSession::getValue('login'))->role->mnemonic !== 'LIBRARIAN') {
         throw new Exception(_t('Permission denied'));
     }
     TTransaction::close();
     // creates the form
     $this->form = new TForm('form_Member_Report');
     $this->form->class = 'tform';
     $this->form->style = 'width: 600px';
     $table = new TTable();
     $table->width = '100%';
     $this->form->add($table);
     $table->addRowSet(new TLabel(_t('Report filters')), '')->class = 'tformtitle';
     // create the form fields
     $name = new TEntry('name');
     $city_id = new TSeekButton('city_id');
     $city_name = new TEntry('city_name');
     $category_id = new TDBCombo('category_id', 'library', 'Category', 'id', 'description');
     $output_type = new TRadioGroup('output_type');
     $options = array();
     $options['pdf'] = 'PDF';
     $options['rtf'] = 'RTF';
     $output_type->addItems($options);
     $output_type->setValue('pdf');
     $output_type->setLayout('horizontal');
     $obj = new TStandardSeek();
     $action = new TAction(array($obj, 'onSetup'));
     $action->setParameter('database', 'library');
     $action->setParameter('parent', 'form_Member_Report');
     $action->setParameter('model', 'City');
     $action->setParameter('display_field', 'name');
     $action->setParameter('receive_key', 'city_id');
     $action->setParameter('receive_field', 'city_name');
     $city_id->setAction($action);
     // define the sizes
     $name->setSize(200);
     $city_id->setSize(100);
     $category_id->setSize(100);
     $city_name->setEditable(FALSE);
     // add a row for the field name
     $row = $table->addRow();
     $row->addCell(new TLabel(_t('Name') . ': '));
     $cell = $row->addCell($name);
     // add a row for the field city_id
     $row = $table->addRow();
     $row->addCell(new TLabel(_t('City') . ': '));
     $row->addMultiCell($city_id, $city_name);
     // add a row for the field category_id
     $row = $table->addRow();
     $row->addCell(new TLabel(_t('Category') . ': '));
     $cell = $row->addCell($category_id);
     // add a row for the field category_id
     $row = $table->addRow();
     $row->addCell(new TLabel(_t('Output') . ': '));
     $cell = $row->addCell($output_type);
     // create an action button (save)
     $save_button = new TButton('generate');
     // define the button action
     $save_button->setAction(new TAction(array($this, 'onGenerate')), _t('Generate'));
     $save_button->setImage('ico_save.png');
     $table->addRowSet($save_button, '')->class = 'tformaction';
     // define wich are the form fields
     $this->form->setFields(array($name, $city_id, $city_name, $category_id, $output_type, $save_button));
     $vbox = new TVBox();
     $vbox->add($this->form);
     // add the form to the page
     parent::add($vbox);
 }
Esempio n. 15
0
 /**
  * Class constructor
  * Creates the page and the registration form
  */
 function __construct()
 {
     parent::__construct();
     // security check
     if (TSession::getValue('logged') !== TRUE) {
         throw new Exception(_t('Not logged'));
     }
     // security check
     TTransaction::open('changeman');
     if (Member::newFromLogin(TSession::getValue('login'))->role_mnemonic !== 'ADMINISTRATOR' and Member::newFromLogin(TSession::getValue('login'))->role_mnemonic !== 'MANAGER') {
         throw new Exception(_t('Permission denied'));
     }
     TTransaction::close();
     // creates a table
     $table = new TTable();
     // creates the form
     $this->form = new TForm('form_Release');
     $this->form->class = 'tform';
     $this->form->style = 'width: 640px';
     $this->form->add($table);
     $table->width = '100%';
     $table->addRowSet(new TLabel(_t('Release')), '')->class = 'tformtitle';
     $options = array('Y' => _t('Yes'), 'N' => _t('No'));
     // create the form fields
     $id = new TEntry('id');
     $id_project = new TDBCombo('id_project', 'changeman', 'Project', 'id', 'description');
     $name = new TEntry('name');
     $sendmail = new TRadioGroup('sendmail');
     $description = new THtmlEditor('description');
     $id_project->addValidation(_t('Project'), new TRequiredValidator());
     $name->addValidation(_t('Name'), new TRequiredValidator());
     $id->setEditable(FALSE);
     // define the sizes
     $id->setSize(100);
     $id_project->setSize(200);
     $name->setSize(200, 40);
     $description->setSize(530, 200);
     $sendmail->addItems($options);
     $sendmail->setLayout('horizontal');
     $sendmail->setValue('N');
     $table->addRowSet(new TLabel('ID:'), $id);
     $table->addRowSet(new TLabel(_t('Project') . ': '), $id_project);
     $table->addRowSet(new TLabel(_t('Name') . ': '), $name);
     $table->addRowSet(new TLabel(_t('Send e-mail') . ': '), $sendmail);
     $hbox = new THBox();
     $hbox->style = 'margin: 10px';
     $hbox->add($description);
     // add a row for the field description
     $row = $table->addRow();
     $row->addCell($lbl = new TLabel(_t('Description') . ': '));
     $lbl->setFontStyle('b');
     $row = $table->addRow();
     $cell = $row->addCell($hbox);
     $cell->colspan = 3;
     // create an action button (save)
     $save_button = new TButton('save');
     // define the button action
     $save_button->setAction(new TAction(array($this, 'onSave')), _t('Save'));
     $save_button->setImage('ico_save.png');
     $table->addRowSet($save_button, '')->class = 'tformaction';
     // define wich are the form fields
     $this->form->setFields(array($id, $id_project, $name, $description, $sendmail, $save_button));
     // add the form to the page
     parent::add($this->form);
 }
 /**
  * Class constructor
  * Creates the page and the registration form
  */
 function __construct()
 {
     parent::__construct();
     // creates the form
     $this->form = new TForm('form_customer');
     // creates a table
     $table_data = new TTable();
     $table_contact = new TTable();
     $table_skill = new TTable();
     $notebook = new TNotebook(500, 250);
     // add the notebook inside the form
     $this->form->add($notebook);
     $notebook->appendPage('Registration Data', $table_data);
     $notebook->appendPage('Contact (composition)', $table_contact);
     $notebook->appendPage('Skill (aggregation)', $table_skill);
     // create the form fields
     $code = new TEntry('id');
     $name = new TEntry('name');
     $address = new TEntry('address');
     $phone = new TEntry('phone');
     $city_id = new TSeekButton('city_id');
     $city_name = new TEntry('city_name');
     $birthdate = new TDate('birthdate');
     $email = new TEntry('email');
     $gender = new TRadioGroup('gender');
     $status = new TCombo('status');
     $contacts_list = new TMultiField('contacts_list');
     $category_id = new TDBCombo('category_id', 'samples', 'Category', 'id', 'name');
     // add field validators
     $name->addValidation('Name', new TRequiredValidator());
     $city_id->addValidation('City', new TRequiredValidator());
     $birthdate->addValidation('Birthdate', new TRequiredValidator());
     $category_id->addValidation('Category', new TRequiredValidator());
     $obj = new CitySeek();
     $city_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);
     $city_id->setSize(100);
     $city_name->setSize(150);
     $city_name->setEditable(FALSE);
     $name->setSize(320);
     $address->setSize(320);
     $phone->setSize(120);
     $email->setSize(160);
     $birthdate->setSize(90);
     $status->setSize(120);
     $category_id->setSize(120);
     // add a row for the field code
     $table_data->addRowSet(new TLabel('Code:'), $code);
     $table_data->addRowSet(new TLabel('Name:'), $name);
     $table_data->addRowSet(new TLabel('Address:'), $address);
     $table_data->addRowSet(new TLabel('City:'), array($city_id, new TLabel('Name:'), $city_name));
     $table_data->addRowSet(new TLabel('Phone:'), array($phone, new TLabel('BirthDate:'), $birthdate));
     $table_data->addRowSet(new TLabel('Status:'), array($status, new TLabel('Email:'), $email));
     $table_data->addRowSet(new TLabel('Category:'), array($category_id, new TLabel('Gender:'), $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('CustomerDataGridView', 'onReload')), 'Go to Listing');
     $button2->setImage('ico_datagrid.gif');
     // define wich are the form fields
     $this->form->setFields(array($code, $name, $address, $phone, $city_id, $city_name, $birthdate, $email, $gender, $status, $category_id, $contacts_list, $skill_list, $button1, $button2));
     $subtable = new TTable();
     $row = $subtable->addRow();
     $row->addCell($button1);
     $row->addCell($button2);
     // wrap the page content
     $vbox = new TVBox();
     $vbox->add(new TXMLBreadCrumb('menu.xml', 'CustomerDataGridView'));
     $vbox->add($this->form);
     $vbox->add($subtable);
     // add the form inside the page
     parent::add($vbox);
 }
Esempio n. 17
0
 /**
  * Class constructor
  * Creates the page and the registration form
  */
 function __construct()
 {
     parent::__construct();
     // security check
     if (TSession::getValue('logged') !== TRUE) {
         throw new Exception(_t('Not logged'));
     }
     // security check
     TTransaction::open('library');
     if (User::newFromLogin(TSession::getValue('login'))->role->mnemonic !== 'OPERATOR' and User::newFromLogin(TSession::getValue('login'))->role->mnemonic !== 'LIBRARIAN') {
         throw new Exception(_t('Permission denied'));
     }
     TTransaction::close();
     $this->notebook = new TNotebook();
     $this->notebook->setSize(500, 190);
     // creates the form
     $this->form = new TForm('form_Book_Report');
     $this->notebook->appendPage(_t('Data'), $this->form);
     // creates a table
     $table = new TTable();
     // add the table inside the form
     $this->form->add($table);
     // create the form fields
     $title = new TEntry('title');
     $author_id = new TSeekButton('author_id');
     $author_name = new TEntry('author_name');
     $collection_id = new TDBCombo('collection_id', 'library', 'Collection', 'id', 'description');
     $output_type = new TRadioGroup('output_type');
     $options = array();
     $options['pdf'] = 'PDF';
     $options['rtf'] = 'RTF';
     $output_type->addItems($options);
     $output_type->setValue('pdf');
     $output_type->setLayout('horizontal');
     $obj = new TStandardSeek();
     $action = new TAction(array($obj, 'onSetup'));
     $action->setParameter('database', 'library');
     $action->setParameter('parent', 'form_Book_Report');
     $action->setParameter('model', 'Author');
     $action->setParameter('display_field', 'name');
     $action->setParameter('receive_key', 'author_id');
     $action->setParameter('receive_field', 'author_name');
     $author_id->setAction($action);
     // define the sizes
     $title->setSize(200);
     $author_id->setSize(100);
     $collection_id->setSize(100);
     $author_name->setEditable(FALSE);
     // add a row for the field
     $row = $table->addRow();
     $row->addCell($l = new TLabel(_t('Report filters')));
     $l->setFontStyle('b');
     // add a row for the field title
     $row = $table->addRow();
     $row->addCell(new TLabel(_t('Title') . ': '));
     $cell = $row->addCell($title);
     $cell->colspan = 2;
     // add a row for the field author_id
     $row = $table->addRow();
     $row->addCell(new TLabel(_t('Author') . ': '));
     $row->addCell($author_id);
     $row->addCell($author_name);
     // add a row for the field collection_id
     $row = $table->addRow();
     $row->addCell(new TLabel(_t('Collection') . ': '));
     $cell = $row->addCell($collection_id);
     $cell->colspan = 2;
     // add a row for the field collection_id
     $row = $table->addRow();
     $row->addCell(new TLabel(_t('Output') . ': '));
     $cell = $row->addCell($output_type);
     $cell->colspan = 2;
     // create an action button (save)
     $save_button = new TButton('generate');
     // define the button action
     $save_button->setAction(new TAction(array($this, 'onGenerate')), _t('Generate'));
     $save_button->setImage('ico_save.png');
     // add a row for the form action
     $row = $table->addRow();
     $row->addCell($save_button);
     // define wich are the form fields
     $this->form->setFields(array($title, $author_id, $author_name, $collection_id, $output_type, $save_button));
     // add the form to the page
     parent::add($this->notebook);
 }
 /**
  * Class constructor
  * Creates the page
  */
 function __construct()
 {
     parent::__construct();
     // create the form
     $this->form = new TForm();
     $this->form->class = 'tform';
     // creates the form field container
     $table = new TTable();
     $table->width = '100%';
     $this->form->add($table);
     // title row
     $table->addRowSet(new TLabel('Manual selections'), '')->class = 'tformtitle';
     // create the form fields
     $radio = new TRadioGroup('radio');
     $check = new TCheckGroup('check');
     $combo = new TCombo('combo');
     $select = new TSelect('select');
     $search = new TMultiSearch('search');
     $autocomp = new TEntry('autocomplete');
     $search->setMinLength(3);
     $radio->setLayout('horizontal');
     $check->setLayout('horizontal');
     $combo->setSize(160);
     $select->setSize(200, 70);
     // open database transaction
     TTransaction::open('samples');
     // items repository
     $repository = new TRepository('Category');
     // load all objects
     $collection = $repository->load(new TCriteria());
     // add the combo items
     $items = array();
     foreach ($collection as $object) {
         $items[$object->id] = $object->name;
     }
     $radio->addItems($items);
     $check->addItems($items);
     $combo->addItems($items);
     $select->addItems($items);
     $search->addItems($items);
     $autocomp->setCompletion(array_values($items));
     TTransaction::close();
     // add the fields to the table
     $table->addRowSet(new TLabel('TRadioGroup:'), $radio);
     $table->addRowSet(new TLabel('TCheckGroup:'), $check);
     $table->addRowSet(new TLabel('TCombo:'), $combo);
     $table->addRowSet(new TLabel('TSelect:'), $select);
     $table->addRowSet(new TLabel('TMultiSearch:'), $search);
     $table->addRowSet(new TLabel('Autocomplete:'), $autocomp);
     // creates the action button
     $button1 = new TButton('action1');
     $button1->setAction(new TAction(array($this, 'onSave')), 'Save');
     $button1->setImage('ico_save.png');
     $table->addRowSet($button1, '')->class = 'tformaction';
     // define wich are the form fields
     $this->form->setFields(array($radio, $check, $combo, $select, $search, $autocomp, $button1));
     // wrap the page content using vertical box
     $vbox = new TVBox();
     $vbox->add(new TXMLBreadCrumb('menu.xml', __CLASS__));
     $vbox->add($this->form);
     parent::add($vbox);
 }
 /**
  * Class constructor
  * Creates the page and the registration form
  */
 function __construct()
 {
     parent::__construct();
     // security check
     if (TSession::getValue('logged') !== TRUE) {
         throw new Exception(_t('Not logged'));
     }
     // security check
     TTransaction::open('changeman');
     if (Member::newFromLogin(TSession::getValue('login'))->role_mnemonic !== 'ADMINISTRATOR') {
         throw new Exception(_t('Permission denied'));
     }
     TTransaction::close();
     // defines the database
     parent::setDatabase('changeman');
     // defines the active record
     parent::setActiveRecord('Status');
     // creates the form
     $this->form = new TQuickForm('form_Status');
     $this->form->class = 'tform';
     $this->form->style = 'width: 640px';
     $this->form->setFormTitle(_t('Status'));
     $options = array('Y' => _t('Yes'), 'N' => _t('No'));
     // create the form fields
     $id = new TEntry('id');
     $description = new TEntry('description');
     $final_state = new TRadioGroup('final_state');
     $id->setEditable(FALSE);
     $final_state->addItems($options);
     $final_state->setLayout('horizontal');
     // define the sizes
     $this->form->addQuickField('ID', $id, 100);
     $this->form->addQuickField(_t('Description') . ': ', $description, 200);
     $this->form->addQuickField(_t('Final state') . ': ', $final_state, 200);
     // define the form action
     $this->form->addQuickAction(_t('Save'), new TAction(array($this, 'onSave')), 'ico_save.png');
     $this->form->addQuickAction(_t('New'), new TAction(array($this, 'onEdit')), 'ico_new.png');
     // creates a DataGrid
     $this->datagrid = new TQuickGrid();
     $this->datagrid->setHeight(320);
     // creates the datagrid columns
     $this->datagrid->addQuickColumn('ID', 'id', 'left', 70, new TAction(array($this, 'onReload')), array('order', 'id'));
     $this->datagrid->addQuickColumn(_t('Description'), 'description', 'left', 300, new TAction(array($this, 'onReload')), array('order', 'description'));
     $this->datagrid->addQuickColumn(_t('Final state'), 'final_state', 'left', 200, new TAction(array($this, 'onReload')), array('order', 'final_state'));
     // add the actions to the datagrid
     $this->datagrid->addQuickAction(_t('Edit'), new TDataGridAction(array($this, 'onEdit')), 'id', 'ico_edit.png');
     $this->datagrid->addQuickAction(_t('Delete'), new TDataGridAction(array($this, 'onDelete')), 'id', 'ico_delete.png');
     // create the datagrid model
     $this->datagrid->createModel();
     // creates the page navigation
     $this->pageNavigation = new TPageNavigation();
     $this->pageNavigation->setAction(new TAction(array($this, 'onReload')));
     $this->pageNavigation->setWidth($this->datagrid->getWidth());
     // creates the page structure using a vbox
     $container = new TVBox();
     $container->add($this->form);
     $container->add($this->datagrid);
     $container->add($this->pageNavigation);
     // add the container inside the page
     parent::add($container);
 }
 /**
  * Class constructor
  * Creates the page
  */
 function __construct()
 {
     parent::__construct();
     // create the form
     $this->form = new TForm();
     $this->form->class = 'tform';
     // creates the form field container
     $table = new TTable();
     $table->width = '100%';
     $this->form->add($table);
     // title row
     $table->addRowSet(new TLabel('Static selections'), '')->class = 'tformtitle';
     // create the form fields
     $radio = new TRadioGroup('radio');
     $check = new TCheckGroup('check');
     $combo = new TCombo('combo');
     $select = new TSelect('select');
     $search = new TMultiSearch('search');
     $autocomp = new TEntry('autocomplete');
     $radio->setLayout('horizontal');
     $check->setLayout('horizontal');
     $combo->setSize(100);
     $select->setSize(200, 70);
     $search->setSize(300, 70);
     $items = array();
     $items['a'] = 'Item a';
     $items['b'] = 'Item b';
     $items['c'] = 'Item c';
     $radio->addItems($items);
     $check->addItems($items);
     $combo->addItems($items);
     $select->addItems($items);
     $search->addItems($items);
     $autocomp->setCompletion(array_values($items));
     foreach ($radio->getLabels() as $key => $label) {
         $label->setTip("Radio {$key}");
     }
     foreach ($check->getLabels() as $key => $label) {
         $label->setTip("Check {$key}");
     }
     // define default values
     $search->setMinLength(3);
     $radio->setValue('a');
     $check->setValue(array('a', 'c'));
     $combo->setValue('b');
     $select->setValue(array('b', 'c'));
     $search->setValue(array('b' => 'Item b'));
     // add the fields to the table
     $table->addRowSet(new TLabel('TRadioGroup:'), $radio);
     $table->addRowSet(new TLabel('TCheckGroup:'), $check);
     $table->addRowSet(new TLabel('TCombo:'), $combo);
     $table->addRowSet(new TLabel('TSelect:'), $select);
     $table->addRowSet(new TLabel('TMultiSearch:'), $search);
     $table->addRowSet(new TLabel('Autocomplete:'), $autocomp);
     // creates the action button
     $button1 = new TButton('action1');
     $button1->setAction(new TAction(array($this, 'onSave')), 'Save');
     $button1->setImage('ico_save.png');
     $table->addRowSet($button1, '')->class = 'tformaction';
     // define wich are the form fields
     $this->form->setFields(array($radio, $check, $combo, $select, $search, $autocomp, $button1));
     // wrap the page content using vertical box
     $vbox = new TVBox();
     $vbox->add(new TXMLBreadCrumb('menu.xml', __CLASS__));
     $vbox->add($this->form);
     parent::add($vbox);
 }