function __construct() { parent::__construct(); //cria os containers $this->form_requisicao = new TForm('form_requisicao'); $this->form_requisicao->class = 'tform'; $this->form_itens = new TForm('form_itens'); $this->form_itens->class = 'tform'; $table_requisicao = new TTable(); $table_requisicao->width = '100%'; $table_itens = new TTable(); $table_itens->width = '100%'; //empacota os dados $this->form_requisicao->add($table_requisicao); $this->form_itens->add($table_itens); //campos da requisicao; $numeroSRP = new TSeekButton('numeroSRP'); $nome = new TEntry('nome'); $numeroProcessoOrigem = new TEntry('numeroProcessoOrigem'); $uasg = new TEntry('uasg'); $validadeAta = new TEntry('validade'); $numeroProcesso = new TEntry('numeroProcesso'); $emissao = new TDate('emissao'); //campos do itens $numeroItem = new TSeekButton('numeroItem'); $item_id = new THidden('item_id'); $descricaoSumaria = new TEntry('descricaoSumaria'); $valorUnitario = new TEntry('valorUnitario'); $quantidade = new TEntry('quantidade'); $prazoEntrega = new TEntry('prazoEntrega'); $justificativa = new TEntry('justificativa'); $addItem = new TButton('addItem'); $save = new TButton('save'); $new = new TButton('new'); $list = new TButton('list'); //ações dos campos $numeroSRP->setAction(new TAction(array(new SrpSeekRequisicao(), 'onReload'))); $numeroProcesso->setExitAction(new TAction(array($this, 'onExitNumeroProcesso'))); $emissao->setExitAction(new TAction(array($this, 'onExitEmissao'))); $numeroItem->setAction(new TAction(array(new ItemSeekRequisicao(), 'onReload'))); $addItem->setAction(new TAction(array($this, 'onAddItem')), 'Adicionar'); $addItem->setImage('fa:plus-square-o'); $save->setAction(new TAction(array($this, 'onSave')), 'Salvar'); $save->setImage('ico_save.png'); $new->setAction(new TAction(array($this, 'onEdit')), 'Novo'); $new->setImage('ico_new.png'); $list->setAction(new TAction(array('RequisicaoList', 'onReload')), 'Voltar para listagem'); $list->setImage('ico_datagrid.png'); //$onProductChange = new TAction(array($this, 'onProductChange')); //$item_id->setExitAction($onProductChange); $quantidade->setExitAction(new TAction(array($this, 'onValidaQuantidade'))); //validadores $numeroSRP->addValidation('Nº SRP', new TRequiredValidator()); $emissao->addValidation('Emissão', new TRequiredValidator()); $numeroItem->addValidation('Item', new TRequiredValidator()); $valorUnitario->addValidation('Preço', new TRequiredValidator()); $quantidade->addValidation('Quantidade', new TRequiredValidator()); $quantidade->addValidation('Quantidade', new TMinValueValidator(), array(1)); $quantidade->addValidation('Quantidade', new TMaxLengthValidator(), array(11)); $justificativa->addValidation('Justificativa', new TRequiredValidator()); $justificativa->addValidation('Justificativa', new TMaxLengthValidator(), array(100)); $prazoEntrega->addValidation('Prazo de entrega', new TRequiredValidator()); $prazoEntrega->addValidation('Prazo de entrega', new TMaxLengthValidator(), array(20)); $numeroProcesso->addValidation('Nº Processo', new TRequiredValidator()); $numeroProcesso->addValidation('Nº Processo', new TMaxLengthValidator(), array(30)); //outras propriedades $descricaoSumaria->setEditable(false); $nome->setEditable(false); $numeroProcessoOrigem->setEditable(false); $uasg->setEditable(false); $validadeAta->setEditable(false); $valorUnitario->setEditable(false); $numeroSRP->setSize(80); $numeroSRP->setMaxLength(10); $emissao->setProperty('style', 'margin-right: 0px;', false); $nome->setSize(300); $nome->setProperty('style', 'margin-right: 10px', false); $numeroProcessoOrigem->setSize(160); $uasg->setSize(70); $validadeAta->setSize(85); $numeroProcesso->setMaxLength(30); $numeroProcesso->setTip('Número do processo gerado no SIGA'); $numeroItem->setSize(60); $numeroItem->setMaxLength(11); $descricaoSumaria->setSize(490); $descricaoSumaria->setProperty('style', 'margin-right: 10px', false); $prazoEntrega->setSize(90); $justificativa->setSize(400); $justificativa->setMaxLength(100); $emissao->setSize(90); $emissao->setMask('dd/mm/yyyy'); $emissao->setValue(date('d/m/Y')); $validadeAta->setMask('dd/mm/yyyy'); $quantidade->class = 'frm_number_only'; $quantidade->setMaxLength(11); $prazoEntrega->setValue('60 Dias'); $prazoEntrega->setMaxLength(20); //$addItem->setProperty('style', 'margin: 0 0 10px 10px;', false); $row = $table_requisicao->addRow(); $row->class = 'tformtitle'; // CSS class $cell = $row->addCell(new TLabel('Requisição de quantitativo')); $cell->colspan = 4; $row = $table_requisicao->addRow(); $row->addCell(new TLabel('Nº SRP:'))->width = '150px'; $row->addCell($numeroSRP); $row->addCell(new TLabel('Nome Licitação:'))->width = '150px'; $row->addCell($nome); $table_requisicao->addRowSet(new TLabel('Proc. Orig:'), $numeroProcessoOrigem, new TLabel('UASG:'), $uasg); $table_requisicao->addRowSet(new TLabel('Validade da Ata:'), $validadeAta, new TLabel('Nº Processo:'), $numeroProcesso); $table_requisicao->addRowSet(new TLabel('Data Emissão:'), $emissao); $row = $table_itens->addRow(); $row->class = 'tformtitle'; // CSS class $cell = $row->addCell(new TLabel('Itens')); $cell->colspan = 4; $row = $table_itens->addRow(); $row->addCell(new TLabel('Item:')); $box = new THBox(); $box->add($numeroItem); $box->add($descricaoSumaria)->style = 'width : 75%;display:inline-block;'; $row->addCell($box); //->style = 'width : 85%'; $table_itens->addRowSet($item_id); $table_itens->addRowSet(new TLabel('Preço:'), $valorUnitario); $table_itens->addRowSet(new TLabel('Quantidade:'), $quantidade); $table_itens->addRowSet(new TLabel('Prazo de entrega:'), $prazoEntrega); $table_itens->addRowSet(new TLabel('Justificativa:'), $justificativa); $row = $table_itens->addRow(); $row->class = 'tformaction'; $row->addCell($addItem)->colspan = 2; //$table_itens->addRowSet($addItem); parent::include_css('app/resources/custom-table.css'); $this->datagrid = new TDataGrid(); $this->datagrid->style = 'width: 100%'; $this->datagrid->class = 'tdatagrid_table customized-table'; $this->datagrid->setHeight(175); $this->datagrid->makeScrollable(); $this->datagrid->disableDefaultClick(); $GnumeroItem = new TDataGridColumn('numeroItem', 'Item', 'center', 50); $GdescricaoSumaria = new TDataGridColumn('descricaoSumaria', 'Descrição', 'left', 230); $Gquantidade = new TDataGridColumn('quantidade', 'Quantidade', 'right', 110); $GvalorUnitario = new TDataGridColumn('valorUnitario', 'Preço', 'right', 110); $Gtotal = new TDataGridColumn('total', 'Total', 'right', 160); //transformers $GvalorUnitario->setTransformer(array($this, 'formatValor')); $Gtotal->setTransformer(array($this, 'formatValor')); $edit = new TDataGridAction(array($this, 'onEditItem')); $edit->setLabel('Editar'); $edit->setImage('ico_edit.png'); $edit->setField('numeroItem'); $delete = new TDataGridAction(array($this, 'onDeleteItem')); $delete->setLabel('Deletar'); $delete->setImage('ico_delete.png'); $delete->setField('numeroItem'); $this->datagrid->addAction($edit); $this->datagrid->addAction($delete); $this->datagrid->addColumn($GnumeroItem); $this->datagrid->addColumn($GdescricaoSumaria); $this->datagrid->addColumn($Gquantidade); $this->datagrid->addColumn($GvalorUnitario); $this->datagrid->addColumn($Gtotal); $this->datagrid->createModel(); $this->form_requisicao->setFields(array($numeroSRP, $nome, $numeroProcessoOrigem, $uasg, $validadeAta, $numeroProcesso, $emissao, $new, $save, $list)); $this->form_itens->setFields(array($item_id, $numeroItem, $descricaoSumaria, $valorUnitario, $quantidade, $prazoEntrega, $justificativa, $addItem)); $hbox = new THBox(); $hbox->add($save); $hbox->add($new); $hbox->add($list); $table_grid = new TTable(); $table_grid->style = 'width: 100%;border-spacing: 0px;'; $table_grid->addRowSet($this->datagrid); $row = $table_grid->addRow(); $row->class = 'tformaction'; // CSS class $row->addCell($hbox)->colspan = 2; $vbox = new TVBox(); $vbox->add($this->form_requisicao); $vbox->add($this->form_itens); $vbox->add($table_grid); $vbox->add(new TLabel(' ')); parent::add($vbox); }
function __construct() { parent::__construct(); parent::setDatabase(APPLICATION_NAME); parent::setActiveRecord('cidade'); $this->form = new \Adianti\Widget\Wrapper\TQuickForm('form_cidade'); $this->form->class = 'tform'; $this->form->style = 'width: 100%'; $this->form->setFormTitle('Cadastro Estados (Cidade)'); $id = new \Adianti\Widget\Form\TEntry('idcidade'); $nome = new \Adianti\Widget\Form\TEntry('nome'); //******* //Entry com resultado da busca $nomeuf = new TEntry('nomeuf'); //******* //Entry com botão de busca $iduf = new TDBSeekButton('iduf', 'sobcontrole', $this->form->getName(), 'uf', 'nome', 'iduf', 'nomeuf'); $id->setEditable(FALSE); $iduf->setEditable(TRUE); $nomeuf->setEditable(FALSE); $iduf->addValidation('UF', new TRequiredValidator()); $nome->addValidation('nome', new TRequiredValidator()); $this->form->addQuickField('ID', $id, 100); $this->form->addQuickField('Nome', $nome, 100); $this->form->addQuickField('UF', $iduf, 100); $this->form->addQuickField('Estado', $nomeuf, 100); $this->form->addQuickAction('Salvar', new \Adianti\Control\TAction(array($this, 'onSave')), 'ico_save.png'); $this->form->addQuickAction('Novo', new \Adianti\Control\TAction(array($this, 'onClear')), 'ico_new.png'); $this->form->addQuickAction('Listar', new \Adianti\Control\TAction(array('CidadeDataGrid', 'onReload')), 'ico_datagrid.png'); $vbox = new \Adianti\Widget\Container\TVBox(); $vbox->add(new \Adianti\Widget\Util\TXMLBreadCrumb('menu.xml', __CLASS__)); $vbox->add($this->form); parent::add($vbox); $this->nomeuf = $nomeuf; }
function __construct() { parent::__construct(); // @todo verificar se APPLICATION_NAME realmente não funciona no hostinger parent::setDatabase(APPLICATION_NAME); parent::setActiveRecord('contabancaria'); $this->form = new \Adianti\Widget\Wrapper\TQuickForm('form_contabancaria'); $this->form->class = 'tform'; $this->form->style = 'width: 100%'; $this->form->setFormTitle('Cadastro Contas Bancárias)'); $id = new \Adianti\Widget\Form\TEntry('idcontabancaria'); $id->setEditable(FALSE); $agencia = new \Adianti\Widget\Form\TEntry('agencia'); $agencia->addValidation('agencia', new TRequiredValidator()); $conta = new \Adianti\Widget\Form\TEntry('conta'); $conta->addValidation('conta', new TRequiredValidator()); $banco_idbanco = new TDBSeekButton('banco_idbanco', 'sobcontrole', $this->form->getName(), 'banco', 'nome', 'banco_idbanco', 'nomebanco'); $banco_idbanco->setSize(50); $banco_idbanco->addValidation('banco', new TRequiredValidator()); $nomebanco = new TEntry('nomebanco'); $nomebanco->setEditable(FALSE); $tipocontabancaria_idtipocontabancaria = new TDBSeekButton('tipocontabancaria_idtipocontabancaria', 'sobcontrole', $this->form->getName(), 'tipocontabancaria', 'descricao', 'tipocontabancaria_idtipocontabancaria', 'descricaotipocontabancaria'); $tipocontabancaria_idtipocontabancaria->setSize(50); $tipocontabancaria_idtipocontabancaria->addValidation('tipocontabancaria', new TRequiredValidator()); $descricaotipocontabancaria = new TEntry('descricaotipocontabancaria'); $descricaotipocontabancaria->setEditable(FALSE); $titular = new \Adianti\Widget\Form\TEntry('titular'); //Entry com botão de busca de cidade $idcidade = new TDBSeekButton2('idcidade', 'sobcontrole', $this->form->getName(), 'cidade', 'nome', 'idcidade', 'nomecidade', NULL, 'uf->nome'); $idcidade->setSize(50); //$idcidade->addValidation('cidade', new TRequiredValidator); //Entry com resultado da buscade cidade $nomecidade = new TEntry('nomecidade'); $nomecidade->setEditable(FALSE); $this->form->addQuickField('ID', $id); $this->form->addQuickField('Agência', $agencia); $this->form->addQuickField('Conta', $conta); $this->form->addQuickFields('Banco', array($banco_idbanco, $nomebanco)); $this->form->addQuickFields('Tipo Conta', array($tipocontabancaria_idtipocontabancaria, $descricaotipocontabancaria)); $this->form->addQuickField('Titular nº', $titular, 50); $this->form->addQuickFields('Cidade', array($idcidade, $nomecidade)); $this->form->addQuickAction('Salvar', new \Adianti\Control\TAction(array($this, 'onSave')), 'ico_save.png'); $this->form->addQuickAction('Novo', new \Adianti\Control\TAction(array($this, 'onClear')), 'ico_new.png'); $this->form->addQuickAction('Listar', new \Adianti\Control\TAction(array('ContabancariaDataGrid', 'onReload')), 'ico_datagrid.png'); $vbox = new \Adianti\Widget\Container\TVBox(); $vbox->add(new \Adianti\Widget\Util\TXMLBreadCrumb('menu.xml', __CLASS__)); $vbox->add($this->form); parent::add($vbox); $this->nomecidade = $nomecidade; $this->descricaotipocontabancaria = $descricaotipocontabancaria; $this->nomebanco = $nomebanco; }
/** * Class constructor * Creates the page and the registration form */ function __construct() { parent::__construct(); // creates the form $this->form = new TForm('form_pessoa'); // creates a table $table_data = new TTable(); $table_contato = new TTable(); $notebook = new TNotebook(500, 250); // add the notebook inside the form $this->form->add($notebook); $notebook->appendPage('Dados Principais', $table_data); $notebook->appendPage('Contatos', $table_contato); // create the form fields $idpessoa = new TEntry('idpessoa'); $nome = new TEntry('nome'); $dtcadastro = new TDate('dtcadastro'); $dtnascimento = new TDate('dtnascimento'); $natureza = new TRadioGroup('natureza'); $idramoatividade = new TDBCombo('idramoatividade', 'sobcontrole', 'ramoatividade', 'idramoatividade', 'descricao'); $obs = new TText('obs'); // add field validators $nome->addValidation('Nome', new TRequiredValidator()); $dtcadastro->addValidation('Data Cadastro', new TRequiredValidator()); $dtnascimento->addValidation('Data Nascimento', new TRequiredValidator()); $idramoatividade->addValidation('Ramo de Atividade', new TRequiredValidator()); $natureza->addValidation('Natureza', new TRequiredValidator()); $itemNatureza = array(); $itemNatureza['F'] = 'Física'; $itemNatureza['J'] = 'Jurídica'; // add the combo options $natureza->addItems($itemNatureza); $natureza->setLayout('horizontal'); // define some properties for the form fields $idpessoa->setEditable(FALSE); $idpessoa->setSize(100); $nome->setSize(320); $obs->setSize(320); $dtcadastro->setSize(90); $dtnascimento->setSize(90); $natureza->setSize(70); $idramoatividade->setSize(120); // add a row for the field code $table_data->addRowSet(new TLabel('ID:'), array($idpessoa, new TLabel('Natureza:'), $natureza)); $table_data->addRowSet(new TLabel('Nome/Fantasia:'), $nome); $table_data->addRowSet(new TLabel('Data Cadastro:'), $dtcadastro); $table_data->addRowSet(new TLabel('Data Nascimento/Início:'), $dtnascimento); $table_data->addRowSet(new TLabel('Ramo de Atividade:'), $idramoatividade); $table_data->addRowSet(new TLabel('Observações:'), $obs); $row = $table_contato->addRow(); // adiciona linha $cell = $row->addCell(new TLabel('<b>Contatos</b>')); // adiciona celular na linha $cell->valign = 'top'; // define alinhamento $listacontatos = new TMultiField('listacontatos'); // cria multifield // com TDBSeekButton //$idtipocontato= new TDBSeekButton('idtipocontato', 'sobcontrole', $this->form->getName(), 'tipocontato', 'descricao', 'listacontatos_idtipocontato', 'listacontatos_descricaotipocontato'); // com TSeekButton /*$idtipocontato= new TSeekButton('idtipocontato'); $auxidtipocontato = new BuscaTipoContato; $auxaction= new TAction(array($auxidtipocontato,'onReload')); $idtipocontato->setAction($auxaction);*/ $idtipocontato = new TDBCombo('idtipocontato', 'sobcontrole', 'tipocontato', 'idtipocontato', 'descricao', 'descricao'); $descricaotipocontato = new \Adianti\Widget\Form\THidden('tipocontato->descricao'); //$descricaotipocontato->setEditable(false); $valorcontato = new TEntry('valorcontato'); $listacontatos->setClass('contato'); // define the returning class // colunas do multifield // coluna do ID do tipo de contato (1->email, 2->telefone, etc...) $listacontatos->addField('idtipocontato', 'ID: ', $idtipocontato, 40); // coluna da descricao do tipo de contato // desta forma o grid OK $listacontatos->addField('tipocontato->descricao', '', $descricaotipocontato, 200); // desta forma o TDBSeekButton fica OK. //$listacontatos->addField('descricaotipocontato', 'Descrição Tipo Contato: ', $descricaotipocontato, 200); // coluna com o valor do contato, número do telefone, celular, etc. $listacontatos->addField('descricao', 'Valor Contato: ', $valorcontato, 200); $listacontatos->setHeight(250); $row = $table_contato->addRow(); $row->addCell($listacontatos); // create an action button $button1 = new TButton('action1'); $button1->setAction(new TAction(array($this, 'onSave')), 'Salvar'); $button1->setImage('ico_save.png'); // create an action button (go to list) $button2 = new TButton('list'); $button2->setAction(new TAction(array('PessoaDataGrid', 'onReload')), 'Listar'); $button2->setImage('ico_datagrid.gif'); $button0 = new TButton('new'); $button0->setAction(new TAction(array($this, 'onClear')), 'Novo'); $button0->setImage('ico_new.png'); // define wich are the form fields $this->form->setFields(array($idpessoa, $nome, $dtcadastro, $dtnascimento, $natureza, $idramoatividade, $obs, $listacontatos, $button0, $button1, $button2)); $subtable = new TTable(); $row = $subtable->addRow(); $row->addCell($button0); $row->addCell($button1); $row->addCell($button2); // wrap the page content $vbox = new TVBox(); $vbox->add(new TXMLBreadCrumb('menu.xml', __CLASS__)); $vbox->add($this->form); $vbox->add($subtable); // add the form inside the page parent::add($vbox); }
/** * */ public function makeTEntry($properties) { $widget = new TEntry((string) $properties->{'name'}); $widget->setValue((string) $properties->{'value'}); $widget->setMask((string) $properties->{'mask'}); $widget->setSize((int) $properties->{'width'}); if (isset($properties->{'maxlen'})) { $widget->setMaxLength((int) $properties->{'maxlen'}); } if (isset($properties->{'tip'})) { $widget->setTip((string) $properties->{'tip'}); } if (isset($properties->{'required'}) and $properties->{'required'} == '1') { $widget->addValidation((string) $properties->{'name'}, new TRequiredValidator()); } $widget->setEditable((string) $properties->{'editable'}); $this->fields[] = $widget; $this->fieldsByName[(string) $properties->{'name'}] = $widget; return $widget; }
/** * Class constructor * Creates the page and the registration form */ function __construct() { parent::__construct(); // Cria o form $this->form = new TForm('form_Usuario'); $this->form->class = 'tform'; // creates the table container $table = new TTable(); $table->style = 'width: 100%'; $table->addRowSet(new TLabel('Usuário'), '', '', '')->class = 'tformtitle'; // adiciona a tabela no form $this->form->add($table); $frame_grupos = new TFrame(NULL, 280); $frame_grupos->setLegend('Grupos'); $frame_grupos->style .= ';margin: 4px'; $frame_funcionalidades = new TFrame(NULL, 280); $frame_funcionalidades->setLegend('Funcionalidades'); $frame_funcionalidades->style .= ';margin: 15px'; // cria os campos de pesquisa do form $id = new TEntry('id'); $nome = new TEntry('nome'); $prontuario = new TEntry('prontuario'); $password = new TPassword('senha'); $repassword = new TPassword('resenha'); $email = new TEntry('email'); $multifield_funcionalidades = new TMultiField('funcionalidades'); $funcionalidade_id = new TDBSeekButton('funcionalidade_id', 'saciq', 'form_Usuario', 'Funcionalidade', 'nome', 'funcionalidades_id', 'funcionalidades_nome'); $funcionalidade_nome = new TEntry('funcionalidade_nome'); $grupos = new TDBCheckGroup('grupos', 'saciq', 'Grupo', 'id', 'nome'); //$frontpage_id = new TDBSeekButton('frontpage_id', 'saciq', 'form_Usuario', 'Funcionalidade', 'nome', 'frontpage_id', 'frontpage_nome'); //$frontpage_nome = new TEntry('frontpage_nome'); $scroll = new TScroll(); $scroll->setSize(290, 230); $scroll->add($grupos); $frame_grupos->add($scroll); $frame_funcionalidades->add($multifield_funcionalidades); // define the sizes $id->setSize(100); $nome->setSize(350); $prontuario->setSize(150); $password->setSize(150); $repassword->setSize(150); $email->setSize(250); $multifield_funcionalidades->setHeight(140); // outros $id->setEditable(false); $funcionalidade_nome->setEditable(false); $email->setProperty('autocomplete', 'off'); // validations $nome->addValidation('Nome', new TRequiredValidator()); $prontuario->addValidation('Prontuário', new TRequiredValidator()); $email->addValidation('Email', new TEmailValidator()); $nome->addValidation('Nome', new TMaxLengthValidator(), array(60)); $prontuario->addValidation('Prontuário', new TMaxLengthValidator(), array(60)); $email->addValidation('Email', new TMaxLengthValidator(), array(60)); $funcionalidade_id->setSize(50); $funcionalidade_nome->setSize(200); // configuracoes multifield $multifield_funcionalidades->setClass('Funcionalidade'); $multifield_funcionalidades->addField('id', 'ID', $funcionalidade_id, 60, true); $multifield_funcionalidades->addField('nome', 'Nome', $funcionalidade_nome, 250); $multifield_funcionalidades->setOrientation('horizontal'); // add a row for the field id $table->addRowSet(new TLabel('ID:'), $id, new TLabel('Nome: '), $nome); $table->addRowSet(new TLabel('Prontuário: '), $prontuario, new TLabel('Email: '), $email); $table->addRowSet(new TLabel('Senha: '), $password, new TLabel('Confirmação <br>da senha: '), $repassword); $row = $table->addRow(); $cell = $row->addCell($frame_grupos); $cell->colspan = 2; $cell = $row->addCell($frame_funcionalidades); $cell->colspan = 2; // create an action button (save) $save_button = new TButton('save'); $save_button->setAction(new TAction(array($this, 'onSave')), 'Salvar'); $save_button->setImage('ico_save.png'); // create an new button (edit with no parameters) $new_button = new TButton('new'); $new_button->setAction(new TAction(array($this, 'onEdit')), 'Novo'); $new_button->setImage('ico_new.png'); $list_button = new TButton('list'); $list_button->setAction(new TAction(array('UsuarioList', 'onReload')), 'Voltar para a listagem'); $list_button->setImage('ico_datagrid.png'); // define the form fields $this->form->setFields(array($id, $nome, $prontuario, $password, $repassword, $multifield_funcionalidades, $grupos, $email, $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', 'UsuarioList')); $container->addRow()->addCell($this->form); // add the form to the page parent::add($container); }
function __construct() { parent::__construct(); $this->form = new TForm('doc_cessao_form'); $this->form->style = 'width : 500px;'; $this->form->class = 'tform'; $table = new TTable(); $table->width = '100%'; $this->form->add($table); $row = $table->addRow(); $row->class = 'tformtitle'; // CSS class $row->addCell(new TLabel('Gerar Documentos da Cessão'))->colspan = 2; // cria os campos do formulário $memorando = new TEntry('memorando'); //$cidade = new TEntry('cidade'); $emissao = new TDate('emissao'); $campusID = new TEntry('campusID'); //TDBSeekButton('campusID', 'saciq', 'doc_cessao_form', 'Campus', 'nome', 'campusID', 'campusNome'); $campusNome = new TEntry('campusNome'); $gerente = new TEntry('gerente'); $diretor = new TEntry('diretor'); $cessao_id = new THidden('cessao_id'); // define the sizes $memorando->setSize(300); //$cidade->setSize(200); $emissao->setSize(90); $emissao->setProperty('style', 'margin-right : 0px'); $campusID->setSize(50); $campusID->setEditable(false); $campusNome->setSize(226); $campusNome->setEditable(false); $gerente->setSize(300); $diretor->setSize(300); //mascara $emissao->setMask('dd/mm/yyyy'); $emissao->setValue(date('d/m/Y')); //validadores $memorando->addValidation('Memorando', new TRequiredValidator()); $memorando->addValidation('Memorando', new TMaxLengthValidator(), array(70)); $emissao->addValidation('Emissão', new TRequiredValidator()); $campusID->addValidation('Destino', new TRequiredValidator()); $gerente->addValidation('Gerente Administrativo(a)', new TRequiredValidator()); $gerente->addValidation('Gerente Administrativo(a)', new TMaxLengthValidator(), array(70)); $diretor->addValidation('Diretor(a) Geral', new TRequiredValidator()); $diretor->addValidation('Diretor(a) Geral', new TMaxLengthValidator(), array(70)); $memorando->setTip('Descrição do Memorando que aparecerá no início do documento.'); $gerente->setTip('Nome do gerente em exercício'); $diretor->setTip('Nome do diretor geral em exercício'); $value = TSession::getValue('doc_cessao_form_cessao_id'); if (isset($value)) { $cessao_id->setValue($value); } // add one row for each form field $table->addRowSet(new TLabel('Memorando:'), $memorando); //$table->addRowSet(new TLabel('Cidade:'), $cidade); $table->addRowSet(new TLabel('Emissão:'), $emissao); //$table->addRowSet(new TLabel('Destino:'), $destino); //$row = $table->addRow(); $box = new THBox(); $box->add($campusID); $box->add($campusNome)->style = 'width: 75%; display : inline-block;'; //$row->addCell($box)->colspan = 2; $table->addRowSet(new TLabel('Destino:'), $box); $table->addRowSet(new TLabel('Gerente Administrativo(a):'), $gerente); $table->addRowSet(new TLabel('Diretor(a):'), $diretor); $table->addRowSet($cessao_id); $this->form->setFields(array($memorando, $emissao, $campusID, $campusNome, $gerente, $diretor, $cessao_id)); // keep the form filled during navigation with session data $this->form->setData(TSession::getValue('Cessao_filter_data')); // create two action buttons to the form $generate_button = TButton::create('generate', array($this, 'onGenerate'), 'Gerar', 'fa:file-pdf-o'); $back_button = TButton::create('back', array('DocCessaoList', 'onReload'), 'Voltar', 'ico_back.png'); //$new_button = TButton::create('new', array('CessaoForm', 'onEdit'), 'Novo', 'ico_new.png'); $this->form->addField($generate_button); $this->form->addField($back_button); $buttons_box = new THBox(); $buttons_box->add($generate_button); $buttons_box->add($back_button); // add a row for the form action $row = $table->addRow(); $row->class = 'tformaction'; // CSS class $row->addCell($buttons_box)->colspan = 2; // create the page container //$container = TVBox::pack($this->form); parent::add($this->form); }
/** * Class constructor * Creates the page and the registration form */ function __construct() { parent::__construct(); // creates the table container $table = new TTable(); $table->style = 'width:100%'; $frame_funcionalidades = new TFrame(); $frame_funcionalidades->setLegend('Funcionalidades'); // Cria o form $this->form = new TForm('form_Grupo'); $this->form->class = 'tform'; // add the notebook inside the form $this->form->add($table); $table->addRowSet(new TLabel('Grupo'), '')->class = 'tformtitle'; // cria os campos de pesquisa do form $id = new TEntry('id'); $nome = new TEntry('nome'); $sigla = new TEntry('sigla'); $this->list1 = new TSortList('list1'); $this->list2 = new TSortList('list2'); $this->list1->setSize(300, 200); $this->list2->setSize(300, 200); $this->list1->connectTo($this->list2); $this->list2->connectTo($this->list1); /* $multifield = new TMultiField('programs'); $program_id = new TDBSeekButton('program_id', 'saciq', 'form_Grupo', 'Funcionalidade', 'nome', 'programs_id', 'programs_nome'); $program_nome = new TEntry('program_nome'); $frame_programs->add($multifield); $multifield->setHeight(140); $multifield->setClass('Funcionalidade'); $multifield->addField('id', 'ID', $program_id, 100, true); $multifield->addField('nome', 'Funcionalidade', $program_nome, 250); $multifield->setOrientation('horizontal'); */ // define the sizes //$program_id->setSize(70); $id->setSize(100); $nome->setSize(400); $sigla->setSize(150); // validations $nome->addValidation('Nome', new TRequiredValidator()); $sigla->addValidation('Sigla', new TRequiredValidator()); $nome->addValidation('Nome', new TMaxLengthValidator(), array(45)); $sigla->addValidation('Sigla', new TMaxLengthValidator(), array(10)); // outras propriedades $id->setEditable(false); //$program_nome->setEditable(false); // add a row for the field id $table->addRowSet(new TLabel('ID:'), $id); $table->addRowSet(new TLabel('Nome: '), $nome); $table->addRowSet(new TLabel('Sigla:'), $sigla); // add a row for the field nome //$row = $table->addRow(); //$cell = $row->addCell($frame_programs); //$cell->colspan = 2; $vbox1 = new TVBox(); $vbox1->add(new TLabel('<b>Disponível</b>')); $vbox1->add($this->list1); $vbox2 = new TVBox(); $vbox2->add(new TLabel('<b>Selecionado</b>')); $vbox2->add($this->list2); $hbox = new THBox(); $hbox->add($vbox1); $hbox->add($vbox2); $frame_funcionalidades->add($hbox); $row = $table->addRow(); $cell = $row->addCell($frame_funcionalidades); $cell->colspan = 2; // create an action button (save) $save_button = new TButton('save'); $save_button->setAction(new TAction(array($this, 'onSave')), 'Salvar'); $save_button->setImage('ico_save.png'); // create an new button (edit with no parameters) $new_button = new TButton('new'); $new_button->setAction(new TAction(array($this, 'onEdit')), 'Novo'); $new_button->setImage('ico_new.png'); $list_button = new TButton('list'); $list_button->setAction(new TAction(array('GrupoList', 'onReload')), 'Voltar para a listagem'); $list_button->setImage('ico_datagrid.png'); // define the form fields $this->form->setFields(array($id, $nome, $sigla, $this->list1, $this->list2, $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', 'GrupoList')); $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(); // creates the form $this->form = new TForm('form_Campus'); $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('Cadastro de Câmpus'))->colspan = 2; // create the form fields $id = new TEntry('id'); $nome = new TEntry('nome'); $uasg = new TEntry('uasg'); $sigla = new TEntry('sigla'); $id->setEditable(FALSE); // define the sizes $id->setSize(50); $nome->setSize(400); $uasg->setSize(150); $sigla->setSize(100); // validations $nome->addValidation('Nome', new TRequiredValidator()); $uasg->addValidation('UASG', new TRequiredValidator()); $sigla->addValidation('Sigla', new TRequiredValidator()); $nome->addValidation('Nome', new TMaxLengthValidator(), array(50)); $uasg->addValidation('UASG', new TMaxLengthValidator(), array(10)); $sigla->addValidation('Sigla', new TMaxLengthValidator(), array(3)); // add one row for each form field $table->addRowSet(new TLabel('ID:'), $id); $table->addRowSet($label_nome = new TLabel('Nome:'), $nome); //$label_nome->setFontColor('#FF0000'); $table->addRowSet($label_uasg = new TLabel('UASG:'), $uasg); //$label_uasg->setFontColor('#FF0000'); $table->addRowSet($label_sigla = new TLabel('Sigla:'), $sigla); //$label_sigla->setFontColor('#FF0000'); $this->form->setFields(array($id, $nome, $uasg, $sigla)); // create the form actions $save_button = TButton::create('save', array($this, 'onSave'), 'Salvar', 'ico_save.png'); $new_button = TButton::create('new', array($this, 'onEdit'), 'Novo', 'ico_new.png'); $back_button = TButton::create('back', array('CampusList', 'onReload'), 'Voltar para a listagem', 'ico_datagrid.png'); $this->form->addField($save_button); $this->form->addField($new_button); $this->form->addField($back_button); $buttons_box = new THBox(); $buttons_box->add($save_button); $buttons_box->add($new_button); $buttons_box->add($back_button); // add a row for the form action $row = $table->addRow(); $row->class = 'tformaction'; // CSS class $row->addCell($buttons_box)->colspan = 2; $container = new TTable(); //$container->style = 'width: 80%'; $container->addRow()->addCell(new TXMLBreadCrumb('menu.xml', 'CampusList')); $container->addRow()->addCell($this->form); parent::add($container); }