public function __construct()
 {
     parent::__construct();
     $this->form = new TQuickForm('sqlpanel');
     $this->form->class = 'tform';
     $this->form->setFormTitle('SQL Panel');
     $this->form->style = 'width:100%';
     $list = scandir('app/config');
     $options = array();
     foreach ($list as $entry) {
         if (substr($entry, -4) == '.ini') {
             $options[substr($entry, 0, -4)] = $entry;
         }
     }
     $database = new TCombo('database');
     $select = new TText('select');
     $database->addItems($options);
     $this->form->addQuickField(_t('Database'), $database, '50%', new TRequiredValidator());
     $this->form->addQuickField('SELECT', $select, '80%', new TRequiredValidator());
     $this->form->addQuickAction(_t('Generate'), new TAction(array($this, 'onGenerate')), 'fa:check-circle green');
     $select->setSize('80%', 100);
     $this->container = new TTable();
     $this->container->style = 'width: 80%';
     $this->container->addRow()->addCell(new TXMLBreadCrumb('menu.xml', 'SystemProgramList'));
     $this->container->addRow()->addCell($this->form);
     parent::add($this->container);
 }
Example #2
0
 function __construct()
 {
     parent::__construct();
     // create the form using TQuickForm class
     $this->form = new TQuickForm();
     $this->form->class = 'tform';
     $this->form->setFormTitle('Formas de Pagamentos');
     $combo = new TCombo('pagamento');
     $combo_items = array();
     $combo_items['a'] = 'Cartão de Crédito Visa';
     $combo_items['b'] = 'Cartão de Crédito Mastercard';
     $combo_items['c'] = 'Ticket Vale Refeição';
     $combo_items['d'] = 'PagSeguro';
     $combo_items['e'] = 'PayPal';
     $combo_items['f'] = 'DriverCoins';
     $combo->addItems($combo_items);
     $this->form->addQuickField('Forma de Pagamentos', $combo, 500);
     $this->form->addQuickAction('Salvar', new TAction(array($this, 'onSave')), 'ico_save.png');
     // wrap the page content using vertical box
     $vbox = new TVBox();
     $vbox->style = 'width: 100%';
     $vbox->add(new TXMLBreadCrumb('menu.xml', __CLASS__));
     $vbox->add($this->form);
     parent::add($vbox);
 }
 /**
  * Class constructor
  * Creates the page
  */
 function __construct()
 {
     parent::__construct();
     // create the form using TQuickForm class
     $this->form = new BootstrapFormWrapper(new TQuickForm());
     $this->form->setFormTitle('cadastroTarefas');
     // create the form fields
     $id = new TEntry('id');
     $id->setEditable(FALSE);
     $description = new TEntry('titulo');
     $list = new TCombo('prioridade');
     $text = new TText('descricao');
     $combo_items = array();
     $combo_items['1'] = 'Baixa';
     $combo_items['2'] = 'Media';
     $combo_items['3'] = 'Alta';
     $list->addItems($combo_items);
     // add the fields inside the form
     $this->form->addQuickField('Id', $id, 40);
     $this->form->addQuickField('Título', $description, 250);
     $this->form->addQuickField('Descrição', $text, 120);
     $this->form->addQuickField('Prioridade', $list, 120);
     $text->setSize(250, 50);
     // define the form action
     $btn = $this->form->addQuickAction('Save', new TAction(array($this, 'onSave')), 'fa:save');
     $btn->class = 'btn btn-success';
     $panel = new TPanelGroup('Cadastro de taredas');
     $panel->add($this->form);
     // wrap the page content using vertical box
     $vbox = new TVBox();
     $vbox->add($panel);
     parent::add($vbox);
 }
 public function __construct()
 {
     parent::__construct();
     // create the notebook
     $notebook = new TNotebook(400, 280);
     parent::add($notebook);
     // creates the notebook page
     $this->table = new TTable();
     // adds the notebook page
     $notebook->appendPage('Reusable view', $this->table);
     // create the form fields
     $fields[] = new TEntry('field1');
     $fields[] = $date = new TDate('field2');
     $fields[] = $text = new TText('field3');
     $fields[] = $combo = new TCombo('field4');
     $fields[] = new TPassword('field5');
     $date->setSize(100);
     $text->setSize(200, 100);
     $combo->addItems(array('1' => 'One', '2' => 'Two'));
     for ($n = 0; $n < 5; $n++) {
         // add a row for one field
         $row = $this->table->addRow();
         $row->addCell(new TLabel('Field ' . ($n + 1)));
         $row->addCell($fields[$n]);
     }
     // define wich are the form fields
     parent::setFields($fields);
 }
 function __construct()
 {
     parent::__construct();
     $this->form = new TQuickForm('form_Contribuinte');
     $this->form->setFormTitle('Contribuinte');
     $this->form->class = 'tform';
     parent::setDatabase('liger');
     parent::setActiveRecord('Contribuinte');
     $contribuinte_id = new TEntry('contribuinte_id');
     $contribuinte_nome = new TEntry('contribuinte_nome');
     $contribuinte_tipo = new TCombo('contribuinte_tipo');
     $contribuinte_endereco = new TEntry('contribuinte_endereco');
     $contribuinte_bairro = new TEntry('contribuinte_bairro');
     $contribuinte_cidade = new TEntry('contribuinte_cidade');
     $contribuinte_estado = new TDBCombo('tb_estados_uf_id', 'liger', 'Estado', 'uf_id', 'uf_nome');
     $contribuinte_cep = new TEntry('contribuinte_cep');
     $contribuinte_telefone = new TEntry('contribuinte_telefone');
     $contribuinte_cpf = new TEntry('contribuinte_cpf');
     $contribuinte_dtnascimento = new TDate('contribuinte_dtnascimento');
     $contribuinte_rg = new TEntry('contribuinte_rg');
     $contribuinte_cnpj = new TEntry('contribuinte_cnpj');
     $contribuinte_inscricaoestadual = new TEntry('contribuinte_inscricaoestadual');
     $contribuinte_inscricaomunicipal = new TEntry('contribuinte_inscricaomunicipal');
     $contribuinte_regjuceg = new TEntry('contribuinte_regjuceg');
     $contribuinte_ramo = new TEntry('contribuinte_ramo');
     $contribuinte_codatividade = new TEntry('contribuinte_codatividade');
     $contribuinte_numempregados = new TEntry('contribuinte_numempregados');
     $contribuinte_inicioatividades = new TDate('contribuinte_inicioatividades');
     $tipo = array(1 => "Físico", 2 => "Jurídico");
     $contribuinte_id->setEditable(false);
     $contribuinte_tipo->addItems($tipo);
     $this->form->addQuickField('ID', $contribuinte_id, 100);
     $this->form->addQuickField('Nome/Razão Social', $contribuinte_nome, 400);
     $this->form->addQuickField('Tipo', $contribuinte_tipo, 200);
     $this->form->addQuickField('Endereço', $contribuinte_endereco, 400);
     $this->form->addQuickField('Bairro', $contribuinte_bairro, 200);
     $this->form->addQuickField('Cidade', $contribuinte_cidade, 200);
     $this->form->addQuickField('Estado', $contribuinte_estado, 200);
     $this->form->addQuickField('CEP', $contribuinte_cep, 200);
     $this->form->addQuickField('Telefone', $contribuinte_telefone, 200);
     $this->form->addQuickField('CPF', $contribuinte_cpf, 200);
     $this->form->addQuickField('Data de Nascimento', $contribuinte_dtnascimento, 200);
     $this->form->addQuickField('RG', $contribuinte_rg, 200);
     $this->form->addQuickField('CNPJ', $contribuinte_cnpj, 200);
     $this->form->addQuickField('Inscrição Municipal', $contribuinte_inscricaomunicipal, 200);
     $this->form->addQuickField('Inscrição Estadual', $contribuinte_inscricaoestadual, 200);
     $this->form->addQuickField('Registro JUCEG', $contribuinte_regjuceg, 200);
     $this->form->addQuickField('Ramo', $contribuinte_ramo, 200);
     $this->form->addQuickField('Código de Atividade', $contribuinte_codatividade, 200);
     $this->form->addQuickField('Nº de Empregados', $contribuinte_numempregados, 200);
     $this->form->addQuickField('Início das Atividades', $contribuinte_inicioatividades, 200);
     $this->form->addQuickAction(_t('Save'), new TAction(array($this, 'onSave')), 'ico_save.png');
     $this->form->addQuickAction(_t('New'), new TAction(array($this, 'onEdit')), 'ico_new.png');
     $this->form->addQuickAction(_t('Back to the listing'), new TAction(array('ContribuinteList', 'onReload')), 'ico_datagrid.png');
     $container = new TTable();
     $container->style = 'width: 80%';
     $container->addRow()->addCell(new TXMLBreadCrumb('menu.xml', 'ContribuinteList'));
     $container->addRow()->addCell($this->form);
     parent::add($container);
 }
 /**
  * Class constructor
  * Creates the page, the form and the listing
  */
 public function __construct()
 {
     parent::__construct();
     parent::setDatabase('samples');
     // defines the database
     parent::setActiveRecord('Product');
     // defines the active record
     parent::setDefaultOrder('id', 'asc');
     // defines the default order
     parent::addFilterField('description', 'like');
     // add a filter field
     parent::addFilterField('unity', '=');
     // add a filter field
     // creates the form, with a table inside
     $this->form = new TQuickForm('form_search_Product');
     $this->form->class = 'tform';
     $this->form->style = 'width: 650px';
     $this->form->setFormTitle('Products');
     $units = array('PC' => 'Pieces', 'GR' => 'Grain');
     // create the form fields
     $description = new TEntry('description');
     $unit = new TCombo('unity');
     $unit->addItems($units);
     // add a row for the filter field
     $this->form->addQuickField('Description', $description, 200);
     $this->form->addQuickField('Unit', $unit, 200);
     $this->form->setData(TSession::getValue('Product_filter_data'));
     $this->form->addQuickAction(_t('Find'), new TAction(array($this, 'onSearch')), 'ico_find.png');
     $this->form->addQuickAction(_t('New'), new TAction(array('ProductForm', 'onEdit')), 'ico_new.png');
     // creates a DataGrid
     $this->datagrid = new TQuickGrid();
     $this->datagrid->setHeight(320);
     // creates the datagrid columns
     $id = $this->datagrid->addQuickColumn('ID', 'id', 'center', 50);
     $description = $this->datagrid->addQuickColumn('Description', 'description', 'left', 300);
     $stock = $this->datagrid->addQuickColumn('Stock', 'stock', 'right', 70);
     $sale_price = $this->datagrid->addQuickColumn('Sale Price', 'sale_price', 'right', 70);
     $unity = $this->datagrid->addQuickColumn('Unit', 'unity', 'right', 70);
     // create the datagrid actions
     $edit_action = new TDataGridAction(array('ProductForm', 'onEdit'));
     $delete_action = new TDataGridAction(array($this, 'onDelete'));
     // add the actions to the datagrid
     $this->datagrid->addQuickAction(_t('Edit'), $edit_action, 'id', 'ico_edit.png');
     $this->datagrid->addQuickAction(_t('Delete'), $delete_action, 'id', 'ico_delete.png');
     // create the datagrid model
     $this->datagrid->createModel();
     // create 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 = new TVBox();
     $container->add(new TXMLBreadCrumb('menu.xml', 'ProductList'));
     $container->add($this->form);
     $container->add($this->datagrid);
     $container->add($this->pageNavigation);
     parent::add($container);
 }
 function __construct()
 {
     parent::__construct();
     // instancia o formulário
     $this->form = new TForm();
     $this->form->setName('form_livros');
     // instancia o painél
     $panel = new TPanel(400, 300);
     $this->form->add($panel);
     // coloca o campo id no formulário
     $panel->put(new TLabel('ID'), 10, 10);
     $panel->put($id = new TEntry('id'), 100, 10);
     $id->setSize(100);
     $id->setEditable(FALSE);
     // coloca a imagem de um livro
     $panel->put(new TImage('book.png'), 320, 20);
     // coloca o campo título no formulário
     $panel->put(new TLabel('Título'), 10, 40);
     $panel->put($titulo = new TEntry('titulo'), 100, 40);
     // coloca o campo autor no formulário
     $panel->put(new TLabel('Autor'), 10, 70);
     $panel->put($autor = new TEntry('autor'), 100, 70);
     // coloca o campo tema no formulário
     $panel->put(new TLabel('Tema'), 10, 100);
     $panel->put($tema = new TCombo('tema'), 100, 100);
     // cria um vetor com as opções da combo tema
     $items = array();
     $items['1'] = 'Administração';
     $items['2'] = 'Informática';
     $items['3'] = 'Economia';
     $items['4'] = 'Matemática';
     // adiciona os itens na combo
     $tema->addItems($items);
     // coloca o campo editora no formulário
     $editora = new TEntry('editora');
     $panel->put(new TLabel('Editora'), 10, 130);
     $panel->put($editora, 100, 130);
     // coloca o campo ano no formulário
     $panel->put(new TLabel('Ano'), 210, 130);
     $panel->put($ano = new TEntry('ano'), 260, 130);
     $editora->setSize(100);
     $ano->setSize(40);
     // coloca o campo resumo no formulário
     $panel->put(new TLabel('Resumo'), 10, 160);
     $panel->put($resumo = new TText('resumo'), 100, 160);
     // cria uma ação
     $panel->put($acao = new TButton('action1'), 320, 240);
     $acao->setAction(new TAction(array($this, 'onSave')), 'Salvar');
     // define quais são os campos do formulário
     $this->form->setFields(array($id, $titulo, $autor, $tema, $editora, $ano, $resumo, $acao));
     parent::add($this->form);
 }
