/**
  * 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();
     // load the styles
     TPage::include_css('app/resources/formdecorator.css');
     // create the HTML Renderer
     $html = new THtmlRenderer('app/resources/formdecorator.html');
     // create the form using TQuickForm class
     $this->form = new TQuickForm();
     // create the form fields
     $id = new TEntry('id');
     $description = new TEntry('description');
     $date = new TDate('date');
     $time = new TEntry('time');
     $number = new TEntry('number');
     $text = new TText('text');
     $description->setTip('Type the description here...');
     $date->setMask('dd/mm/yyyy');
     // define date mask
     $time->setMask('99:99');
     $number->setNumericMask(2, ',', '.');
     // define numeric input
     // add the fields inside the form
     $this->form->addQuickField('Id', $id, 40);
     $this->form->addQuickField('Description', $description, 200);
     $this->form->addQuickField('Date (dd/mm/yyyy)', $date, 80);
     $this->form->addQuickField('Time (99:99)', $time, 60);
     $this->form->addQuickField('Numeric Input (9.999,99)', $number, 100);
     $this->form->addQuickField('Text', $text, 120);
     $text->setSize(200, 100);
     // define the form action
     $this->form->addQuickAction('Save', new TAction(array($this, 'onSave')), 'ico_save.png');
     // replace the main section variables
     $replace = array('form' => $this->form);
     $html->enableSection('main', $replace);
     // wrap the page content using vertical box
     $vbox = new TVBox();
     $vbox->add(new TXMLBreadCrumb('menu.xml', __CLASS__));
     $vbox->add($html);
     parent::add($vbox);
 }
 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);
 }
 /**
  * Class constructor
  * Creates the page and the registration form
  */
 function __construct()
 {
     parent::__construct();
     // creates the form
     $this->form = new TQuickForm('form_Ponto');
     $this->form->class = 'tform';
     // CSS class
     $this->form->setFormTitle('Ponto');
     // define the form title
     $this->string = new StringsUtil();
     // create the form fields
     $id = new THidden('id');
     $data_ponto = new TDate('data_ponto');
     $data_ponto->setMask('dd/mm/yyyy');
     $change_data_action = new TAction(array($this, 'onChangeDataAction'));
     $data_ponto->setExitAction($change_data_action);
     $hora_entrada = new THidden('hora_entrada');
     $hora_saida = new THidden('hora_saida');
     $qtde_horas = new TCombo('qtde_horas');
     $qtde_minutos = new TCombo('qtde_minutos');
     $qtde_horas_final = new TCombo('qtde_horas_final');
     $qtde_minutos_final = new TCombo('qtde_minutos_final');
     $colaborador_id = new THidden('colaborador_id');
     TTransaction::open('atividade');
     $logado = Pessoa::retornaUsuario();
     $saldo_mes = Ponto::saldoHorasMes($logado->pessoa_codigo);
     TTransaction::close();
     $colaborador_id->setValue($logado->pessoa_codigo);
     $colaborador_nome = new TEntry('colaborador_nome');
     $colaborador_nome->setEditable(FALSE);
     $colaborador_nome->setValue($logado->pessoa_nome);
     $saldo_horas = new TEntry('saldo_horas');
     $saldo_horas->setEditable(FALSE);
     $saldo_horas->setValue($saldo_mes);
     // cria combos de horas e minutos
     $combo_horas = array();
     $combo_horas_final = array();
     for ($i = 8; $i <= 18; $i++) {
         $combo_horas[$i] = str_pad($i, 2, 0, STR_PAD_LEFT);
         $combo_horas_final[$i] = str_pad($i, 2, 0, STR_PAD_LEFT);
     }
     $combo_horas_final[19] = '19';
     $qtde_horas->addItems($combo_horas);
     $qtde_horas->setValue(8);
     $qtde_horas->setSize(60);
     $qtde_horas->setDefaultOption(FALSE);
     $qtde_horas_final->addItems($combo_horas_final);
     $qtde_horas_final->setSize(60);
     $combo_minutos = array();
     $combo_minutos_final = array();
     for ($i = 0; $i <= 59; $i++) {
         $combo_minutos[$i] = str_pad($i, 2, 0, STR_PAD_LEFT);
         $combo_minutos_final[$i] = str_pad($i, 2, 0, STR_PAD_LEFT);
     }
     $qtde_minutos->addItems($combo_minutos);
     $qtde_minutos->setValue(0);
     $qtde_minutos->setSize(60);
     $qtde_minutos->setDefaultOption(FALSE);
     $qtde_minutos_final->addItems($combo_minutos_final);
     $qtde_minutos_final->setSize(60);
     // validations
     $data_ponto->addValidation('Data', new TRequiredValidator());
     // add the fields
     $this->form->addQuickField('Colaborador', $colaborador_nome, 200);
     $this->form->addQuickField('Data', $data_ponto, 100);
     $this->form->addQuickFields('Hora entrada', array($qtde_horas, $qtde_minutos));
     $this->form->addQuickFields('Hora saida', array($qtde_horas_final, $qtde_minutos_final));
     $this->form->addQuickField('Saldo no mês:', $saldo_horas, 125);
     $this->form->addQuickField('% Produtividade', new TLabel('<span style="background-color: #00B4FF;"><b>> 49% satisfatoria&nbsp;&nbsp;</b></span><br/><span style="background-color: #FFF800;"><b>30%-49% - Atenção</b></span><br/><span style="background-color: #FF0000;"><b>0-29% Baixa&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</b></span>'), 200);
     $this->form->addQuickField('', $hora_entrada, 200);
     $this->form->addQuickField('', $hora_saida, 200);
     $this->form->addQuickField('', $colaborador_id, 100);
     $this->form->addQuickField('', $id, 100);
     // create the form actions
     $this->form->addQuickAction('Salvar', new TAction(array($this, 'onSave')), 'fa:floppy-o');
     $this->form->addQuickAction(_t('New'), new TAction(array($this, 'onEdit')), 'fa:plus-square green');
     $this->form->addQuickAction('Excluir', new TAction(array($this, 'onDelete')), 'fa:trash-o red fa-lg');
     TButton::disableField('form_Ponto', 'salvar');
     TButton::disableField('form_Ponto', 'excluir');
     // creates a DataGrid
     $this->datagrid = new TQuickGrid();
     $this->datagrid->setHeight(320);
     // creates the datagrid columns
     $data_ponto = $this->datagrid->addQuickColumn('Data', 'data_ponto', 'left', 50);
     $hora_entrada = $this->datagrid->addQuickColumn('H.Ent', 'hora_entrada', 'left', 30);
     $hora_saida = $this->datagrid->addQuickColumn('H.Sai', 'hora_saida', 'left', 30);
     $hora_ponto = $this->datagrid->addQuickColumn('H.Pto', 'hora_ponto', 'left', 30);
     $intervalo = $this->datagrid->addQuickColumn('Atividades', 'intervalo', 'right', 30);
     $produtividade = $this->datagrid->addQuickColumn('% prod.', 'produtividade', 'right', 55);
     // transformers
     $hora_entrada->setTransformer(array($this, 'tiraSegundos'));
     $hora_saida->setTransformer(array($this, 'tiraSegundos'));
     $hora_ponto->setTransformer(array($this, 'calculaDiferenca'));
     $intervalo->setTransformer(array($this, 'retornaIntervalo'));
     $produtividade->setTransformer(array($this, 'calculaPercentualProdutividade'));
     // create the datagrid actions
     $edit_action = new TDataGridAction(array($this, 'onEdit'));
     $delete_action = new TDataGridAction(array($this, 'onDelete'));
     // add the actions to the datagrid
     $this->datagrid->addQuickAction(_t('Edit'), $edit_action, 'id', 'fa:pencil-square-o blue fa-lg');
     // 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());
     // 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());
     // create the page container
     $container = TVBox::pack($this->form, $this->datagrid, $this->pageNavigation);
     parent::add($container);
 }
 /**
  * 
  */
 public function makeTDate($properties)
 {
     $widget = new TDate((string) $properties->{'name'});
     $widget->setValue((string) $properties->{'value'});
     $widget->setSize((int) $properties->{'width'});
     $widget->setEditable((string) $properties->{'editable'});
     if ((string) $properties->{'mask'}) {
         $widget->setMask((string) $properties->{'mask'});
     }
     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;
 }
 /**
  * Class constructor
  * Creates the page, the form and the listing
  */
 public function __construct()
 {
     parent::__construct();
     // creates the form
     $this->form = new TForm('form_FreqServList');
     $this->form->class = 'tform';
     // creates a table
     $table = new TTable();
     $table->style = 'width:100%';
     $table->addRowSet(new TLabel('Frequência'), '')->class = 'tformtitle';
     // add the table inside the form
     $this->form->add($table);
     // create the form fields
     //$id = new TEntry('ID');
     //$id->setValue(TSession::getValue('Frequencia_id'));
     $servidor_id = new TDBSeekButton('servidor_id', 'lacenrh', 'form_FreqServList', 'Servidor', 'servidor', 'servidor_id', 'servidor_nome');
     $servidor_id->setValue(TSession::getValue('Frequencia_servidor_id'));
     $servidor_nome = new TEntry('servidor_nome');
     $servidor_nome->setValue(TSession::getValue('Frequencia_servidor_nome'));
     $diames = new TDate('Data');
     $diames->setValue(TSession::getValue('Frequencia_diames'));
     //$id->setSize(40);
     $servidor_id->setSize(40);
     $servidor_nome->setSize(300);
     $diames->setSize(100);
     $diames->setMask('dd/mm/yyyy');
     // add rows for the filter fields
     //$row=$table->addRowSet(new TLabel(('ID') . ': '), $id);
     $row = $table->addRowSet(new TLabel('Servidor' . ': '), $servidor_id);
     $row = $table->addRowSet(new TLabel('Nome' . ': '), $servidor_nome);
     $row = $table->addRowSet(new TLabel('Data' . ': '), $diames);
     //$row=$table->addRowSet(new TLabel(('Unidade') . ': '), $unidade);
     // create two action buttons to the form
     $find_button = new TButton('find');
     $clear_button = new Tbutton('clear');
     $new_button = new TButton('new');
     // define the button actions
     $find_button->setAction(new TAction(array($this, 'onSearch')), _t('Find'));
     $find_button->setImage('fa:search fa-lg');
     $clear_button->setAction(new TAction(array($this, 'onClear')), 'Limpar');
     $clear_button->setImage('fa:undo red fa-lg');
     $new_button->setAction(new TAction(array('FrequenciaServidorForm', 'onEdit')), _t('New'));
     $new_button->setImage('fa:plus-square green fa-lg');
     // define wich are the form fields
     $this->form->setFields(array($servidor_id, $servidor_nome, $diames, $find_button, $clear_button, $new_button));
     $container = new THBox();
     $container->add($find_button);
     $container->add($clear_button);
     $container->add($new_button);
     $row = $table->addRow();
     $row->class = 'tformaction';
     $cell = $row->addCell($container);
     $cell->colspan = 2;
     // creates a DataGrid
     $this->datagrid = new TDataGrid();
     $this->datagrid->style = 'width: 100%';
     $this->datagrid->setHeight(320);
     // creates the datagrid columns
     $servidor_nome = new TDataGridColumn('servidor_nome', 'Nome', 'left', 200);
     $diames = new TDataGridColumn('diames', 'Data', 'center', 50);
     $entrada = new TDataGridColumn('entrada', 'Entrada', 'center', 40);
     $intervalo_inicio = new TDataGridColumn('intervalo_inicio', 'Saída', 'center', 50);
     $intervalo_fim = new TDataGridColumn('intervalo_fim', 'Entrada', 'center', 50);
     $saida = new TDataGridColumn('saida', 'Saída', 'center', 50);
     $ausencia_desc = new TDataGridColumn('ausencia_desc', 'Ausência', 'left');
     // add the columns to the DataGrid
     $this->datagrid->addColumn($servidor_nome);
     $this->datagrid->addColumn($diames);
     $this->datagrid->addColumn($entrada);
     $this->datagrid->addColumn($intervalo_inicio);
     $this->datagrid->addColumn($intervalo_fim);
     $this->datagrid->addColumn($saida);
     $this->datagrid->addColumn($ausencia_desc);
     $order_servidor_nome = new TAction(array($this, 'onReload'));
     $order_servidor_nome->setParameter('order', 'servidor_nome');
     $servidor_nome->setAction($order_servidor_nome);
     $order_diames = new TAction(array($this, 'onReload'));
     $order_diames->setParameter('order', 'diames');
     $diames->setAction($order_diames);
     // inline editing
     $servidor_entrada_edit = new TDataGridAction(array($this, 'onInlineEdit'));
     $servidor_entrada_edit->setField('id');
     $entrada->setEditAction($servidor_entrada_edit);
     $servidor_intervalo_inicio_edit = new TDataGridAction(array($this, 'onInlineEdit'));
     $servidor_intervalo_inicio_edit->setField('id');
     $intervalo_inicio->setEditAction($servidor_intervalo_inicio_edit);
     $servidor_intervalo_fim_edit = new TDataGridAction(array($this, 'onInlineEdit'));
     $servidor_intervalo_fim_edit->setField('id');
     $intervalo_fim->setEditAction($servidor_intervalo_fim_edit);
     $servidor_saida_edit = new TDataGridAction(array($this, 'onInlineEdit'));
     $servidor_saida_edit->setField('id');
     $saida->setEditAction($servidor_saida_edit);
     // creates two datagrid actions
     $action1 = new TDataGridAction(array('FrequenciaServidorForm', 'onEdit'));
     $action1->setLabel(_t('Edit'));
     $action1->setImage('fa:pencil-square-o blue');
     $action1->setField('id');
     $action2 = new TDataGridAction(array($this, 'onDelete'));
     $action2->setLabel(_t('Delete'));
     $action2->setImage('fa:trash-o red');
     $action2->setField('id');
     $action3 = new TDataGridAction(array('FrequenciaServidorForm', 'onFrequencia'));
     $action3->setLabel('Informação');
     $action3->setImage('fa:info-circle blue');
     $action3->setField('id');
     // add the actions to the datagrid
     $this->datagrid->addAction($action3);
     $this->datagrid->addAction($action1);
     $this->datagrid->addAction($action2);
     // 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 table
     $table = new TTable();
     $table->style = 'width: 80%';
     $table->addRow()->addCell(new TXMLBreadCrumb('menu.xml', 'FrequenciaServidorList'));
     $table->addRow()->addCell($this->form);
     $table->addRow()->addCell($this->datagrid);
     $table->addRow()->addCell($this->pageNavigation);
     // add the table inside the page
     parent::add($table);
 }
 /**
  * Class constructor
  * Creates the page, the form and the listing
  */
 public function __construct()
 {
     parent::__construct();
     // creates the form
     $this->form = new TForm('form_search_RequisitoDesenvolvimento');
     $this->form->class = 'tform';
     // CSS class
     // creates a table
     $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 DRs'))->colspan = 2;
     // create the form fields
     $id = new TEntry('ticket_id');
     $id->setMask('99999');
     $titulo = new TEntry('titulo');
     $data_cadastro = new TDate('data_cadastro');
     $data_cadastro->setMask('dd/mm/yyyy');
     // define the sizes
     $id->setSize(50);
     $titulo->setSize(200);
     $data_cadastro->setSize(100);
     // add one row for each form field
     $table->addRowSet(new TLabel('Ticket:'), $id);
     $table->addRowSet(new TLabel('Título:'), $titulo);
     $table->addRowSet(new TLabel('Data:'), $data_cadastro);
     $this->form->setFields(array($id, $titulo, $data_cadastro));
     // keep the form filled during navigation with session data
     $this->form->setData(TSession::getValue('RequisitoDesenvolvimento_filter_data'));
     // create two action buttons to the form
     $find_button = TButton::create('find', array($this, 'onSearch'), _t('Find'), 'ico_find.png');
     $clean_button = TButton::create('clean', array($this, 'onClean'), 'Limpar', 'ico_close.png');
     $this->form->addField($find_button);
     $this->form->addField($clean_button);
     $buttons_box = new THBox();
     $buttons_box->add($find_button);
     $buttons_box->add($clean_button);
     // add a row for the form action
     $row = $table->addRow();
     $row->class = 'tformaction';
     // CSS class
     $row->addCell($buttons_box)->colspan = 2;
     // creates a Datagrid
     $this->datagrid = new TDataGrid();
     $this->datagrid->setHeight(320);
     // creates the datagrid columns
     $id = new TDataGridColumn('ticket_id', 'ID', 'right', 20);
     $data_cadastro = new TDataGridColumn('data_cadastro', 'Data', 'left', 80);
     $titulo = new TDataGridColumn('titulo', 'Título', 'left', 300);
     $ticket_id = new TDataGridColumn('ticket->titulo', 'Ticket', 'right', 300);
     $data_cadastro->setTransformer(array('StringsUtil', 'formatDateBR'));
     // add the columns to the DataGrid
     $this->datagrid->addColumn($id);
     $this->datagrid->addColumn($data_cadastro);
     $this->datagrid->addColumn($titulo);
     $this->datagrid->addColumn($ticket_id);
     // creates the datagrid column actions
     $order_id = new TAction(array($this, 'onReload'));
     $order_id->setParameter('order', 'id');
     $id->setAction($order_id);
     $order_titulo = new TAction(array($this, 'onReload'));
     $order_titulo->setParameter('order', 'titulo');
     $titulo->setAction($order_titulo);
     $order_data_cadastro = new TAction(array($this, 'onReload'));
     $order_data_cadastro->setParameter('order', 'data_cadastro');
     $data_cadastro->setAction($order_data_cadastro);
     $order_ticket_id = new TAction(array($this, 'onReload'));
     $order_ticket_id->setParameter('order', 'ticket->titulo');
     $ticket_id->setAction($order_ticket_id);
     // creates two datagrid actions
     $action1 = new TDataGridAction(array('RequisitoDesenvolvimentoForm', 'onEdit'));
     $action1->setLabel(_t('Edit'));
     $action1->setImage('fa:pencil-square-o blue fa-lg');
     $action1->setField('id');
     $action2 = new TDataGridAction(array($this, 'onDelete'));
     $action2->setLabel(_t('Delete'));
     $action2->setImage('fa:trash-o red fa-lg');
     $action2->setField('id');
     // add the actions to the datagrid
     $this->datagrid->addAction($action1);
     $this->datagrid->addAction($action2);
     // 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());
     // create the page container
     $container = TVBox::pack($this->form, $this->datagrid, $this->pageNavigation);
     $container->style = 'width: 100%;max-width: 1200px;';
     $this->datagrid->style = '  width: 100%;  max-width: 1200px;';
     parent::add($container);
 }
 /**
  * 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);
 }
 /**
  * Class constructor
  * Creates the page, the form and the listing
  */
 public function __construct()
 {
     parent::__construct();
     $this->string = new StringsUtil();
     // creates the form
     $this->form = new TForm('form_search_Atividade');
     $this->form->class = 'tform';
     // CSS class
     // creates a table
     $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;
     // create the form fields
     $id = new THidden('id');
     $data_atividade_inicial = new TDate('data_atividade_inicial');
     $data_atividade_inicial->setMask('dd/mm/yyyy');
     $data_atividade_final = new TDate('data_atividade_final');
     $data_atividade_final->setMask('dd/mm/yyyy');
     $criteria = new TCriteria();
     $criteria->add(new TFilter("origem", "=", 1));
     $criteria->add(new TFilter("codigo_cadastro_origem", "=", 100));
     $criteria->add(new TFilter("ativo", "=", 1));
     $criteria->add(new TFilter("usuario", "is not "));
     $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');
     $ticket_id = new TDBMultiSearch('ticket_id', 'atividade', 'Ticket', 'id', 'titulo', 'titulo');
     $pesquisa_master = new TEntry('pesquisa_master');
     $criteria = new TCriteria();
     $criteria->add(new TFilter("ativo", "=", 1));
     $newparam['order'] = 'pessoa_nome';
     $newparam['direction'] = 'asc';
     $criteria->setProperties($newparam);
     // order, offset
     $solicitante_id = new TDBSeekButton('solicitante_id', 'atividade', 'form_search_Ticket', 'Pessoa', 'pessoa_nome', 'solicitante_id', 'solicitante_nome', $criteria);
     $solicitante_nome = new TEntry('solicitante_nome');
     $solicitante_nome->setEditable(FALSE);
     $total_atividades = new TEntry('total_atividades');
     $total_atividades->setEditable(FALSE);
     // define the sizes
     $id->setSize(50);
     $data_atividade_inicial->setSize(100);
     $data_atividade_final->setSize(100);
     $colaborador_id->setSize(300);
     $tipo_atividade_id->setSize(300);
     $ticket_id->setMinLength(0);
     $ticket_id->setMaxSize(1);
     $ticket_id->setSize(300);
     $ticket_id->setOperator('ilike');
     $solicitante_id->setSize(40);
     $solicitante_nome->setSize(235);
     $total_atividades->setSize(100);
     $pesquisa_master->setSize(300);
     // add one row for each form field
     $table->addRowSet(new TLabel('Solicitante:'), array($solicitante_id, $solicitante_nome));
     $table->addRowSet(new TLabel('Colaborador:'), $colaborador_id);
     $table->addRowSet(new TLabel('Dt. Atividades inicio:'), array($data_atividade_inicial, $label_data_fim = new TLabel('Fim:'), $data_atividade_final));
     $label_data_fim->setSize(48);
     $table->addRowSet(new TLabel('Atividade:'), $tipo_atividade_id);
     $table->addRowSet(new TLabel('Ticket:'), $ticket_id);
     $table->addRowSet(new TLabel('Pesquisa por palavra:'), $pesquisa_master);
     $table->addRowSet(new TLabel('Total horas atividades:'), $total_atividades);
     $table->addRowSet(new TLabel(''), $id);
     $this->form->setFields(array($id, $data_atividade_inicial, $data_atividade_final, $colaborador_id, $tipo_atividade_id, $ticket_id, $solicitante_id, $solicitante_nome, $pesquisa_master, $total_atividades));
     $change_data = new TAction(array($this, 'onChangeData'));
     $data_atividade_inicial->setExitAction($change_data);
     $data_atividade_final->setExitAction($change_data);
     // keep the form filled during navigation with session data
     $this->form->setData(TSession::getValue('Atividade_filter_data'));
     // create two action buttons to the form
     $find_button = TButton::create('find', array($this, 'onSearch'), _t('Find'), 'ico_find.png');
     $new_button = TButton::create('new', array('AtividadeForm', 'onEdit'), _t('New'), 'fa:plus-square green');
     $clean_button = TButton::create('clean', array($this, 'onClean'), 'Limpar', 'ico_close.png');
     $this->form->addField($find_button);
     $this->form->addField($new_button);
     $this->form->addField($clean_button);
     $buttons_box = new THBox();
     $buttons_box->add($find_button);
     $buttons_box->add($new_button);
     $buttons_box->add($clean_button);
     // add a row for the form action
     $row = $table->addRow();
     $row->class = 'tformaction';
     // CSS class
     $row->addCell($buttons_box)->colspan = 2;
     // creates a Datagrid
     $this->datagrid = new TDataGrid();
     $this->datagrid->setHeight(320);
     // creates the datagrid columns
     $data_atividade = new TDataGridColumn('data_atividade', 'Data', 'right', 40);
     $hora_inicio = new TDataGridColumn('hora_inicio', 'Inicio', 'right', 20);
     $hora_fim = new TDataGridColumn('hora_fim', 'Fim', 'right', 20);
     $hora_qte = new TDataGridColumn('hora_qte', 'Qtde', 'right', 20);
     $colaborador_id = new TDataGridColumn('pessoa->pessoa_nome', 'Colaborador', 'left', 50);
     $tipo_atividade_id = new TDataGridColumn('tipo_atividade->nome', 'Atividade', 'left', 100);
     //get_tipo_atividade()->nome
     $sistema_id = new TDataGridColumn('sistema->nome', 'Sistema', 'left', 100);
     $ticket_id = new TDataGridColumn('ticket->titulo', 'Ticket', 'left', 200);
     // get_ticket()->titulo
     // transformers
     $colaborador_id->setTransformer(array($this, 'retornaPessoa'));
     $hora_qte->setTransformer(array($this, 'calculaDiferenca'));
     $data_atividade->setTransformer(array('StringsUtil', 'formatDateBR'));
     $hora_inicio->setTransformer(array('StringsUtil', 'retira_segundos'));
     $hora_fim->setTransformer(array('StringsUtil', 'retira_segundos'));
     // add the columns to the DataGrid
     $this->datagrid->addColumn($data_atividade);
     $this->datagrid->addColumn($hora_inicio);
     $this->datagrid->addColumn($hora_fim);
     $this->datagrid->addColumn($hora_qte);
     $this->datagrid->addColumn($colaborador_id);
     $this->datagrid->addColumn($tipo_atividade_id);
     $this->datagrid->addColumn($sistema_id);
     $this->datagrid->addColumn($ticket_id);
     // creates the datagrid column actions
     $order_data_atividade = new TAction(array($this, 'onReload'));
     $order_data_atividade->setParameter('order', 'data_atividade');
     $data_atividade->setAction($order_data_atividade);
     $order_colaborador_id = new TAction(array($this, 'onReload'));
     $order_colaborador_id->setParameter('order', 'pessoa->pessoa_nome');
     $colaborador_id->setAction($order_colaborador_id);
     $order_tipo_atividade_id = new TAction(array($this, 'onReload'));
     $order_tipo_atividade_id->setParameter('order', 'tipo_atividade->nome');
     $tipo_atividade_id->setAction($order_tipo_atividade_id);
     $order_sistema_id = new TAction(array($this, 'onReload'));
     $order_sistema_id->setParameter('order', 'sistema->nome');
     $sistema_id->setAction($order_sistema_id);
     $order_ticket_id = new TAction(array($this, 'onReload'));
     $order_ticket_id->setParameter('order', 'ticket->titulo');
     $ticket_id->setAction($order_ticket_id);
     // creates two datagrid actions
     $action1 = new TDataGridAction(array('AtividadeForm', 'onEdit'));
     $action1->setLabel(_t('Edit'));
     $action1->setImage('fa:pencil-square-o blue fa-lg');
     $action1->setField('id');
     // add the actions to the datagrid
     $this->datagrid->addAction($action1);
     // 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());
     // create the page container
     $container = TVBox::pack($this->form, $this->datagrid, $this->pageNavigation);
     $container->style = 'width: 100%;max-width: 1200px;';
     $this->datagrid->style = '  width: 100%;  max-width: 1200px;';
     parent::add($container);
 }
