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 makeTFile($properties) { $widget = new TFile((string) $properties->{'name'}); $widget->setSize((int) $properties->{'width'}); $widget->setEditable((string) $properties->{'editable'}); 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; }