Example #8
0
 function __construct()
 {
     parent::__construct();
     //Instancia um novo Formulario
     $this->form = new TForm('livroForm');
     //Isntancia o Painel
     $painel = new TPanel('400', '300');
     $this->form->add($painel);
     //Coloca o campo ID no Formulario
     $painel->put(new TLabel('ID'), '10', '10');
     $painel->put($id = new TEntry('id'), '100', '10');
     $id->setSize('100');
     $id->setEditable(false);
     //Coloca o campo titulo no formulario
     $painel->put(new TLabel('Titulo'), '10', '40');
     $painel->put($titulo = new TEntry('titulo'), '100', '40');
     //Coloca o campo autor no formulario
     $painel->put(new TLabel('Autor'), '10', '70');
     $painel->put($autor = new TEntry('autor'), '100', '70');
     //coloca o campo tema no formulario
     $painel->put(new TLabel('Tema'), '10', '100');
     $painel->put($tema = new TCombo('tema'), '100', '100');
     //Cria um vetor com as opções da Combo Tema
     $itens = array();
     $itens['1'] = 'Administração';
     $itens['2'] = 'Matematica';
     $itens['3'] = 'Informatica';
     //Adiciona os na Combo
     $tema->addItems($itens);
     //Coloca o campo editora no formulario
     $painel->put(new TLabel('Editora'), '10', '130');
     $painel->put($editora = new TEntry('editora'), '100', '130');
     $editora->setSize('100');
     //Coloca o campo ano no formulario
     $painel->put(new TLabel('Ano'), '210', '130');
     $painel->put($ano = new TEntry('ano'), '260', '130');
     $ano->setSize('40');
     //coloca o campo resumo no formulario
     $painel->put(new TLabel('Remuno'), '10', '160');
     $painel->put($resumo = new TText('resumo'), '100', '160');
     //Cria uma Ação
     $painel->put($acao = new TButton('action'), '320', '240');
     $acao->setAction(new TAction(array($this, 'onSave')), 'Salvar');
     //Define quais são os Campos do Formulario
     $this->form->setFields(array($id, $titulo, $autor, $tema, $editora, $ano, $resumo, $acao));
     parent::add($this->form);
 }