示例#10
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_Loan');
     $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
     $member_id = new TSeekButton('member_id');
     $member_name = new TEntry('member_name');
     $barcode = new TSeekButton('barcode_input');
     $book_title = new TEntry('book_title_input');
     $loan_date1 = new TDate('loan_date1');
     $loan_date2 = new TDate('loan_date2');
     $output_type = new TRadioGroup('output_type');
     $obj = new ItemSeek();
     $action = new TAction(array($obj, 'onReload'));
     $barcode->setAction($action);
     $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_Loan');
     $action->setParameter('model', 'Member');
     $action->setParameter('display_field', 'name');
     $action->setParameter('receive_key', 'member_id');
     $action->setParameter('receive_field', 'member_name');
     $member_id->setAction($action);
     // define the sizes
     $member_name->setEditable(FALSE);
     $book_title->setEditable(FALSE);
     $member_id->setSize(100);
     $barcode->setSize(100);
     $loan_date1->setSize(100);
     $loan_date2->setSize(100);
     $loan_date1->setMask('yyyy-mm-dd');
     $loan_date2->setMask('yyyy-mm-dd');
     // add a row for the field name
     $row = $table->addRow();
     $row->addCell($l = new TLabel(_t('Report filters')));
     $l->setFontStyle('b');
     // add a row for the field name
     $row = $table->addRow();
     $row->addCell(new TLabel(_t('Member') . ': '));
     $cell = $row->addCell($member_id);
     $cell = $row->addCell($member_name);
     // add a row for the field city_id
     $row = $table->addRow();
     $row->addCell(new TLabel(_t('Barcode') . ': '));
     $row->addCell($barcode);
     $row->addCell($book_title);
     // add a row for the field category_id
     $row = $table->addRow();
     $row->addCell(new TLabel(_t('Loan date') . ': '));
     $cell = $row->addCell($loan_date1);
     $cell = $row->addCell($loan_date2);
     // add a row for the field category_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($member_id, $member_name, $barcode, $book_title, $loan_date1, $loan_date2, $output_type, $save_button));
     // add the form to the page
     parent::add($this->notebook);
 }
 /**
  * Class constructor
  * Creates the page and the registration form
  */
 function __construct()
 {
     parent::__construct();
     // creates the form
     $this->form = new TForm('form_FreqServForm');
     $this->form->class = 'tform';
     // creates the table container
     $table = new TTable();
     $table->style = 'width: 100%';
     $table->addRowSet(new TLabel('Frequência'), '', '', '')->class = 'tformtitle';
     // add the table inside the form
     $this->form->add($table);
     $frame_horarios = new TFrame(NULL, 210);
     $frame_horarios->setLegend('Horários');
     $frame_horarios->style .= ';margin: 15px';
     $frame_ausencia = new TFrame(NULL, 210);
     $frame_ausencia->setLegend('Ausência');
     $frame_ausencia->style .= ';margin: 15px';
     // create the form fields
     $id = new TEntry('id');
     $servidor_id = new TDBSeekButton('servidor_id', 'lacenrh', 'form_FreqServForm', 'Servidor', 'servidor', 'servidor_id', 'servidor_nome');
     $servidor_nome = new TEntry('servidor_nome');
     $diames = new TDate('diames');
     $entrada = new TEntry('entrada');
     $intervalo_inicio = new TEntry('intervalo_inicio');
     $intervalo_fim = new TEntry('intervalo_fim');
     $saida = new TEntry('saida');
     $ausencia_id = new TDBSeekButton('ausencia_id', 'lacenrh', 'form_FreqServForm', 'Ausencia', 'ausencia', 'ausencia_id', 'ausencia_desc');
     $ausencia_desc = new TEntry('ausencia_desc');
     $horas_justificadas = new TEntry('horas_justificadas');
     $justificativa = new TText('justificativa');
     $horas_trabalhadas = new TEntry('horas_trabalhadas');
     // define the sizes
     $id->setSize(40);
     $servidor_id->setSize(40);
     $servidor_nome->setSize(300);
     $diames->setSize(100);
     $entrada->setSize(50);
     $intervalo_inicio->setSize(50);
     $intervalo_fim->setSize(50);
     $saida->setSize(50);
     $ausencia_id->setSize(40);
     $ausencia_desc->setSize(200);
     $horas_justificadas->setSize(50);
     $justificativa->setSize(200, 50);
     $horas_trabalhadas->setSize(200, 50);
     // outras propriedades
     $id->setEditable(false);
     $servidor_nome->setEditable(false);
     $diames->setMask('dd/mm/yyyy');
     $entrada->setMask('99:99');
     $entrada->setValue('00:00');
     $intervalo_inicio->setMask('99:99');
     $intervalo_inicio->setValue('00:00');
     $intervalo_fim->setMask('99:99');
     $intervalo_fim->setValue('00:00');
     $saida->setMask('99:99');
     $saida->setValue('00:00');
     $ausencia_desc->setEditable(false);
     $horas_justificadas->setMask('99:99');
     $horas_justificadas->setValue('00:00');
     $horas_trabalhadas->setMask('99:99');
     // validations
     $servidor_id->addValidation('Servidor', new TRequiredValidator());
     $servidor_nome->addValidation('Nome', new TRequiredValidator());
     $diames->addValidation('Data', new TRequiredValidator());
     $table_horarios = new TTable();
     $table_horarios->addRowSet(new TLabel('Data ' . ': '), $diames);
     $table_horarios->addRowSet(new TLabel('Entrada ' . ': '), $entrada);
     $table_horarios->addRowSet(new TLabel('Intervalo - Início ' . ': '), $intervalo_inicio);
     $table_horarios->addRowSet(new TLabel('Intervalo - Fim' . ': '), $intervalo_fim);
     $table_horarios->addRowSet(new TLabel('Saída' . ': '), $saida);
     $frame_horarios->add($table_horarios);
     $table_ausencia = new TTable();
     $table_ausencia->addRowSet(new TLabel('Motivo ' . ': '), $ausencia_id);
     $table_ausencia->addRowSet(new TLabel('Descrição ' . ': '), $ausencia_desc);
     $table_ausencia->addRowSet(new TLabel('Horas Justificadas ' . ': '), $horas_justificadas);
     $table_ausencia->addRowSet(new TLabel('Justificativa ' . ': '), $justificativa);
     $frame_ausencia->add($table_ausencia);
     // add a row for the field id
     $table->addRowSet(new TLabel('ID:'), $id);
     $table->addRowSet(new TLabel('Servidor' . ': '), $servidor_id);
     $table->addRowSet(new TLabel('Nome' . ': '), $servidor_nome);
     $row = $table->addRow();
     $cell = $row->addCell($frame_horarios);
     $cell->colspan = 2;
     $cell = $row->addCell($frame_ausencia);
     $cell->colspan = 2;
     // 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 fa-lg');
     // 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 fa-lg');
     $list_button = new TButton('list');
     $list_button->setAction(new TAction(array('FrequenciaServidorList', 'onReload')), _t('Back to the listing'));
     $list_button->setImage('fa:table blue fa-lg');
     // define the form fields
     $this->form->setFields(array($id, $servidor_id, $servidor_nome, $diames, $entrada, $intervalo_inicio, $intervalo_fim, $saida, $ausencia_id, $ausencia_desc, $horas_justificadas, $justificativa, $horas_trabalhadas, $save_button, $new_button, $list_button));
     $buttons = new THBox();
     $buttons->add($save_button);
     $buttons->add($new_button);
     $buttons->add($list_button);
     $row = $table->addRow();
     $row->class = 'tformaction';
     $cell = $row->addCell($buttons);
     $cell->colspan = 4;
     $container = new TTable();
     $container->style = 'width: 80%';
     $container->addRow()->addCell(new TXMLBreadCrumb('menu.xml', 'FrequenciaServidorList'));
     $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();
     $this->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('Registro de ausências'))->colspan = 2;
     // create the form fields
     $id = new THidden('id');
     $criteria = new TCriteria();
     $criteria->add(new TFilter("origem", "=", 1));
     $criteria->add(new TFilter("codigo_cadastro_origem", "=", 100));
     $criteria->add(new TFilter("ativo", "=", 1));
     $criteria->add(new TFilter("usuario", "is not "));
     $colaborador_id = new TDBCombo('colaborador_id', 'atividade', 'Pessoa', 'pessoa_codigo', 'pessoa_nome', 'pessoa_nome', $criteria);
     $criteria = new TCriteria();
     $criteria->add(new TFilter("id", "in", array(10, 17)));
     $tipo_atividade_id = new TDBCombo('tipo_atividade_id', 'atividade', 'TipoAtividade', 'id', 'nome', 'nome', $criteria);
     $tipo_atividade_id->setDefaultOption(FALSE);
     $data_inicial = new TDate('data_inicial');
     $data_inicial->setMask('dd/mm/yyyy');
     $data_final = new TDate('data_final');
     $data_final->setMask('dd/mm/yyyy');
     // define the sizes
     $id->setSize(100);
     $data_inicial->setSize(100);
     $data_final->setSize(100);
     $colaborador_id->setSize(290);
     $tipo_atividade_id->setSize(290);
     // validações
     $data_inicial->addValidation('Data inicial', new TRequiredValidator());
     $data_final->addValidation('Data final', new TRequiredValidator());
     $colaborador_id->addValidation('Colaborador', new TRequiredValidator());
     $tipo_atividade_id->addValidation('Tipo atividade', new TRequiredValidator());
     // add one row for each form field
     $table->addRowSet($label1 = new TLabel('Colaborador:'), $colaborador_id);
     $label1->setFontColor('#FF0000');
     $table->addRowSet($label2 = new TLabel('Tipo Atividade:'), $tipo_atividade_id);
     $label2->setFontColor('#FF0000');
     $table->addRowSet($label3 = new TLabel('Data inicial:'), array($data_inicial, $label4 = new TLabel('final:'), $data_final));
     $label3->setFontColor('#FF0000');
     $label4->setFontColor('#FF0000');
     $table->addRowSet(new TLabel(''), $id);
     // add some row for the form info
     $row = $table->addRow();
     $row->addCell(new TLabel('Este sistema deve ser utilizado para registrar ausências de dias completos'))->colspan = 2;
     $row = $table->addRow();
     $row->addCell(new TLabel('No periodo selecionado não pode haver ponto cadastrado'))->colspan = 2;
     $row = $table->addRow();
     $row->addCell($label_red = new TLabel('Cuidado para não cadastrar finais de semana e feriados (periodo útil)'))->colspan = 2;
     $label_red->setFontColor('#FF0000');
     $this->form->setFields(array($id, $data_inicial, $data_final, $colaborador_id, $tipo_atividade_id));
     $change_data = new TAction(array($this, 'onChangeData'));
     $data_inicial->setExitAction($change_data);
     $data_final->setExitAction($change_data);
     // 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');
     $this->form->addField($save_button);
     $this->form->addField($new_button);
     $buttons_box = new THBox();
     $buttons_box->add($save_button);
     $buttons_box->add($new_button);
     // 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);
 }
 /**
  * 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 == 'CUSTOMER') {
         throw new Exception(_t('Permission denied'));
     }
     TTransaction::close();
     $table = new TTable();
     // creates the form
     $this->form = new TForm('form_Issue');
     $this->form->add($table);
     $table->width = '100%';
     $this->form->style = 'width: 750px';
     $this->form->class = 'tform';
     $table->addRowSet(new TLabel(_t('Issue')), '')->class = 'tformtitle';
     $table1 = new TTable();
     $table2 = new TTable();
     // create the form fields
     $id = new TEntry('id');
     $id_user = new TDBCombo('id_user', 'changeman', 'Member', 'id', 'name');
     $id_status = new TDBCombo('id_status', 'changeman', 'Status', 'id', 'complete_description');
     $id_project = new TDBCombo('id_project', 'changeman', 'Project', 'id', 'description');
     $id_priority = new TDBCombo('id_priority', 'changeman', 'Priority', 'id', 'description_translated');
     $id_category = new TDBCombo('id_category', 'changeman', 'Category', 'id', 'description_translated');
     $id_release = new TDBCombo('id_release', 'changeman', 'Release', 'id', 'name');
     $id_member = new TDBCombo('id_member', 'changeman', 'Member', 'id', 'name');
     $register_date = new TDate('register_date');
     $close_date = new TDate('close_date');
     $time = new TEntry('issue_time');
     $title = new TEntry('title');
     $description = new THtmlEditor('description');
     $solution = new THtmlEditor('solution');
     $id_user->addValidation(_t('User'), new TRequiredValidator());
     $id_status->addValidation(_t('Status'), new TRequiredValidator());
     $id_project->addValidation(_t('Project'), new TRequiredValidator());
     $id_priority->addValidation(_t('Priority'), new TRequiredValidator());
     $id_category->addValidation(_t('Category'), new TRequiredValidator());
     $register_date->addValidation(_t('Start date'), new TRequiredValidator());
     $title->addValidation(_t('Title'), new TRequiredValidator());
     $description->addValidation(_t('Description'), new TRequiredValidator());
     // define the sizes
     $id->setSize(100);
     $id_user->setSize(200);
     $id_status->setSize(200);
     $id_project->setSize(200);
     $id_priority->setSize(200);
     $id_category->setSize(200);
     $id_release->setSize(200);
     $id_member->setSize(200);
     $register_date->setSize(100);
     $close_date->setSize(100);
     $time->setSize(200);
     $title->setSize(200, 40);
     $description->setSize(680, 300);
     $solution->setSize(680, 300);
     $register_date->setMask('yyyy-mm-dd');
     $close_date->setMask('yyyy-mm-dd');
     $id->setEditable(FALSE);
     // add a row for the field id
     $table1->addRowSet(new TLabel('ID:'), $id);
     $table1->addRowSet(new TLabel(_t('User') . ': '), $id_user);
     $table1->addRowSet(new TLabel(_t('Status') . ': '), $id_status);
     $table1->addRowSet(new TLabel(_t('Project') . ': '), $id_project);
     $table1->addRowSet(new TLabel(_t('Priority') . ': '), $id_priority);
     $table1->addRowSet(new TLabel(_t('Category') . ': '), $id_category);
     $table2->addRowSet(new TLabel(_t('Release') . ': '), $id_release);
     $table2->addRowSet(new TLabel(_t('Assigned to')), $id_member);
     $table2->addRowSet(new TLabel(_t('Start date') . ':'), $register_date);
     $table2->addRowSet(new TLabel(_t('Due date') . ':'), $close_date);
     $table2->addRowSet(new TLabel(_t('Time') . ':'), $time);
     $table2->addRowSet(new TLabel(_t('Title') . ':'), $title);
     $row = $table->addRow();
     $row->addCell($table1);
     $row->addCell($table2);
     $subnotebook = new TNotebook();
     $subnotebook->setSize(710, 320);
     $subnotebook->style = 'padding: 50px';
     $subnotebook->appendPage(_t('Description'), $description);
     $subnotebook->appendPage(_t('Solution'), $solution);
     $hbox = new THBox();
     $hbox->add($subnotebook);
     $hbox->style = 'margin: 10px';
     $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_user, $id_status, $id_project, $id_priority, $id_category, $id_release, $id_member, $register_date, $close_date, $time, $title, $description, $solution, $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_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);
 }
示例#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'));
     }
     // creates a table
     $table = new TTable();
     $table1 = new TTable();
     $table2 = new TTable();
     // creates the form
     $this->form = new TForm('form_Issue');
     $this->form->class = 'tform';
     $this->form->style = 'width: 750px';
     $table->width = '100%';
     $this->form->add($table);
     $table->addRowSet(new TLabel(_t('Issue')), '')->class = 'tformtitle';
     // add the table inside the form
     $this->form->add($table);
     // create the form fields
     $id_project = new TCombo('id_project');
     $id_priority = new TDBCombo('id_priority', 'changeman', 'Priority', 'id', 'description_translated');
     $id_category = new TDBCombo('id_category', 'changeman', 'Category', 'id', 'description_translated');
     $register_date = new TDate('register_date');
     $time = new TEntry('issue_time');
     $title = new TEntry('title');
     $description = new THtmlEditor('description');
     $file = new TFile('file');
     $register_date->setValue(date('Y-m-d'));
     $register_date->setMask('yyyy-mm-dd');
     $time->setValue(date('H:i'));
     $id_priority->setValue(2);
     // default
     $description->style = 'margin: 10px';
     TTransaction::open('changeman');
     $member = Member::newFromLogin(TSession::getValue('login'));
     $member_projects = $member->getProjectsList();
     $id_project->addItems($member_projects);
     // if just one project, its the default
     if (count($member_projects) == 1) {
         $project_keys = array_keys($member_projects);
         $id_project->setValue($project_keys[0]);
     }
     TTransaction::close();
     $id_project->addValidation(_t('Project'), new TRequiredValidator());
     $id_priority->addValidation(_t('Priority'), new TRequiredValidator());
     $id_category->addValidation(_t('Category'), new TRequiredValidator());
     $register_date->addValidation(_t('Start date'), new TRequiredValidator());
     $title->addValidation(_t('Title'), new TRequiredValidator());
     $description->addValidation(_t('Description'), new TRequiredValidator());
     // define the sizes
     $id_project->setSize(200);
     $id_priority->setSize(200);
     $id_category->setSize(200);
     $register_date->setSize(100);
     $file->setSize(250);
     $time->setSize(50);
     $time->setMask('99:99');
     $title->setSize(200, 40);
     $description->setSize(680, 300);
     $table1->addRowSet(new TLabel(_t('Project') . ': '), $id_project);
     $table1->addRowSet(new TLabel(_t('Priority') . ': '), $id_priority);
     $table1->addRowSet(new TLabel(_t('Category') . ': '), $id_category);
     $table2->addRowSet(new TLabel(_t('Start date') . ':'), array($register_date, $time));
     $table2->addRowSet(new TLabel(_t('Title') . ':'), $title);
     $table2->addRowSet(new TLabel(_t('File') . ':'), $file);
     $row = $table->addRow();
     $row->addCell($table1);
     $row->addCell($table2);
     $label_description = new TLabel(_t('Description'));
     $label_description->setFontStyle('b');
     $row = $table->addRow();
     $row->addCell($label_description);
     $row = $table->addRow();
     $cell = $row->addCell($description);
     $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_project, $id_priority, $id_category, $register_date, $time, $title, $file, $description, $save_button));
     // add the form to the page
     parent::add($this->form);
 }