Ejemplo n.º 1
0
 /**
  * 
  */
 public function makeTText($properties)
 {
     $widget = new TText((string) $properties->{'name'});
     $widget->setValue((string) $properties->{'value'});
     $widget->setSize((int) $properties->{'width'}, (int) $properties->{'height'});
     if (isset($properties->{'tip'})) {
         $widget->setTip((string) $properties->{'tip'});
     }
     if (isset($properties->{'required'}) and $properties->{'required'} == '1') {
         $widget->addValidation((string) $properties->{'name'}, new TRequiredValidator());
     }
     $this->fields[] = $widget;
     $this->fieldsByName[(string) $properties->{'name'}] = $widget;
     return $widget;
 }
 /**
  * Construtor de classe
  * Cria o formulário de material consumo
  */
 function __construct()
 {
     parent::__construct();
     parent::setDatabase("app");
     parent::setActiveRecord("MaterialConsumoDerivado");
     parent::setDefaultOrder("id", "asc");
     // Cria o formulário
     $this->form = new TQuickForm('form_MaterialConsumo');
     $this->form->class = 'tform';
     // CSS class
     $this->form->setFormTitle('Material de consumo (novos ou necessidade extraordinária) a ser incluído na Proposta Orçamentária de 2017');
     // define the form title
     // Cria os campos de formulário
     $id = new THidden('id');
     $tipo_material_consumo_id = new TDBCombo('tipo_material_consumo_id', 'app', 'TipoMaterialConsumo', 'id', 'nome', 'nome');
     $tipo_material_consumo_id->addValidation('Tipo do material', new TRequiredValidator());
     $change_action = new TAction(array($this, 'onChangeAction'));
     $tipo_material_consumo_id->setChangeAction($change_action);
     $descricao = new TEntry('descricao');
     $justificativa = new TText('justificativa');
     $justificativa->addValidation('Justificativa', new TRequiredValidator());
     $quantidade = new TEntry('quantidade');
     $quantidade->addValidation('Quantidade', new TRequiredValidator());
     $quantidade->addValidation('Quantidade', new TNumericValidator());
     $custo = new TEntry('custo');
     $custo->addValidation('Custo', new TRequiredValidator());
     $custo->addValidation('Custo', new TNumericValidator());
     $total = new TEntry('total');
     $total->setEditable(false);
     // Adiciona os campos
     $this->form->addQuickField('', $id);
     //$this->form->add($id);
     $this->form->addQuickField('Tipo de material consumo', $tipo_material_consumo_id, 480);
     $this->form->addQuickField('Descrição', $descricao, 480);
     $this->form->addQuickField('Justificativa', $justificativa, 200);
     $justificativa->setSize(480, 100);
     $this->form->addQuickField('Quantidade', $quantidade, 200);
     $this->form->addQuickField('Previsão de custo unitário', $custo, 200);
     $this->form->addQuickField('Total', $total, 200);
     // Cria as ações do formulário
     $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');
     $actionHelp = new TAction(array("PaginaAjuda", 'onHelp'));
     $actionHelp->setParameters(array("key" => 3));
     $this->form->addQuickAction(_t('Help'), $actionHelp, 'ico_help.png');
     // Cria o datagrid
     $this->datagrid = new TQuickGrid();
     $this->datagrid->setHeight(320);
     // Cria as colunas do datagrid
     $this->datagrid->addQuickColumn('Tipo de material consumo', 'tipoMaterialConsumo->nome', 'left', 200);
     $this->datagrid->addQuickColumn('Descrição', 'descricao', 'left', 200);
     $this->datagrid->addQuickColumn('Quant.', 'quantidade', 'right', 100);
     $this->datagrid->addQuickColumn('Previsão de custo', 'custo', 'right', 100);
     $this->datagrid->addQuickColumn('Total', 'total', 'right', 100);
     // Cria as ações do datagrid
     $edit_action = new TDataGridAction(array($this, 'onEdit'));
     $delete_action = new TDataGridAction(array($this, 'onDelete'));
     // Adiciona as ações do datagrid
     $this->datagrid->addQuickAction(_t('Edit'), $edit_action, 'id', 'ico_edit.png');
     $this->datagrid->addQuickAction(_t('Delete'), $delete_action, 'id', 'ico_delete.png');
     // Cria o modelo do datagrid
     $this->datagrid->createModel();
     // Cria a navegação de página
     $this->pageNavigation = new TPageNavigation();
     $this->pageNavigation->setAction(new TAction(array($this, 'onReload')));
     $this->pageNavigation->setWidth($this->datagrid->getWidth());
     // Cria o container da página
     $container = TVBox::pack($this->form, $this->datagrid, $this->pageNavigation);
     parent::add($container);
 }