Example #9
0
 /**
  * método construtor
  * Cria a página e o formulário de cadastro
  */
 function __construct()
 {
     parent::__construct();
     // instancia um formulário
     $this->form = new TForm('form_login');
     // cria um notebook
     $notebook = new TNotebook();
     $notebook->setSize(340, 130);
     // instancia uma tabela
     $table = new TTable();
     // adiciona a tabela ao formulário
     $this->form->add($table);
     $langs = array();
     $langs['pt'] = 'Portugues';
     $langs['en'] = 'English';
     // cria os campos do formulário
     $user = new TEntry('user');
     $pass = new TPassword('password');
     $lang = new TCombo('language');
     $lang->addItems($langs);
     $lang->setValue(TSession::getValue('language'));
     // adiciona uma linha para o campo
     $row = $table->addRow();
     $row->addCell(new TLabel(_t('Login') . ':'));
     $row->addCell($user);
     // adiciona uma linha para o campo
     $row = $table->addRow();
     $row->addCell(new TLabel(_t('Password') . ':'));
     $row->addCell($pass);
     // adiciona uma linha para o campo
     $row = $table->addRow();
     $row->addCell(new TLabel(_t('Language') . ':'));
     $row->addCell($lang);
     // cria um botão de ação (salvar)
     $save_button = new TButton('login');
     // define a ação do botão
     $save_button->setAction(new TAction(array($this, 'onLogin')), _t('Login'));
     $save_button->setImage('ico_apply.png');
     // adiciona uma linha para a ação do formulário
     $row = $table->addRow();
     $row->addCell($save_button);
     // define quais são os campos do formulário
     $this->form->setFields(array($user, $pass, $lang, $save_button));
     $notebook->appendPage(_t('Data'), $this->form);
     // adiciona o notebook à página
     parent::add($notebook);
 }
 function __construct()
 {
     parent::__construct();
     // creates the form
     $this->form = new TQuickForm('form_Product');
     $this->form->class = 'tform';
     // CSS class
     $this->form->style = 'width: 650px;';
     // defines the form title
     $this->form->setFormTitle('Product');
     // define the database and the Active Record
     parent::setDatabase('samples');
     parent::setActiveRecord('Product');
     // units
     $units = array('PC' => 'Pieces', 'GR' => 'Grain');
     // create the form fields
     $id = new TEntry('id');
     $description = new TEntry('description');
     $stock = new TEntry('stock');
     $sale_price = new TEntry('sale_price');
     $unity = new TCombo('unity');
     $photo_path = new TFile('photo_path');
     $id->setEditable(FALSE);
     $unity->addItems($units);
     $stock->setNumericMask(2, ',', '.', TRUE);
     // TRUE: process mask when editing and saving
     $sale_price->setNumericMask(2, ',', '.', TRUE);
     // TRUE: process mask when editing and saving
     // add the form fields
     $this->form->addQuickField('ID', $id, 200);
     $this->form->addQuickField('Description', $description, 200, new TRequiredValidator());
     $this->form->addQuickField('Stock', $stock, 200, new TRequiredValidator());
     $this->form->addQuickField('Sale Price', $sale_price, 200, new TRequiredValidator());
     $this->form->addQuickField('Unity', $unity, 200, new TRequiredValidator());
     $this->form->addQuickField('Photo Path', $photo_path, 200);
     $photo_path->setSize(200, 40);
     // add the actions
     $this->form->addQuickAction(_t('Save'), new TAction(array($this, 'onSave')), 'ico_save.png');
     $this->form->addQuickAction(_t('New'), new TAction(array($this, 'onEdit')), 'ico_new.png');
     $this->form->addQuickAction(_t('Back'), new TAction(array('ProductList', 'onReload')), 'ico_back.png');
     $vbox = new TVBox();
     $vbox->add(new TXMLBreadCrumb('menu.xml', 'ProductList'));
     $vbox->add($this->form);
     parent::add($vbox);
 }
 /**
  * Class constructor
  * Creates the page and the registration form
  */
 function __construct()
 {
     parent::__construct();
     // create the notebook
     $this->notebook = new TNotebook(350, 120);
     // create the form
     $this->form = new TForm();
     // creates the notebook page
     $page1 = new TTable();
     // add the notebook inside the form
     $this->form->add($this->notebook);
     // adds the notebook page
     $this->notebook->appendPage('Page 1', $page1);
     // create the form fields
     $field1 = new TCombo('field1');
     $field2 = new TCombo('field2');
     $field1->addValidation('Field 1', new TRequiredValidator());
     $field2->addValidation('Field 2', new TRequiredValidator());
     $field1->addItems(array('combo' => 'TCombo', 'radio' => 'TRadioGroup', 'check' => 'TCheckGroup'));
     $field2->addItems(array('1' => 'Gender', '2' => 'Ocupation'));
     // add a row for one field
     $row = $page1->addRow();
     $row->addCell($l1 = new TLabel('Next field type:'));
     $cell = $row->addCell($field1);
     // add a row for one field
     $row = $page1->addRow();
     $row->addCell($l2 = new TLabel('Next field content:'));
     $cell = $row->addCell($field2);
     $l1->setFontColor('#FF0000');
     $l2->setFontColor('#FF0000');
     // creates the action button
     $button1 = new TButton('action1');
     $button1->setAction(new TAction(array($this, 'onStep2')), 'Next');
     $button1->setImage('ico_next.png');
     $row = $page1->addRow();
     $row->addCell($button1);
     // define wich are the form fields
     $this->form->setFields(array($field1, $field2, $button1));
     // wrap the page content using vertical box
     $vbox = new TVBox();
     $vbox->add(new TXMLBreadCrumb('menu.xml', __CLASS__));
     $vbox->add($this->form);
     parent::add($vbox);
 }
 /**
  * Class constructor
  * Creates the page
  */
 function __construct()
 {
     parent::__construct();
     // create the form using TQuickForm class
     $this->form = new TQuickForm();
     $this->form->class = 'tform';
     $this->form->setFormTitle('Quick form');
     // create the form fields
     $id = new TEntry('id');
     $description = new TEntry('description');
     $date1 = new TDate('date1');
     $date2 = new TDate('date2');
     $color = new TColor('color');
     $list = new TCombo('list');
     $text = new TText('text');
     $combo_items = array();
     $combo_items['a'] = 'Item a';
     $combo_items['b'] = 'Item b';
     $combo_items['c'] = 'Item c';
     $list->addItems($combo_items);
     $date1->setSize(100);
     $date2->setSize(100);
     // add the fields inside the form
     $this->form->addQuickField('Id', $id, 40);
     $this->form->addQuickField('Description', $description, 280);
     $this->form->addQuickFields('Date', array($date1, new TLabel('to'), $date2));
     $this->form->addQuickField('Color', $color, 100);
     $this->form->addQuickField('List', $list, 120);
     $row = $this->form->addRow();
     $row->class = 'tformsection';
     $row->addCell(new TLabel('Division'))->colspan = 2;
     $this->form->addQuickField('Text', $text, 120);
     $text->setSize(400, 50);
     // define the form action
     $this->form->addQuickAction('Save', new TAction(array($this, 'onSave')), 'ico_save.png');
     // wrap the page content using vertical box
     $vbox = new TVBox();
     $vbox->add(new TXMLBreadCrumb('menu.xml', __CLASS__));
     $vbox->add($this->form);
     parent::add($vbox);
 }
