/** * Class constructor * Creates the page and the registration form */ function __construct() { parent::__construct(); // creates the form $this->form = new TForm('form_Srp_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(); //Set( new TLabel('Relatório de Srp'), '', '','', '' )->class = 'tformtitle'; $row->class = 'tformtitle'; $row->addCell(new TLabel('Relatório de Srp'))->colspan = 2; // create the form fields $numeroSRPI = new TEntry('numeroSRPI'); $numeroSRPF = new TEntry('numeroSRPF'); $numeroIRPI = new TEntry('numeroIRPI'); $numeroIRPF = new TEntry('numeroIRPF'); $numeroProcessoI = new TEntry('numeroProcessoI'); $numeroProcessoF = new TEntry('numeroProcessoF'); $validadeI = new TDate('validadeI'); $validadeF = new TDate('validadeF'); $nomeI = new TEntry('nomeI'); $nomeF = new TEntry('nomeF'); $itensZero = new TRadioGroup('itensZero'); // define the sizes $numeroSRPI->setSize(150); $numeroSRPF->setSize(150); $numeroIRPI->setSize(150); $numeroIRPF->setSize(150); $numeroProcessoI->setSize(150); $numeroProcessoF->setSize(150); $validadeI->setSize(85); $validadeI->setProperty('style', 'margin-right : 0px'); $validadeF->setSize(85); $validadeF->setProperty('style', 'margin-right : 0px'); //$aprovado->setSize(90); //mask $validadeI->setMask('dd/mm/yyyy'); $validadeF->setMask('dd/mm/yyyy'); $validadeF->setValue(date('d/m/Y')); //$validadeI->setNumericMask(0, '', ''); // validations //$aprovado->addValidation('Aprovado', new TRequiredValidator); $validadeF->addValidation('Validade - Até', new TDateValidator(), array('dd/mm/yyyy')); $itensZero->addItems(array('1' => 'Sim', '0' => 'Não')); $itensZero->setValue('0'); $itensZero->setLayout('horizontal'); // add one row for each form field $table->addRowSet(new TLabel('Nº SRP'), array($numeroSRPI, new TLabel('Até'), $numeroSRPF)); $table->addRowSet(new TLabel('Nº IRP'), array($numeroIRPI, new TLabel('Até'), $numeroIRPF)); $table->addRowSet(new TLabel('Nº Processo'), array($numeroProcessoI, new TLabel('Até'), $numeroProcessoF)); $table->addRowSet(new TLabel('Emissão'), array($validadeI, new TLabel('Até'), $validadeF)); $table->addRowSet(new TLabel('Lista itens zerado?'), $itensZero); $this->form->setFields(array($numeroProcessoI, $numeroProcessoF, $numeroIRPI, $numeroIRPF, $nomeI, $nomeF, $validadeI, $validadeF, $numeroSRPI, $numeroSRPF, $itensZero)); //$aprovado->addItems(array('1' => 'Sim', '0' => 'Não', '%' => 'Todos')); //$aprovado->setValue('%'); //$aprovado->setLayout('horizontal'); $generate_button = TButton::create('generate', array($this, 'onGenerate'), _t('Generate'), 'ico_apply.png'); $this->form->addField($generate_button); // add a row for the form action $table->addRowSet($generate_button, '')->class = 'tformaction'; $container = new TTable(); $container->addRow()->addCell(new TXMLBreadCrumb('menu.xml', __CLASS__)); $container->addRow()->addCell($this->form); parent::add($container); }
/** * */ public function makeTRadioGroup($properties) { $widget = new TRadioGroup((string) $properties->{'name'}); $widget->setLayout('vertical'); $pieces = explode("\n", (string) $properties->{'items'}); $items = array(); if ($pieces) { foreach ($pieces as $line) { $part = explode(':', $line); $items[$part[0]] = $part[1]; } } $widget->addItems($items); $widget->setValue((string) $properties->{'value'}); if (isset($properties->{'tip'})) { $widget->setTip((string) $properties->{'tip'}); } $this->fields[] = $widget; $this->fieldsByName[(string) $properties->{'name'}] = $widget; return $widget; }