Ejemplo n.º 3
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;
     $panel = new TPanel(100, 10);
     // add the notebook inside the form
     $this->form->add($panel);
     $panel->put(new TLabel('CRM Titulo:'), 0, 0);
     // $notebook->appendPage('Cidade', $table_contact);
     //        $notebook->appendPage('Skill (aggregation)', $table_skill);
     // create the form fields
     $code = new TEntry('id');
     //        $crm_id = new TDBCombo('crm_id', 'db_crmbf', 'CRM', 'id', 'titulo');
     $crm_id = new TEntry('crm_nome');
     $tiporegistro_id = new TDBCombo('tiporegistro_id', 'db_crmbf', 'RegistroTipo', 'id', 'nome');
     $registro = new TText('registro');
     $temporegistro = new TEntry('tempo_registro');
     //        $temporegistro->setEditable(false);
     $dataregistro = new TDate('data_registro');
     $hora_registro = new TEntry('hora_registro');
     $numero_registro = new TEntry('numero_registro');
     // add field validators
     $registro->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);
     $crm_id->setSize(320);
     $registro->setSize(320);
     $temporegistro->setSize(160);
     //$temporegistro->setValue(date("d/m/Y H:i:s"));
     $tiporegistro_id->setSize(160);
     //$dataregistro->setRange(0,1000,1);
     $dataregistro->setSize(90);
     // $hora_registro->setRange(0,100,1);
     $hora_registro->setSize(150);
     $hora_registro->setTip('Horario EX: 8:14');
     $numero_registro->setSize(320);
     $panel->put("Codigo: ", 10, 25);
     $panel->put("CRM: ", 10, 50);
     $panel->put("Tipo: ", 10, 75);
     $panel->put("Tempo: ", 10, 100);
     $panel->put("Data: ", 10, 125);
     $panel->put("Horario: ", 10, 150);
     $panel->put("Nº Registro: ", 10, 175);
     $panel->put("Registro: ", 10, 200);
     $panel->put($code, 100, 25);
     $panel->put($crm_id, 100, 50);
     $panel->put($tiporegistro_id, 100, 75);
     $panel->put($temporegistro, 100, 100);
     $panel->put($dataregistro, 100, 125);
     $panel->put($hora_registro, 100, 150);
     $panel->put($numero_registro, 100, 175);
     $panel->put($registro, 100, 200);
     //        $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('CRM Titulo:'));
     //        $cell = $row->addCell($crm_id);
     //
     //        // add a row for the field Telefone
     //        $row = $table->addRow();
     //        $row->addCell(new TLabel('Tipo Registro:'));
     //        $cell = $row->addCell($tiporegistro_id);
     //
     //        // add a row for the field Email
     //        $row = $table->addRow();
     //        $row->addCell(new TLabel('Tempo:'));
     //        $cell = $row->addCell($temporegistro);
     //
     //        // add a row for the field celular
     //        $row = $table->addRow();
     //        $row->addCell(new TLabel('Data:'));
     //        $cell = $row->addCell($dataregistro);
     //
     //        // add a row for the field skype
     //        $row = $table->addRow();
     //        $row->addCell(new TLabel('Hora:'));
     //        $cell = $row->addCell($hora_registro);
     //
     //        // add a row for the field endereco
     //        $row = $table->addRow();
     //        $row->addCell(new TLabel('Numero Registro:'));
     //        $row->addCell($numero_registro);
     //
     //        // add a row for the field name
     //        $row = $table->addRow();
     //        $row->addCell(new TLabel('Registro:'));
     //        $cell = $row->addCell($registro);
     // 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');
     $button1->setProperty('width', 150);
     //  create an action button (go to list)
     $button2 = new TButton('list');
     $button2->setAction(new TAction(array('RegistroList', 'onReload')), 'Ir para Listagem');
     $button2->setImage('ico_datagrid.gif');
     $button2->setProperty('width', 100);
     $panel->put($button1, 100, 325);
     $panel->put($button2, 200, 325);
     // define wich are the form fields
     $this->form->setFields(array($code, $crm_id, $registro, $temporegistro, $tiporegistro_id, $dataregistro, $hora_registro, $numero_registro, $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($panel);
     //        parent::add($table_layout);
 }
Ejemplo n.º 4
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();
     $notebook = new TNotebook(500, 320);
     // add the notebook inside the form
     $this->form->add($notebook);
     $notebook->appendPage('Cadastro Registro CRM', $table);
     // create the form fields
     $code = new TEntry('id');
     $crm_id = new TCombo('crm_id');
     $tiporegistro_id = new TDBCombo('tiporegistro_id', 'db_crmbf', 'RegistroTipo', 'id', 'nome');
     $registro = new TText('registro');
     $temporegistro = new TEntry('tempo_registro');
     //        $temporegistro->setEditable(false);
     $dataregistro = new TDate('data_registro');
     $hora_registro = new TEntry('hora_registro');
     $numero_registro = new TEntry('numero_registro');
     // finaliza a transacao
     TTransaction::close();
     $items1 = array();
     //dados do cliente CRM
     TTransaction::open('db_crmbf');
     $criteria = new TCriteria();
     $criteria->add(new TFilter('cliente_id', '=', $_GET['fk']));
     $repository = new TRepository('CRM');
     $cadastros = $repository->load($criteria);
     //adiciona os objetos no combo
     foreach ($cadastros as $object) {
         $items1[$object->id] = $object->titulo;
     }
     // adiciona as opcoes na combo
     $crm_id->addItems($items1);
     TTransaction::close();
     // add field validators
     $registro->addValidation('Registro deve ser informado', new TRequiredValidator());
     // define some properties for the form fields
     $code->setEditable(FALSE);
     $code->setSize(100);
     $crm_id->setSize(320);
     //        $crm_id->setEditable(FALSE);
     $registro->setSize(320);
     $temporegistro->setSize(160);
     $temporegistro->setValue(date("d/m/Y H:i:s"));
     $tiporegistro_id->setSize(160);
     $dataregistro->setSize(90);
     $hora_registro->setSize(150);
     $hora_registro->setTip('Horario EX: 8:14');
     $numero_registro->setSize(320);
     $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('CRM Titulo:'));
     $cell = $row->addCell($crm_id);
     // add a row for the field Telefone
     $row = $table->addRow();
     $row->addCell(new TLabel('Tipo Registro:'));
     $cell = $row->addCell($tiporegistro_id);
     // add a row for the field Email
     $row = $table->addRow();
     $row->addCell(new TLabel('Tempo:'));
     $cell = $row->addCell($temporegistro);
     // add a row for the field celular
     $row = $table->addRow();
     $row->addCell(new TLabel('Data:'));
     $cell = $row->addCell($dataregistro);
     // add a row for the field skype
     $row = $table->addRow();
     $row->addCell(new TLabel('Hora:'));
     $cell = $row->addCell($hora_registro);
     // add a row for the field endereco
     $row = $table->addRow();
     $row->addCell(new TLabel('Numero Registro:'));
     $row->addCell($numero_registro);
     // add a row for the field name
     $row = $table->addRow();
     $row->addCell(new TLabel('Registro:'));
     $cell = $row->addCell($registro);
     // 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
     $button2 = new TButton('action3');
     $action2 = new TAction(array('ClienteRegistroDetalhe', 'onEdit'));
     //parametro fk e key da sessao
     $action2->setParameter('fk', TSession::getValue('cliente_fk'));
     $action2->setParameter('key', TSession::getValue('crm_key'));
     $button2->setImage('ico_datagrid.png');
     $button2->setAction($action2, 'Voltar');
     // define wich are the form fields
     $this->form->setFields(array($code, $crm_id, $registro, $temporegistro, $tiporegistro_id, $dataregistro, $hora_registro, $numero_registro, $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);
 }