Example #13
0
 /**
  * método construtor
  * Cria a página e o formulário de cadastro
  */
 function __construct()
 {
     parent::__construct();
     $table = new TTable();
     $table->width = '100%';
     // creates the form
     $this->form = new TForm('form_login');
     $this->form->class = 'tform';
     $this->form->style = 'margin:auto;width: 350px';
     // add the notebook inside the form
     $this->form->add($table);
     $langs = array();
     $langs['pt'] = 'Portugues';
     $langs['en'] = 'English';
     // cria os campos do formulário
     $user = new TEntry('user');
     $pass = new TPassword('password');
     $lang = new TCombo('language');
     $lang->addItems($langs);
     $lang->setValue(TSession::getValue('language'));
     // add a row for the field login
     $row = $table->addRow();
     $cell = $row->addCell(new TLabel('Login'));
     $cell->colspan = 2;
     $row->class = 'tformtitle';
     $table->addRowSet(new TLabel(_t('Login') . ': '), $user);
     $table->addRowSet(new TLabel(_t('Password') . ': '), $pass);
     $table->addRowSet(new TLabel(_t('Language') . ': '), $lang);
     // cria um botão de ação (salvar)
     $save_button = new TButton('login');
     // define a ação do botão
     $save_button->setAction(new TAction(array($this, 'onLogin')), _t('Login'));
     $save_button->setImage('ico_apply.png');
     $row = $table->addRowSet($save_button, '');
     $row->class = 'tformaction';
     // define quais são os campos do formulário
     $this->form->setFields(array($user, $pass, $lang, $save_button));
     // add the form to the page
     parent::add($this->form);
 }
 /**
  * Class constructor
  * Creates the page
  */
 function __construct()
 {
     parent::__construct();
     // creates a table
     $table = new TTable();
     // creates a label with the title
     $title = new TLabel('Table Columns');
     $title->setFontSize(18);
     $title->setFontFace('Arial');
     $title->setFontColor('red');
     // adds a row to the table
     $row = $table->addRow();
     $title = $row->addCell($title);
     $title->colspan = 2;
     // creates a series of input widgets
     $id = new TEntry('id');
     $name = new TEntry('name');
     $address = new TEntry('address');
     $telephone = new TEntry('telephone');
     $city = new TCombo('city');
     $text = new TText('text');
     $items = array();
     $items['1'] = 'Porto Alegre';
     $items['2'] = 'Lajeado';
     $city->addItems($items);
     // adjust the size of the code
     $id->setSize(70);
     // add rows for the fields
     $table->addRowSet(new TLabel('Code'), $id);
     $table->addRowSet(new TLabel('Name'), $name);
     $table->addRowSet(new TLabel('City'), $city);
     $table->addRowSet(new TLabel('Address'), $address);
     $table->addRowSet(new TLabel('Telephone'), $telephone);
     // wrap the page content using vertical box
     $vbox = new TVBox();
     $vbox->add(new TXMLBreadCrumb('menu.xml', __CLASS__));
     $vbox->add($table);
     parent::add($vbox);
 }
 public function addPopulationTarget(TCombo $alvo, $model, $frm, $key_busca, $value, $key_valor, $ordercolumn = null)
 {
     if ($this->changeaction) {
         // carrega objetos do banco de dados
         TTransaction::open($this->banco);
         // instancia um repositório de Estado
         $repository = new TRepository($model);
         $criteria = new TCriteria();
         $criteria->setProperty('order', isset($ordercolumn) ? $ordercolumn : $key_busca);
         $criteria->add(new TFilter($key_busca, '=', $key_valor));
         // carrega todos objetos
         $collection = $repository->{$model};
         $items = array();
         foreach ($collection as $object) {
             $items[$object->{$key}] = $object->{$value};
         }
         TCombo::reload($frm, $alvo->getName(), $items);
         TTransaction::close();
     } else {
         throw new Exception('you need delcare changeaction first');
     }
 }
 /**
  * Class Constructor
  * @param  $name     widget's name
  * @param  $database database name
  * @param  $model    model class name
  * @param  $key      table field to be used as key in the combo
  * @param  $value    table field to be listed in the combo
  * @param  $ordercolumn column to order the fields (optional)
  * @param  $criteria criteria (TCriteria object) to filter the model (optional)
  */
 public function __construct($name, $database, $model, $key, $value, $ordercolumn = NULL, TCriteria $criteria = NULL)
 {
     // executes the parent class constructor
     parent::__construct($name);
     if (empty($database)) {
         throw new Exception(AdiantiCoreTranslator::translate('The parameter (^1) of ^2 is required', 'database', __CLASS__));
     }
     if (empty($model)) {
         throw new Exception(AdiantiCoreTranslator::translate('The parameter (^1) of ^2 is required', 'model', __CLASS__));
     }
     if (empty($key)) {
         throw new Exception(AdiantiCoreTranslator::translate('The parameter (^1) of ^2 is required', 'key', __CLASS__));
     }
     if (empty($value)) {
         throw new Exception(AdiantiCoreTranslator::translate('The parameter (^1) of ^2 is required', 'value', __CLASS__));
     }
     // carrega objetos do banco de dados
     TTransaction::open($database);
     // instancia um repositório de Estado
     $repository = new TRepository($model);
     if (is_null($criteria)) {
         $criteria = new TCriteria();
     }
     $criteria->setProperty('order', isset($ordercolumn) ? $ordercolumn : $key);
     // carrega todos objetos
     $collection = $repository->load($criteria, FALSE);
     // adiciona objetos na combo
     if ($collection) {
         $items = array();
         foreach ($collection as $object) {
             if (is_array($value)) {
                 foreach ($value as $k => $v) {
                     if ($k == 0) {
                         $items[$object->{$key}] = str_pad($object->{$v}, 3, 0, STR_PAD_LEFT);
                     } else {
                         $items[$object->{$key}] .= ' - ' . $object->{$v};
                     }
                 }
             } else {
                 $items[$object->{$key}] = $object->{$value};
             }
         }
         parent::addItems($items);
     }
     TTransaction::close();
 }
 /**
  * Action to be executed when the user changes the gender or status
  * @param $param Action parameters
  */
 public static function onGenderChange($param)
 {
     TTransaction::open('samples');
     $repo = new TRepository('Customer');
     $criteria = new TCriteria();
     $criteria->add(new TFilter('gender', 'IN', isset($param['check_gender']) ? $param['check_gender'] : array()));
     if ($param['combo_status']) {
         $criteria->add(new TFilter('status', '=', $param['combo_status']));
     }
     $customers = $repo->load($criteria);
     TTransaction::close();
     $options = array();
     foreach ($customers as $customer) {
         $options[$customer->id] = $customer->name;
     }
     TCombo::reload('form_dynamic_filter', 'customers', $options);
 }
