/** * Constructor Method * Creates the page, the search form and the listing */ public function __construct() { parent::__construct(); parent::setTitle(AdiantiCoreTranslator::translate('Search record')); parent::setSize(0.7, 640); // creates a new form $this->form = new TForm('form_standard_seek'); // creates a new table $table = new TTable(); $table->{'width'} = '100%'; // adds the table into the form $this->form->add($table); // create the form fields $display_field = new TEntry('display_field'); $display_field->setSize('90%'); // keeps the field's value $display_field->setValue(TSession::getValue('tstandardseek_display_value')); // create the action button $find_button = new TButton('busca'); // define the button action $find_button->setAction(new TAction(array($this, 'onSearch')), AdiantiCoreTranslator::translate('Search')); $find_button->setImage('fa:search blue'); // add a row for the filter field $table->addRowSet(new TLabel(_t('Search') . ': '), $display_field, $find_button); // define wich are the form fields $this->form->setFields(array($display_field, $find_button)); // creates a new datagrid $this->datagrid = new TDataGrid(); $this->datagrid->{'style'} = 'width: 100%'; // create two datagrid columns $id = new TDataGridColumn('id', 'ID', 'right', '16%'); $display = new TDataGridColumn('display_field', AdiantiCoreTranslator::translate('Field'), 'left'); // add the columns to the datagrid $this->datagrid->addColumn($id); $this->datagrid->addColumn($display); // create a datagrid action $action1 = new TDataGridAction(array($this, 'onSelect')); $action1->setLabel(AdiantiCoreTranslator::translate('Select')); $action1->setImage('fa:check-circle-o green'); $action1->setUseButton(TRUE); $action1->setField('id'); // add the actions to the datagrid $this->datagrid->addAction($action1); // create the datagrid model $this->datagrid->createModel(); // creates the paginator $this->pageNavigation = new TPageNavigation(); $this->pageNavigation->setAction(new TAction(array($this, 'onReload'))); $this->pageNavigation->setWidth($this->datagrid->getWidth()); $panel = new TPanelGroup(); $panel->add($this->form); // creates the container $vbox = new TVBox(); $vbox->add($panel); $vbox->add($this->datagrid); $vbox->add($this->pageNavigation); $vbox->{'style'} = 'width: 100%'; // add the container to the page parent::add($vbox); }
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); }
/** * Class constructor * Creates the page, the search form and the listing */ public function __construct() { parent::__construct(); parent::setSize(700, 500); parent::setTitle('Search record'); new TSession(); // creates the form $this->form = new TQuickForm('form_busca_tipocontato'); $this->form->class = 'tform'; $this->form->setFormTitle('Tipos Contato'); // create the form fields $name = new TEntry('descricao'); $name->setValue(TSession::getValue('tipocontato_descricao')); // add the form fields $this->form->addQuickField('Descricao', $name, 200); // define the form action $this->form->addQuickAction('Buscar', new TAction(array($this, 'onSearch')), 'ico_find.png'); // creates a DataGrid $this->datagrid = new TQuickGrid(); $this->datagrid->style = 'width: 100%'; $this->datagrid->setHeight(230); //$this->datagrid->enablePopover('Title', 'Name {name}'); // creates the datagrid columns $this->datagrid->addQuickColumn('Id', 'idtipocontato', 'right', 40); $this->datagrid->addQuickColumn('Descrição', 'descricao', 'left', 340); // creates two datagrid actions $this->datagrid->addQuickAction('Seleciona', new TDataGridAction(array($this, 'onSelect')), 'idtipocontato', 'ico_apply.png'); // create the datagrid model $this->datagrid->createModel(); // creates the page navigation $this->pageNavigation = new TPageNavigation(); $this->pageNavigation->setAction(new TAction(array($this, 'onReload'))); $this->pageNavigation->setWidth($this->datagrid->getWidth()); // creates a container $container = new TVBox(); $container->style = 'width: 100%'; $container->add($this->form); $container->add($this->datagrid); $container->add($this->pageNavigation); // add the container inside the page parent::add($container); }
public function __construct() { parent::__construct(); parent::setDatabase(APPLICATION_NAME); parent::setActiveRecord('contabancaria'); parent::setFilterField('conta'); parent::setDefaultOrder('conta', 'asc'); /** @var TQuickForm $this */ $this->form = new \Adianti\Widget\Wrapper\TQuickForm('ContabancariaDataGrid'); $this->form->setFormTitle('Cadastro Contas Bancárias'); $this->form->class = 'tform'; $conta = new \Adianti\Widget\Form\TEntry('conta'); $this->form->addQuickField('Conta: ', $conta, 100); $this->form->addQuickAction('Buscar', new TAction(array($this, 'onSearch')), 'ico_find.png'); $this->form->addQuickAction('Novo', new TAction(array('ContabancariaFormView', 'onClear')), 'ico_new.png'); $this->form->setData(\Adianti\Registry\TSession::getValue('contabancaria_filtro')); $this->datagrid = new \Adianti\Widget\Wrapper\TQuickGrid(); $this->datagrid->style = 'width: 100%'; $this->datagrid->setHeight(230); //$this->datagrid->addQuickColumn('ID','idcontabancaria','right',40,new TAction(array($this,'onReload')),array('order','idcontabancaria')); $this->datagrid->addQuickColumn('Agência', 'agencia', 'right', 40, new TAction(array($this, 'onReload')), array('order', 'agencia')); $this->datagrid->addQuickColumn('Conta', 'conta', 'right', 100, new TAction(array($this, 'onReload')), array('order', 'conta')); $this->datagrid->addQuickColumn('Banco', 'banco->nome', 'right', 200, new TAction(array($this, 'onReload')), array('order', 'banco->nome')); $this->datagrid->addQuickColumn('Tipo Conta', 'tipocontabancaria->descricao', 'right', 120, new TAction(array($this, 'onReload')), array('order', 'tipocontabancaria->descricao')); $this->datagrid->addQuickColumn('Titular', 'titular', 'right', 40, new TAction(array($this, 'onReload')), array('order', 'titular')); $this->datagrid->addQuickColumn('Cidade', 'cidade->nome', 'right', 100, new TAction(array($this, 'onReload')), array('order', 'cidade->nome')); $this->datagrid->addQuickAction('Editar', new TDataGridAction(array('ContabancariaFormView', 'onEdit')), 'idcontabancaria', 'ico_edit.png'); $this->datagrid->addQuickAction('Excluir', new TDataGridAction(array($this, 'onDelete')), 'idcontabancaria', 'ico_delete.png'); $this->datagrid->createModel(); $this->pageNavigation = new \Adianti\Widget\Datagrid\TPageNavigation(); $this->pageNavigation->setAction(new \Adianti\Control\TAction(array($this, 'onReload'))); $this->pageNavigation->setWidth($this->datagrid->getWidth()); $vbox = new TVBox(); $vbox->add(new \Adianti\Widget\Util\TXMLBreadCrumb('menu.xml', 'ContabancariaFormView')); $vbox->add($this->form); $vbox->add($this->datagrid); $vbox->add($this->pageNavigation); parent::add($vbox); }
public function __construct() { parent::__construct(); // create the notebook $this->notebook = new TNotebook(650, 200); $this->notebook->setTabsVisibility(FALSE); $this->step = new TBreadCrumb(); $this->step->addItem('Seleção', FALSE); $this->step->addItem('Importação', TRUE); $this->step->select('Seleção'); // create the form $this->form = new TForm(); // creates the notebook page $this->frmSelecao = new TTable(); $this->frmImportacao = new TTable(); $this->frmSelecao->style = 'width :640px'; $this->frmImportacao->style = 'width :640px'; // add the notebook inside the form $this->form->add($this->notebook); // adds the notebook page $this->notebook->appendPage('Seleção', $this->frmSelecao); $this->notebook->appendPage('Importação', $this->frmImportacao); //criar campo da aba selecao $file = new TFile('file'); $file->addValidation('Arquivo', new TRequiredValidator()); $file->setProperty("accept", ".xlsx,.xls"); $file->setSize('90%'); // itens pagina 1 $row = $this->frmSelecao->addRow(); $label = new TLabel('Importação da tabela'); $row->class = 'tformtitle'; $cell = $row->addCell($label); $cell->colspan = 2; $row = $this->frmSelecao->addRow(); $row->addCell(new TLabel('Local do arquivo:')); $row->addCell($file); // itens pagina 2 $this->gridSRP = new TDataGrid(); $numeroSRP = new TDataGridColumn('numeroSRP', 'SRP', 'left'); $nroProcesso = new TDataGridColumn('numeroProcesso', 'Nº Processo', 'left'); $uasg = new TDataGridColumn('uasg', 'UASG', 'left'); $validade = new TDataGridColumn('validade', 'Validade', 'left'); $natureza = new TDataGridColumn('natureza', 'Natureza de Despesa', 'left'); $nomeProcesso = new TDataGridColumn('nomeProcesso', 'Nome do Processo', 'left', 200); $this->gridSRP->addColumn($numeroSRP); $this->gridSRP->addColumn($nroProcesso); $this->gridSRP->addColumn($uasg); $this->gridSRP->addColumn($validade); $this->gridSRP->addColumn($natureza); $this->gridSRP->addColumn($nomeProcesso); $this->gridSRP->createModel(); $row = $this->frmImportacao->addRow(); $row->class = 'tformtitle'; $cell = $row->addCell(new TLabel('Confirmação da SRP para Importação')); $cell->colspan = 2; $row = $this->frmImportacao->addRow(); $cell = $row->addCell($this->gridSRP); $cell->colspan = 2; $btnLoadFile = new TButton('btnLoadFile'); $btnLoadFile->setAction(new TAction(array($this, 'onLoadFile')), 'Continuar'); $btnLoadFile->setImage('ico_next.png'); $btnImportFile = new TButton('btnImportFile'); $btnImportFile->setAction(new TAction(array($this, 'onImportFile')), 'Importar'); $btnImportFile->setImage('ico_next.png'); $this->frmSelecao->addRowSet($btnLoadFile); $this->frmSelecao->addRowSet(' '); $this->frmSelecao->addRowSet(' '); $link = new TElement('a'); $link->href = 'Files/template.xlsx'; $link->add('Link para o layout'); $this->frmSelecao->addRowSet($link); $this->frmImportacao->addRowSet($btnImportFile); // define wich are the form fields $this->form->setFields(array($file, $btnLoadFile, $btnImportFile)); // wrap the page content using vertical box $vbox = new TVBox(); //$vbox->add(new TXMLBreadCrumb('menu.xml', __CLASS__)); $vbox->add($this->step); $vbox->add($this->form); parent::add($vbox); }
public function __construct() { parent::__construct(); // create the notebook $this->notebook = new TNotebook(500, 125); $this->notebook->setTabsVisibility(FALSE); $this->step = new TBreadCrumb(); $this->step->addItem('Seleção', FALSE); $this->step->addItem('Verificação', FALSE); $this->step->addItem('Importação', TRUE); $this->step->select('Seleção'); // create the form $this->form = new TForm(); // creates the notebook page $page1 = new TTable(); $page2 = new TTable(); $page3 = new TTable(); // add the notebook inside the form $this->form->add($this->notebook); // adds the notebook page $this->notebook->appendPage('Seleção', $page1); $this->notebook->appendPage('Verificação', $page2); $this->notebook->appendPage('Importação', $page3); //criar campo da aba selecao $file = new TFile('file'); $file->setProperty("accept", ".xlsx"); $file->setSize('250px'); //campos aba verificacao $field2 = new TEntry('field2'); $field3 = new TEntry('field3'); // add the fields into the tables $page1->addRowSet(new TLabel('Local do arquivo:'), $file); $page2->addRowSet(new TLabel('The name you:'), $field2); $page3->addRowSet(new TLabel('The name you typed:'), $field3); // creates the action buttons $button1 = new TButton('action1'); $button1->setAction(new TAction(array($this, 'onStep2')), 'Next'); $button1->setImage('ico_next.png'); $button2 = new TButton('action2'); $button2->setAction(new TAction(array($this, 'onStep1')), 'Previous'); $button2->setImage('ico_previous.png'); $button3 = new TButton('action3'); $button3->setAction(new TAction(array($this, 'onStep3')), 'Next'); $button3->setImage('ico_next.png'); $button4 = new TButton('action4'); $button4->setAction(new TAction(array($this, 'onStep2')), 'Previous'); $button4->setImage('ico_previous.png'); $button5 = new TButton('save'); $button5->setAction(new TAction(array($this, 'onSave')), 'Save'); $button5->setImage('ico_save.png'); $page1->addRowSet($button1); $page2->addRowSet($button2, $button3); $page3->addRowSet($button4, $button5); // define wich are the form fields $this->form->setFields(array($file, $field2, $field3, $button1, $button2, $button3, $button4, $button5)); // wrap the page content using vertical box $vbox = new TVBox(); //$vbox->add(new TXMLBreadCrumb('menu.xml', __CLASS__)); $vbox->add($this->step); $vbox->add($this->form); parent::add($vbox); }
/** * Class constructor * Creates the page and the registration form */ function __construct() { parent::__construct(); // creates the form $this->form = new 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); }
/** * 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); }