Ejemplo n.º 5
0
 /**
  * Class constructor
  * Creates the page and the registration form
  */
 function __construct()
 {
     parent::__construct();
     // creates the table container
     $table = new TTable();
     $table->style = 'width:100%';
     // creates the form
     $this->form = new TForm('form_System_Charge');
     $this->form->class = 'tform';
     // add the notebook inside the form
     $this->form->add($table);
     $row1 = $table->addRow();
     $row1->class = 'tformtitle';
     $cell1 = $row1->addCell(new TLabel('Add new charge'), '');
     $cell1->colspan = 2;
     // create the form fields
     $id = new TEntry('id');
     $client = new TDBCombo('client', 'permission', 'SystemClients', 'name', 'name');
     $amount = new TEntry('amount');
     $description = new TText('description');
     $date = new TDate('date');
     $id->setEditable(false);
     // define the sizes
     $id->setSize(100);
     $client->setSize(300);
     $amount->setSize(300);
     $description->setSize(300);
     $date->setSize(300);
     // validations
     $client->addValidation('client', new TRequiredValidator());
     $amount->addValidation('amount', new TRequiredValidator());
     $description->addValidation('description', new TRequiredValidator());
     $date->addValidation('date', new TRequiredValidator());
     // add a row for the field id
     $table->addRowSet(new TLabel('ID:'), $id);
     $table->addRowSet(new TLabel('Client: '), $client);
     $table->addRowSet(new TLabel('Amount: '), $amount);
     $table->addRowSet(new TLabel('Description: '), $description);
     $table->addRowSet(new TLabel('Date: '), $date);
     // create an action button (save)
     $save_button = new TButton('save');
     $save_button->setAction(new TAction(array($this, 'onSave')), _t('Save'));
     $save_button->setImage('fa:floppy-o');
     // create an new button (edit with no parameters)
     $new_button = new TButton('new');
     $new_button->setAction(new TAction(array($this, 'onEdit')), _t('New'));
     $new_button->setImage('fa:plus-square green');
     $list_button = new TButton('list');
     $list_button->setAction(new TAction(array('SystemChargeList', 'onReload')), _t('Back to the listing'));
     $list_button->setImage('fa:table blue');
     // define the form fields
     $this->form->setFields(array($id, $client, $amount, $description, $date, $save_button, $new_button, $list_button));
     $buttons = new THBox();
     $buttons->add($save_button);
     $buttons->add($new_button);
     $buttons->add($list_button);
     $container = new TTable();
     $container->width = '80%';
     $container->addRow()->addCell(new TXMLBreadCrumb('menu.xml', 'SystemChargeList'));
     $container->addRow()->addCell($this->form);
     $row = $table->addRow();
     $row->class = 'tformaction';
     $cell = $row->addCell($buttons);
     $cell->colspan = 2;
     // add the form to the page
     parent::add($container);
 }
 /**
  * Class constructor
  * Creates the page and the registration form
  */
 function __construct()
 {
     parent::__construct();
     $string = new StringsUtil();
     // creates the form
     $this->form = new TForm('form_Atividade');
     $this->form->class = 'tform';
     // CSS class
     $this->form->style = 'width: 500px';
     // add a table inside form
     $table = new TTable();
     $table->width = '100%';
     $this->form->add($table);
     // add a row for the form title
     $row = $table->addRow();
     $row->class = 'tformtitle';
     // CSS class
     $row->addCell(new TLabel('Atividade'))->colspan = 2;
     // busca dados do banco
     try {
         TTransaction::open('atividade');
         $logado = Pessoa::retornaUsuario();
         $ultimoPonto = Ponto::retornaUltimoPonto($logado->pessoa_codigo);
         $ponto = new Ponto($ultimoPonto);
         if ($ponto->hora_saida) {
             $action = new TAction(array('PontoFormList', 'onReload'));
             new TMessage('error', 'Não existe ponto com horario em aberto!', $action);
         }
         $data_padrao = $string->formatDateBR($ponto->data_ponto);
         $hora_padrao = Ponto::retornaHoraInicio($string->formatDate($data_padrao), $logado->pessoa_codigo);
         TTransaction::close();
     } catch (Exception $e) {
         new TMessage('error', '<b>Error</b> ' . $e->getMessage());
     }
     // create the form fields
     $id = new THidden('id');
     $data_atividade = new TEntry('data_atividade');
     $data_atividade->setMask('dd/mm/yyyy');
     $data_atividade->setValue($data_padrao);
     $data_atividade->setEditable(FALSE);
     $hora_inicio = new TEntry('hora_inicio');
     $hora_inicio->setEditable(FALSE);
     $hora_inicio->setValue($hora_padrao);
     $hora_fim = new THidden('hora_fim');
     $hora_fim->setEditable(FALSE);
     $tempo_atividade = new TEntry('tempo_atividade');
     $tempo_atividade->setEditable(FALSE);
     $qtde_horas = new TCombo('qtde_horas');
     $qtde_minutos = new TCombo('qtde_minutos');
     $descricao = new TText('descricao');
     $colaborador_id = new THidden('colaborador_id');
     $colaborador_id->setValue($logado->pessoa_codigo);
     $colaborador_nome = new TEntry('colaborador_nome');
     $colaborador_nome->setEditable(FALSE);
     $colaborador_nome->setValue($logado->pessoa_nome);
     $tipo_atividade_id = new TDBCombo('tipo_atividade_id', 'atividade', 'TipoAtividade', 'id', 'nome', 'nome');
     $sistema_id = new TDBCombo('sistema_id', 'atividade', 'Sistema', 'id', 'nome');
     $ticket_id = new TCombo('ticket_id');
     $criteria = new TCriteria();
     $criteria->add(new TFilter("status_ticket_id", "IN", array(1, 5)));
     $newparam['order'] = 'id';
     $newparam['direction'] = 'asc';
     $criteria->setProperties($newparam);
     // order, offset
     $this->onComboTicket($criteria);
     $horario = explode(':', $hora_padrao);
     // cria combos de horas e minutos
     $combo_horas = array();
     for ($i = 8; $i <= 18; $i++) {
         $combo_horas[$i] = str_pad($i, 2, 0, STR_PAD_LEFT);
     }
     $qtde_horas->addItems($combo_horas);
     $qtde_horas->setValue($horario[0]);
     $qtde_horas->setDefaultOption(FALSE);
     $combo_minutos = array();
     for ($i = 0; $i <= 59; $i++) {
         $combo_minutos[$i] = str_pad($i, 2, 0, STR_PAD_LEFT);
     }
     $qtde_minutos->addItems($combo_minutos);
     $qtde_minutos->setValue($horario[1]);
     $qtde_minutos->setDefaultOption(FALSE);
     // set exit action for input_exit
     $change_action = new TAction(array($this, 'onChangeAction'));
     $qtde_horas->setChangeAction($change_action);
     $qtde_minutos->setChangeAction($change_action);
     $change_atividade_action = new TAction(array($this, 'onTrocaTipoAtividade'));
     $tipo_atividade_id->setChangeAction($change_atividade_action);
     $change_ticket_action = new TAction(array($this, 'onTrocaTicket'));
     $ticket_id->setChangeAction($change_ticket_action);
     // define the sizes
     $id->setSize(100);
     $data_atividade->setSize(100);
     $hora_inicio->setSize(100);
     $hora_fim->setSize(100);
     $qtde_horas->setSize(60);
     $qtde_minutos->setSize(60);
     $tempo_atividade->setSize(100);
     $descricao->setSize(300, 80);
     $colaborador_id->setSize(200);
     $tipo_atividade_id->setSize(200);
     $ticket_id->setSize(300);
     // validações
     $tempo_atividade->addValidation('Hora Fim', new THoraFimValidator());
     $tipo_atividade_id->addValidation('Tipo de Atividade', new TRequiredValidator());
     $ticket_id->addValidation('Ticket', new TRequiredValidator());
     $sistema_id->addValidation('Sistema', new TRequiredValidator());
     $descricao->addValidation('Descrição', new TMinLengthValidator(), array(10));
     $sem_atividade = TButton::create('atividade', array($this, 'onSemAtividade'), 'Sem Registro', 'ico_add.png');
     $this->form->addField($sem_atividade);
     // add one row for each form field
     $table->addRowSet(new TLabel('Colaborador:'), $colaborador_nome);
     $table->addRowSet(new TLabel('Data Atividade:'), array($data_atividade, $label_data = new TLabel('Data do último ponto')));
     $label_data->setFontColor('#A9A9A9');
     $table->addRowSet(new TLabel('Hora Inicio:'), $hora_inicio);
     $table->addRowSet($label_qtde_horas = new TLabel('Hora Fim:'), array($qtde_horas, $qtde_minutos, $sem_atividade));
     $label_qtde_horas->setFontColor('#FF0000');
     $table->addRowSet(new TLabel('Tempo Atividade:'), $tempo_atividade);
     $table->addRowSet($label_atividade = new TLabel('Tipo Atividade:'), $tipo_atividade_id);
     $label_atividade->setFontColor('#FF0000');
     $table->addRowSet($label_ticket = new TLabel('Ticket:'), $ticket_id);
     $label_ticket->setFontColor('#FF0000');
     $table->addRowSet($label_sistema = new TLabel('Sistema:'), $sistema_id);
     $label_sistema->setFontColor('#FF0000');
     $table->addRowSet($label_descricao = new TLabel('Descrição:'), $descricao);
     $label_descricao->setFontColor('#FF0000');
     $table->addRowSet(new TLabel(''), $id);
     $table->addRowSet(new TLabel(''), $colaborador_id);
     $table->addRowSet(new TLabel(''), $hora_fim);
     //esconder
     $this->form->setFields(array($id, $data_atividade, $hora_inicio, $qtde_horas, $qtde_minutos, $hora_fim, $tempo_atividade, $descricao, $colaborador_id, $colaborador_nome, $tipo_atividade_id, $ticket_id, $sistema_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('AtividadeList', 'onClean'), _t('List'), 'fa:table blue');
     $this->form->addField($save_button);
     $this->form->addField($new_button);
     $this->form->addField($del_button);
     $this->form->addField($list_button);
     $buttons_box = new THBox();
     $buttons_box->add($save_button);
     $buttons_box->add($new_button);
     $buttons_box->add($del_button);
     $buttons_box->add($list_button);
     // add a row for the form action
     $row = $table->addRow();
     $row->class = 'tformaction';
     // CSS class
     $row->addCell($buttons_box)->colspan = 2;
     //                        TScript::create(' $( "#descricao" ).focus(); ');
     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_RequisitoDesenvolvimento');
     $this->form->class = 'tform';
     // CSS class
     $this->form->style = 'width: 500px';
     $this->string = new StringsUtil();
     // add a table inside form
     $table = new TTable();
     $table->width = '100%';
     $this->form->add($table);
     // add a row for the form title
     $row = $table->addRow();
     $row->class = 'tformtitle';
     // CSS class
     $row->addCell(new TLabel('Cadastro de DTr'))->colspan = 2;
     // create the form fields
     $id = new THidden('id');
     $titulo = new TEntry('titulo');
     $data_cadastro = new TEntry('data_cadastro');
     $data_cadastro->setEditable(FALSE);
     $data_cadastro->setMask('dd/mm/yyyy');
     $data_cadastro->setValue(date('d/m/Y'));
     $rotina = new TEntry('rotina');
     $objetivo = new TText('objetivo');
     $entrada = new TText('entrada');
     $processamento = new TText('processamento');
     $saida = new TText('saida');
     $ticket_id = new TEntry('ticket_id');
     $ticket_id->setEditable(FALSE);
     $ticket_titulo = new TEntry('ticket_titulo');
     $ticket_titulo->setEditable(FALSE);
     // define the sizes
     $id->setSize(100);
     $titulo->setSize(300);
     $data_cadastro->setSize(100);
     $rotina->setSize(300);
     $objetivo->setSize(300, 60);
     $entrada->setSize(300, 60);
     $processamento->setSize(300, 60);
     $saida->setSize(300, 60);
     $ticket_id->setSize(45);
     $ticket_titulo->setSize(250);
     // validations
     $titulo->addValidation('Título', new TRequiredValidator());
     $objetivo->addValidation('Objetivo', new TRequiredValidator());
     $ticket_id->addValidation('Ticket', new TRequiredValidator());
     // add one row for each form field
     $table->addRowSet($label_titulo = new TLabel('Título:'), $titulo);
     $label_titulo->setFontColor('#FF0000');
     $table->addRowSet($label_ticket_id = new TLabel('Ticket:'), array($ticket_id, $ticket_titulo));
     $label_ticket_id->setFontColor('#FF0000');
     $table->addRowSet(new TLabel('Data de Cadastro:'), $data_cadastro);
     $table->addRowSet(new TLabel('Rotina:'), $rotina);
     $table->addRowSet($label_objetivo = new TLabel('Objetivo:'), $objetivo);
     $label_objetivo->setFontColor('#FF0000');
     $table->addRowSet(new TLabel('Entrada:'), $entrada);
     $table->addRowSet(new TLabel('Processamento:'), $processamento);
     $table->addRowSet(new TLabel('Saida:'), $saida);
     $table->addRowSet(new TLabel(''), $id);
     $this->form->setFields(array($id, $titulo, $data_cadastro, $rotina, $objetivo, $entrada, $processamento, $saida, $ticket_id, $ticket_titulo));
     // create the form actions
     $save_button = TButton::create('save', array($this, 'onSave'), _t('Save'), 'fa:floppy-o');
     $list_button = TButton::create('list', array('RequisitoDesenvolvimentoList', 'onReload'), _t('List'), 'fa:table blue');
     $gerar_dtr = TButton::create('gerar_dtr', array($this, 'onGenerate'), 'Gerar DTr', 'fa:floppy-o');
     $gerar_kanban = TButton::create('gerar_kanban', array($this, 'onGenerateKanban'), 'Gerar Kanban', 'fa:floppy-o');
     TButton::disableField('form_RequisitoDesenvolvimento', 'save');
     TButton::disableField('form_RequisitoDesenvolvimento', 'gerar_dtr');
     TButton::disableField('form_RequisitoDesenvolvimento', 'gerar_kanban');
     $this->form->addField($save_button);
     $this->form->addField($list_button);
     $this->form->addField($gerar_dtr);
     $this->form->addField($gerar_kanban);
     $buttons_box = new THBox();
     $buttons_box->add($save_button);
     $buttons_box->add($list_button);
     $buttons_box->add($gerar_dtr);
     $buttons_box->add($gerar_kanban);
     // add a row for the form action
     $row = $table->addRow();
     $row->class = 'tformaction';
     // CSS class
     $row->addCell($buttons_box)->colspan = 2;
     parent::add($this->form);
 }