Example #18
0
 /**
  * Class Constructor
  * @param  $name     widget's name
  * @param  $database database name
  * @param  $model    model class name
  * @param  $key      table field to be used as key in the combo
  * @param  $value    table field to be listed in the combo
  * @param  $ordercolumn column to order the fields (optional)
  */
 public function __construct($name, $database, $model, $key, $value, $ordercolumn = NULL)
 {
     // executes the parent class constructor
     parent::__construct($name);
     // carrega objetos do banco de dados
     TTransaction::open($database);
     // instancia um repositório de Estado
     $repository = new TRepository($model);
     $criteria = new TCriteria();
     $criteria->setProperty('order', isset($ordercolumn) ? $ordercolumn : $key);
     // carrega todos objetos
     $collection = $repository->load($criteria);
     // adiciona objetos na combo
     if ($collection) {
         $items = array();
         foreach ($collection as $object) {
             $items[$object->{$key}] = $object->{$value};
         }
         parent::addItems($items);
     }
     TTransaction::close();
 }
 /**
  * on ChangeRadio change
  * @param $param Action parameters
  */
 public static function onChangeRadio($param)
 {
     if ($param['enable'] == 1) {
         TCombo::enableField('form_enable_disable', 'block1_combo');
         TEntry::enableField('form_enable_disable', 'block1_entry');
         TSpinner::enableField('form_enable_disable', 'block1_spinner');
         TDate::disableField('form_enable_disable', 'block2_date');
         TEntry::disableField('form_enable_disable', 'block2_entry');
         TCheckGroup::disableField('form_enable_disable', 'block2_check');
         TDate::clearField('form_enable_disable', 'block2_date');
         TEntry::clearField('form_enable_disable', 'block2_entry');
         TCheckGroup::clearField('form_enable_disable', 'block2_check');
     } else {
         TCombo::disableField('form_enable_disable', 'block1_combo');
         TEntry::disableField('form_enable_disable', 'block1_entry');
         TSpinner::disableField('form_enable_disable', 'block1_spinner');
         TDate::enableField('form_enable_disable', 'block2_date');
         TEntry::enableField('form_enable_disable', 'block2_entry');
         TCheckGroup::enableField('form_enable_disable', 'block2_check');
         TCombo::clearField('form_enable_disable', 'block1_combo');
         TEntry::clearField('form_enable_disable', 'block1_entry');
         TSpinner::clearField('form_enable_disable', 'block1_spinner');
     }
 }
 /**
  * Class constructor
  * Creates the page and the registration form
  */
 function __construct()
 {
     parent::__construct();
     // creates the form
     $this->form = new TForm('form_Ponto_report');
     $this->form->class = 'tform';
     // CSS class
     $this->form->style = 'width: 500px';
     $this->string = new StringsUtil();
     // 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';
     $cell = $row->addCell(new TLabel('Indicador de produtividade por colaborador'));
     $cell->colspan = 2;
     // create the form fields
     $mes_atividade = new TCombo('mes_atividade');
     $mes_atividade->addItems($this->string->array_meses());
     $mes_atividade->setDefaultOption(FALSE);
     $mes_atividade->setValue(date('m'));
     $mes_atividade->setSize(250);
     $output_type = new TRadioGroup('output_type');
     $output_type->setSize(100);
     // validations
     $output_type->addValidation('Saida', new TRequiredValidator());
     // add one row for each form field
     $table->addRowSet(new TLabel('Mês referencia:'), $mes_atividade);
     $table->addRowSet($label_output_type = new TLabel('Saida:'), $output_type);
     $label_output_type->setFontColor('#FF0000');
     $this->form->setFields(array($mes_atividade, $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);
 }
 function __construct()
 {
     parent::__construct();
     // instancia um formulário
     $this->form = new TForm('form_clientes');
     // instancia uma tabela
     $table = new TTable();
     // adiciona a tabela ao formulário
     $this->form->add($table);
     // cria os campos do formulário
     $codigo = new TEntry('id');
     $nome = new TEntry('nome');
     $endereco = new TEntry('endereco');
     $telefone = new TEntry('telefone');
     $cidade = new TCombo('id_cidade');
     // define alguns atributos para os campos do formulário
     $codigo->setEditable(FALSE);
     $codigo->setSize(100);
     $nome->setSize(300);
     $endereco->setSize(300);
     // carrega as cidades do banco de dados
     TTransaction::open('pg_livro');
     // instancia um repositório de Cidade
     $repository = new TRepository('Cidade');
     // carrega todos os objetos
     $collection = $repository->load(new TCriteria());
     // adiciona objetos na combo
     foreach ($collection as $object) {
         $items[$object->id] = $object->nome;
     }
     $cidade->addItems($items);
     TTransaction::close();
     // adiciona uma linha para o campo código
     $row = $table->addRow();
     $row->addCell(new TLabel('Código:'));
     $row->addCell($codigo);
     // adiciona uma linha para o campo nome
     $row = $table->addRow();
     $row->addCell(new TLabel('Nome:'));
     $row->addCell($nome);
     // adiciona uma linha para o campo endereço
     $row = $table->addRow();
     $row->addCell(new TLabel('Endereco:'));
     $row->addCell($endereco);
     // adiciona uma linha para o campo telefone
     $row = $table->addRow();
     $row->addCell(new TLabel('Telefone:'));
     $row->addCell($telefone);
     // adiciona uma linha para o campo cidade
     $row = $table->addRow();
     $row->addCell(new TLabel('Cidade:'));
     $row->addCell($cidade);
     // cria um botão de ação para o formulário
     $button1 = new TButton('action1');
     // define a ação do botão
     $button1->setAction(new TAction(array($this, 'onSave')), 'Salvar');
     // adiciona uma linha para a ação do formulário
     $row = $table->addRow();
     $row->addCell('');
     $row->addCell($button1);
     // define quais são os campos do formulário
     $this->form->setFields(array($codigo, $nome, $endereco, $telefone, $cidade, $button1));
     // adiciona o formulário na página
     parent::add($this->form);
 }
 /**
  * Action to be executed when the user changes the combo_change field
  */
 public static function onChangeAction($param)
 {
     $obj = new StdClass();
     $obj->response_c = 'Resp. for opt "' . $param['combo_change'] . '" ' . date('H:m:s');
     TForm::sendData('form_interaction', $obj);
     $options = array();
     $options[1] = $param['combo_change'] . ' - one';
     $options[2] = $param['combo_change'] . ' - two';
     $options[3] = $param['combo_change'] . ' - three';
     TCombo::reload('form_interaction', 'response_b', $options);
 }
Example #23
0
//Cria um rotulo de texto para o Titulo
$titulo = new TLabel('Exemplo');
$titulo->setFontFace('Arial');
$titulo->setFontColor('#ff0000');
$titulo->setFontSize('18');
//Posiciona o titulo no Painel
$painel->put($titulo, '120', '4');
$imagem = new TImage('../app.images/mouse.png');
//Posiciona a imagem no painel
$painel->put($imagem, '320', '120');
//Cria uma serie de Campos de entrada de dados
$codigo = new TEntry('codigo');
$nome = new TEntry('nome');
$endereco = new TEntry('endereco');
$telefone = new TEntry('telefone');
$cidade = new TCombo('cidade');
$itens = array();
$itens['1'] = 'Porto Alegre';
$itens['2'] = 'Lajeado';
$cidade->addItems($itens);
//Ajusta o Tamanho destes Campos
$codigo->setSize('70');
$nome->setSize('140');
$endereco->setSize('140');
$telefone->setSize('140');
$cidade->setSize('140');
//Cria uma serie de Rotulos de Texto
$label1 = new TLabel('Código');
$label2 = new TLabel('Nome');
$label3 = new TLabel('Cidade');
$label4 = new TLabel('Endereço');
 /**
  * Shows the widget
  */
 public function show()
 {
     // define the tag properties
     $this->tag->name = $this->name;
     // tag name
     $this->tag->style = "width:{$this->size}px";
     // size in pixels
     // creates an empty <option> tag
     $option = new TElement('option');
     $option->add('');
     $option->value = '';
     // tag value
     // add the option tag to the combo
     $this->tag->add($option);
     if ($this->items) {
         // iterate the combobox items
         foreach ($this->items as $chave => $item) {
             if (substr($chave, 0, 3) == '>>>') {
                 $optgroup = new TElement('optgroup');
                 $optgroup->label = $item;
                 // add the option to the combo
                 $this->tag->add($optgroup);
             } else {
                 // creates an <option> tag
                 $option = new TElement('option');
                 $option->value = $chave;
                 // define the index
                 $option->add($item);
                 // add the item label
                 // verify if this option is selected
                 if ($chave == $this->value and $this->value !== NULL) {
                     // mark as selected
                     $option->selected = 1;
                 }
                 if (isset($optgroup)) {
                     $optgroup->add($option);
                 } else {
                     $this->tag->add($option);
                 }
             }
         }
     }
     // verify whether the widget is editable
     if (parent::getEditable()) {
         if (isset($this->changeaction)) {
             $string_action = $this->changeaction->serialize(FALSE);
             $this->setProperty('onChange', "serialform=(\$('#{$this->formName}').serialize());\n                                              ajaxLookup('{$string_action}&'+serialform, this)");
         }
     } else {
         // make the widget read-only
         $this->tag->readonly = "1";
         $this->tag->disabled = "disabled";
         $this->tag->{'class'} = 'tfield_disabled';
         // CSS
     }
     // shows the combobox
     $this->tag->show();
 }
 function __construct()
 {
     parent::__construct();
     // instancia um formulário
     $this->form = new TForm('form_produtos');
     // instancia uma tabela
     $table = new TTable();
     // adiciona a tabela ao formulário
     $this->form->add($table);
     // cria os campos do formulário
     $codigo = new TEntry('id');
     $descricao = new TEntry('descricao');
     $estoque = new TEntry('estoque');
     $preco_custo = new TEntry('preco_custo');
     $preco_venda = new TEntry('preco_venda');
     $fabricante = new TCombo('id_fabricante');
     // carrega os fabricantes do banco de dados
     TTransaction::open('pg_livro');
     // instancia um repositório de Fabricante
     $repository = new TRepository('Fabricante');
     // carrega todos objetos
     $collection = $repository->load(new TCriteria());
     // adiciona objetos na combo
     foreach ($collection as $object) {
         $items[$object->id] = $object->nome;
     }
     $fabricante->addItems($items);
     TTransaction::close();
     // define alguns atributos para os campos do formulário
     $codigo->setEditable(FALSE);
     $codigo->setSize(100);
     $estoque->setSize(100);
     $preco_custo->setSize(100);
     $preco_venda->setSize(100);
     // adiciona uma linha para o campo código
     $row = $table->addRow();
     $row->addCell(new TLabel('Código:'));
     $row->addCell($codigo);
     // adiciona uma linha para o campo descrição
     $row = $table->addRow();
     $row->addCell(new TLabel('Descrição:'));
     $row->addCell($descricao);
     // adiciona uma linha para o campo estoque
     $row = $table->addRow();
     $row->addCell(new TLabel('Estoque:'));
     $row->addCell($estoque);
     // adiciona uma linha para o campo preco de custo
     $row = $table->addRow();
     $row->addCell(new TLabel('Preço Custo:'));
     $row->addCell($preco_custo);
     // adiciona uma linha para o campo preço de venda
     $row = $table->addRow();
     $row->addCell(new TLabel('Preço Venda:'));
     $row->addCell($preco_venda);
     // adiciona uma linha para o campo fabricante
     $row = $table->addRow();
     $row->addCell(new TLabel('Fabricante:'));
     $row->addCell($fabricante);
     // cria um botão de ação para o formulário
     $button1 = new TButton('action1');
     // define a ação dos botão
     $button1->setAction(new TAction(array($this, 'onSave')), 'Salvar');
     // adiciona uma linha para a ação do formulário
     $row = $table->addRow();
     $row->addCell('');
     $row->addCell($button1);
     // define quais são os campos do formulário
     $this->form->setFields(array($codigo, $descricao, $estoque, $preco_custo, $preco_venda, $fabricante, $button1));
     // adiciona o formulário na página
     parent::add($this->form);
 }
Example #26
0
 /**
  * Class constructor
  * Creates the page and the registration form
  */
 function __construct()
 {
     parent::__construct();
     // creates the form
     $this->form = new TForm('form_crm');
     // creates a table
     $table = new TTable();
     $notebook = new TNotebook(500, 320);
     // add the notebook inside the form
     $this->form->add($notebook);
     $notebook->appendPage('Cadastro Registro CRM', $table);
     // create the form fields
     $code = new TEntry('id');
     $crm_id = new TCombo('crm_id');
     $tiporegistro_id = new TDBCombo('tiporegistro_id', 'db_crmbf', 'RegistroTipo', 'id', 'nome');
     $registro = new TText('registro');
     $temporegistro = new TEntry('tempo_registro');
     //        $temporegistro->setEditable(false);
     $dataregistro = new TDate('data_registro');
     $hora_registro = new TEntry('hora_registro');
     $numero_registro = new TEntry('numero_registro');
     // finaliza a transacao
     TTransaction::close();
     $items1 = array();
     //dados do cliente CRM
     TTransaction::open('db_crmbf');
     $criteria = new TCriteria();
     $criteria->add(new TFilter('cliente_id', '=', $_GET['fk']));
     $repository = new TRepository('CRM');
     $cadastros = $repository->load($criteria);
     //adiciona os objetos no combo
     foreach ($cadastros as $object) {
         $items1[$object->id] = $object->titulo;
     }
     // adiciona as opcoes na combo
     $crm_id->addItems($items1);
     TTransaction::close();
     // add field validators
     $registro->addValidation('Registro deve ser informado', new TRequiredValidator());
     // define some properties for the form fields
     $code->setEditable(FALSE);
     $code->setSize(100);
     $crm_id->setSize(320);
     //        $crm_id->setEditable(FALSE);
     $registro->setSize(320);
     $temporegistro->setSize(160);
     $temporegistro->setValue(date("d/m/Y H:i:s"));
     $tiporegistro_id->setSize(160);
     $dataregistro->setSize(90);
     $hora_registro->setSize(150);
     $hora_registro->setTip('Horario EX: 8:14');
     $numero_registro->setSize(320);
     $row = $table->addRow();
     $row->addCell(new TLabel('Code:'));
     $row->addCell($code);
     // add a row for the field name
     $row = $table->addRow();
     $row->addCell(new TLabel('CRM Titulo:'));
     $cell = $row->addCell($crm_id);
     // add a row for the field Telefone
     $row = $table->addRow();
     $row->addCell(new TLabel('Tipo Registro:'));
     $cell = $row->addCell($tiporegistro_id);
     // add a row for the field Email
     $row = $table->addRow();
     $row->addCell(new TLabel('Tempo:'));
     $cell = $row->addCell($temporegistro);
     // add a row for the field celular
     $row = $table->addRow();
     $row->addCell(new TLabel('Data:'));
     $cell = $row->addCell($dataregistro);
     // add a row for the field skype
     $row = $table->addRow();
     $row->addCell(new TLabel('Hora:'));
     $cell = $row->addCell($hora_registro);
     // add a row for the field endereco
     $row = $table->addRow();
     $row->addCell(new TLabel('Numero Registro:'));
     $row->addCell($numero_registro);
     // add a row for the field name
     $row = $table->addRow();
     $row->addCell(new TLabel('Registro:'));
     $cell = $row->addCell($registro);
     // create an action button
     $button1 = new TButton('action1');
     $button1->setAction(new TAction(array($this, 'onSave')), 'Save');
     $button1->setImage('ico_save.png');
     // create an action button
     $button2 = new TButton('action3');
     $action2 = new TAction(array('ClienteRegistroDetalhe', 'onEdit'));
     //parametro fk e key da sessao
     $action2->setParameter('fk', TSession::getValue('cliente_fk'));
     $action2->setParameter('key', TSession::getValue('crm_key'));
     $button2->setImage('ico_datagrid.png');
     $button2->setAction($action2, 'Voltar');
     // define wich are the form fields
     $this->form->setFields(array($code, $crm_id, $registro, $temporegistro, $tiporegistro_id, $dataregistro, $hora_registro, $numero_registro, $button1, $button2));
     $subtable = new TTable();
     $row = $subtable->addRow();
     $row->addCell($button1);
     $row->addCell($button2);
     $table_layout = new TTable();
     $table_layout->addRow()->addCell($this->form);
     $table_layout->addRow()->addCell($subtable);
     // add the form inside the page
     parent::add($table_layout);
 }
 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);
 }
 /**
  * method onEdit()
  * Executed whenever the user clicks at the edit button da datagrid
  */
 function onEdit($param)
 {
     try {
         TTransaction::open('atividade');
         // open a transaction with the database
         if (isset($param['key'])) {
             $key = $param['key'];
             // get the parameter $key
             $object = new Ponto($key);
             // instantiates the Active Record
             $ultimoPonto = Ponto::retornaUltimoPonto($object->colaborador_id);
             $intervalo = Ponto::horaPreenchidas($object->data_ponto, $object->colaborador_id);
             if ($ultimoPonto == $key) {
                 if (!$intervalo) {
                     TButton::enableField('form_Ponto', 'salvar');
                     TButton::enableField('form_Ponto', 'excluir');
                 } else {
                     TButton::enableField('form_Ponto', 'salvar');
                     TCombo::disableField('form_Ponto', 'qtde_horas');
                     TCombo::disableField('form_Ponto', 'qtde_minutos');
                 }
             } else {
                 TCombo::disableField('form_Ponto', 'qtde_horas');
                 TCombo::disableField('form_Ponto', 'qtde_minutos');
                 TCombo::disableField('form_Ponto', 'qtde_horas_final');
                 TCombo::disableField('form_Ponto', 'qtde_minutos_final');
             }
             $object->data_ponto ? $object->data_ponto = $this->string->formatDateBR($object->data_ponto) : null;
             $horario = explode(':', $object->hora_entrada);
             $horario_final = explode(':', $object->hora_saida);
             $object->qtde_horas = $horario[0];
             $object->qtde_minutos = $horario[1];
             $object->qtde_horas_final = $horario_final[0];
             $object->qtde_minutos_final = $horario_final[1];
             $this->form->setData($object);
             // fill the form with the active record data
         } else {
             $object = new Ponto();
             $object->colaborador_id = $param['colaborador_id'];
             $object->colaborador_nome = $param['colaborador_nome'];
             $this->form->setData($object);
         }
         TTransaction::close();
         // close the transaction
     } catch (Exception $e) {
         new TMessage('error', '<b>Error</b> ' . $e->getMessage());
         // shows the exception error message
         TTransaction::rollback();
         // undo all pending operations
     }
 }
 /**
  * 
  */
 public function makeTCombo($properties)
 {
     $widget = new TCombo((string) $properties->{'name'});
     $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);
     if (isset($properties->{'value'})) {
         $widget->setValue((string) $properties->{'value'});
     }
     if (isset($properties->{'tip'})) {
         $widget->setTip((string) $properties->{'tip'});
     }
     $widget->setSize((int) $properties->{'width'});
     $this->fields[] = $widget;
     $this->fieldsByName[(string) $properties->{'name'}] = $widget;
     return $widget;
 }
 /**
  * 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_Cliente');
     $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';
     $cell = $row->addCell(new TLabel('Indicador por Periodo'));
     $cell->colspan = 2;
     // create the form fields
     // cria array para popular as combos
     TTransaction::open('atividade');
     $criteria = new TCriteria();
     $criteria->add(new TFilter("origem", "=", 1));
     $criteria->add(new TFilter("codigo_cadastro_origem", "=", 100));
     $criteria->add(new TFilter("ativo", "=", 1));
     $newparam['order'] = 'pessoa_nome';
     $newparam['direction'] = 'asc';
     $criteria->setProperties($newparam);
     // order, offset
     $repo = new TRepository('Pessoa');
     $pessoas = $repo->load($criteria);
     $arrayPessoas[-1] = 'TODOS COLABORADORES';
     foreach ($pessoas as $pessoa) {
         $arrayPessoas[$pessoa->pessoa_codigo] = $pessoa->pessoa_nome;
     }
     $criteria = new TCriteria();
     $criteria->add(new TFilter("enttipent", "=", "1"));
     $newparam['order'] = 'entcodent';
     $newparam['direction'] = 'asc';
     $criteria->setProperties($newparam);
     // order, offset
     $repo = new TRepository('Entidade');
     $clientes = $repo->load($criteria);
     $arrayClientes[-1] = 'TODOS CLIENTES';
     foreach ($clientes as $cliente) {
         $arrayClientes[$cliente->entcodent] = str_pad($cliente->entcodent, 4, '0', STR_PAD_LEFT) . ' - ' . $cliente->entrazsoc;
     }
     $arrayClientes[999] = 'ECS 999';
     TTransaction::close();
     $colaborador_id = new TCombo('colaborador_id');
     $colaborador_id->setDefaultOption(FALSE);
     $colaborador_id->addItems($arrayPessoas);
     $cliente_id = new TCombo('cliente_id');
     $cliente_id->setDefaultOption(FALSE);
     $cliente_id->addItems($arrayClientes);
     $anos = array(2015 => '2015');
     $mes_atividade_inicial = new TCombo('mes_atividade_inicial');
     $mes_atividade_inicial->addItems($this->string->array_meses());
     $mes_atividade_inicial->setDefaultOption(FALSE);
     $mes_atividade_inicial->setValue(date('m'));
     $ano_atividade_inicial = new TCombo('ano_atividade_inicial');
     $ano_atividade_inicial->addItems($anos);
     $ano_atividade_inicial->setDefaultOption(FALSE);
     $mes_atividade_final = new TCombo('mes_atividade_final');
     $mes_atividade_final->addItems($this->string->array_meses());
     $mes_atividade_final->setDefaultOption(FALSE);
     $mes_atividade_final->setValue(date('m'));
     $ano_atividade_final = new TCombo('ano_atividade_final');
     $ano_atividade_final->addItems($anos);
     $ano_atividade_final->setDefaultOption(FALSE);
     $output_type = new TRadioGroup('output_type');
     // define the sizes
     $colaborador_id->setSize(353);
     $cliente_id->setSize(353);
     $mes_atividade_inicial->setSize(250);
     $ano_atividade_inicial->setSize(100);
     $mes_atividade_final->setSize(250);
     $ano_atividade_final->setSize(100);
     $output_type->setSize(100);
     // validations
     $output_type->addValidation('Output', new TRequiredValidator());
     // add one row for each form field
     $table->addRowSet(new TLabel('Colaborador:'), $colaborador_id);
     $table->addRowSet(new TLabel('Cliente:'), $cliente_id);
     $table->addRowSet(new TLabel('Mês ano inicial:'), array($mes_atividade_inicial, $ano_atividade_inicial));
     $table->addRowSet(new TLabel('Mês ano final:'), array($mes_atividade_final, $ano_atividade_final));
     $table->addRowSet(new TLabel('Output:'), $output_type);
     $this->form->setFields(array($colaborador_id, $cliente_id, $mes_atividade_inicial, $mes_atividade_final, $ano_atividade_inicial, $ano_atividade_final, $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);
 }