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); }
/** * 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); }
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 * @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 array $filter TFilter (optional) By Alexandre * @param array $expresione TExpression (opcional) by Alexandre */ public function __construct($name, $database, $model, $key, $value, $ordercolumn = NULL, $filter = NULL, $expression = NULL) { new TSession(); // 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); if ($filter) { foreach ($filter as $fil) { if ($expression) { foreach ($expression as $ex) { $criteria->add($fil, $ex); } } else { $criteria->add($fil); } } } // 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(); }
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); }
/** * Class constructor * Creates the page */ function __construct() { parent::__construct(); // create the form using TQuickForm class $this->form = new TQuickForm('form_dynamic_filter'); // create the notebook $notebook = new TNotebook(530, 160); // adds the notebook page $notebook->appendPage('Dynamic filtering', $this->form); $check_gender = new TCheckGroup('check_gender'); $check_gender->addItems(array('M' => 'Male', 'F' => 'Female')); $check_gender->setLayout('horizontal'); $combo_status = new TCombo('combo_status'); $combo_status->addItems(array('S' => 'Single', 'C' => 'Committed', 'M' => 'Married')); $combo_customers = new TCombo('customers'); // add the fields inside the form $this->form->addQuickField('Load customers: ', $check_gender, 200); $this->form->addQuickField('', $combo_status, 200); $this->form->addQuickField('', $combo_customers, 200); $check_gender->setChangeAction(new TAction(array($this, 'onGenderChange'))); $combo_status->setChangeAction(new TAction(array($this, 'onGenderChange'))); // wrap the page content using vertical box $vbox = new TVBox(); $vbox->add(new TXMLBreadCrumb('menu.xml', __CLASS__)); $vbox->add($notebook); parent::add($vbox); }
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); }
/** * 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(); //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); }
/** * 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(); }
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 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); }
/** * 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); }
/** * Class constructor * Creates the page */ function __construct() { parent::__construct(); // create the form using TQuickForm class $this->form = new TQuickForm('form_interaction'); $this->form->setFormTitle('Dynamic interactions'); $this->form->class = 'tform'; // create the form fields $input_exit = new TEntry('input_exit'); $response_a = new TEntry('response_a'); $combo_change = new TCombo('combo_change'); $response_b = new TCombo('response_b'); $response_c = new TEntry('response_c'); $combo_items = array(); $combo_items['a'] = 'Item a'; $combo_items['b'] = 'Item b'; $combo_items['c'] = 'Item c'; $response_a->setEditable(FALSE); $response_c->setEditable(FALSE); $combo_change->addItems($combo_items); $response_b->addItems($combo_items); // add the fields inside the form $this->form->addQuickField('Input with exit action', $input_exit, 200); $this->form->addQuickField('Response A', $response_a, 200); $this->form->addQuickField('Combo with change action', $combo_change, 200); $this->form->addQuickField('Response B', $response_b, 200); $this->form->addQuickField('Response C', $response_c, 200); $this->form->addQuickAction('View', new TAction(array($this, 'onView')), 'ico_view.png'); // set exit action for input_exit $exit_action = new TAction(array($this, 'onExitAction')); $input_exit->setExitAction($exit_action); // set exit action for input_exit $change_action = new TAction(array($this, 'onChangeAction')); $combo_change->setChangeAction($change_action); // wrap the page content using vertical box $vbox = new TVBox(); $vbox->add(new TXMLBreadCrumb('menu.xml', __CLASS__)); $vbox->add($this->form); parent::add($vbox); }
/** * 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 * @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 */ public function __construct($name, $database, $model, $key, $value) { // 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', $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(); }
/** * 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); }
/** * Class constructor * Creates the page */ function __construct() { parent::__construct(); // create the form using TQuickForm class $this->form = new TQuickForm('form_enable_disable'); $this->form->setFormTitle('Enable/disable'); $this->form->class = 'tform'; // create the form fields $radio_enable = new TRadioGroup('enable'); $radio_enable->addItems(array('1' => 'Enable group 1', '2' => 'Enable group 2')); $radio_enable->setLayout('horizontal'); $radio_enable->setValue(1); $block1_combo = new TCombo('block1_combo'); $block1_entry = new TEntry('block1_entry'); $block1_spinner = new TSpinner('block1_spinner'); $block2_date = new TDate('block2_date'); $block2_entry = new TEntry('block2_entry'); $block2_check = new TCheckGroup('block2_check'); $block1_combo->addItems(array(1 => 'One', 2 => 'Two')); $block1_spinner->setRange(1, 100, 10); $block2_check->addItems(array('Y' => 'Yes', 'N' => 'No')); // add the fields inside the form $this->form->addQuickField('', $radio_enable, 200); $this->form->addQuickField('group #1', $block1_combo, 200); $this->form->addQuickField('', $block1_entry, 200); $this->form->addQuickField('', $block1_spinner, 200); $this->form->addQuickField('group #2', $block2_date, 80); $this->form->addQuickField('', $block2_entry, 200); $this->form->addQuickField('', $block2_check, 200); $radio_enable->setChangeAction(new TAction(array($this, 'onChangeRadio'))); self::onChangeRadio(array('enable' => 1)); // 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 and the registration form */ public function __construct() { parent::__construct(); parent::setSize(640, 350); parent::setTitle('Event'); // creates the form $this->form = new TForm('form_Event'); $this->form->class = 'tform'; // CSS class $this->form->style = 'width: 600px'; // add a table inside form $table = new TTable(); $table->width = '100%'; $this->form->add($table); // add a row for the form title $row = $table->addRow(); $row->class = 'tformtitle'; // CSS class $row->addCell(new TLabel('Event'))->colspan = 2; $hours = array(); $durations = array(); for ($n = 0; $n < 24; $n++) { $hours[$n] = "{$n}:00"; $durations[$n + 1] = $n + 1 . ' h'; } array_pop($durations); // create the form fields $id = new TEntry('id'); $event_date = new TDate('event_date'); $start_hour = new TCombo('start_hour'); $duration = new TCombo('duration'); $title = new TEntry('title'); $description = new TText('description'); $start_hour->addItems($hours); $duration->addItems($durations); $id->setEditable(FALSE); // define the sizes $id->setSize(40); $event_date->setSize(100); $start_hour->setSize(100); $duration->setSize(100); $title->setSize(400); $description->setSize(400, 50); // add one row for each form field $table->addRowSet(new TLabel('ID:'), $id); $table->addRowSet(new TLabel('Event Date:'), $event_date); $table->addRowSet(new TLabel('Start Hour:'), $start_hour); $table->addRowSet(new TLabel('Duration:'), $duration); $table->addRowSet(new TLabel('Title:'), $title); $table->addRowSet(new TLabel('Description:'), $description); // create an action button (save) $save_button = new TButton('save'); $save_button->setAction(new TAction(array($this, 'onSave')), _t('Save')); $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')), _t('Clear')); $new_button->setImage('ico_new.png'); $this->form->setFields(array($id, $event_date, $start_hour, $duration, $title, $description, $save_button, $new_button)); $buttons_box = new THBox(); $buttons_box->add($save_button); $buttons_box->add($new_button); // add a row for the form action $row = $table->addRow(); $row->class = 'tformaction'; // CSS class $row->addCell($buttons_box)->colspan = 2; 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); }
$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'); $label5 = new TLabel('Telefone'); //Posiciona os Campos e os Rotulos dentro do Painel $painel->put($label1, '10', '40'); $painel->put($codigo, '10', '60');
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); }
/** * 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); }
/** * Class constructor * Creates the page and the registration form */ function __construct() { parent::__construct(); // creates the form $this->form = new TQuickForm('form_Ponto'); $this->form->class = 'tform'; // CSS class $this->form->setFormTitle('Ponto'); // define the form title $this->string = new StringsUtil(); // create the form fields $id = new THidden('id'); $data_ponto = new TDate('data_ponto'); $data_ponto->setMask('dd/mm/yyyy'); $change_data_action = new TAction(array($this, 'onChangeDataAction')); $data_ponto->setExitAction($change_data_action); $hora_entrada = new THidden('hora_entrada'); $hora_saida = new THidden('hora_saida'); $qtde_horas = new TCombo('qtde_horas'); $qtde_minutos = new TCombo('qtde_minutos'); $qtde_horas_final = new TCombo('qtde_horas_final'); $qtde_minutos_final = new TCombo('qtde_minutos_final'); $colaborador_id = new THidden('colaborador_id'); TTransaction::open('atividade'); $logado = Pessoa::retornaUsuario(); $saldo_mes = Ponto::saldoHorasMes($logado->pessoa_codigo); TTransaction::close(); $colaborador_id->setValue($logado->pessoa_codigo); $colaborador_nome = new TEntry('colaborador_nome'); $colaborador_nome->setEditable(FALSE); $colaborador_nome->setValue($logado->pessoa_nome); $saldo_horas = new TEntry('saldo_horas'); $saldo_horas->setEditable(FALSE); $saldo_horas->setValue($saldo_mes); // cria combos de horas e minutos $combo_horas = array(); $combo_horas_final = array(); for ($i = 8; $i <= 18; $i++) { $combo_horas[$i] = str_pad($i, 2, 0, STR_PAD_LEFT); $combo_horas_final[$i] = str_pad($i, 2, 0, STR_PAD_LEFT); } $combo_horas_final[19] = '19'; $qtde_horas->addItems($combo_horas); $qtde_horas->setValue(8); $qtde_horas->setSize(60); $qtde_horas->setDefaultOption(FALSE); $qtde_horas_final->addItems($combo_horas_final); $qtde_horas_final->setSize(60); $combo_minutos = array(); $combo_minutos_final = array(); for ($i = 0; $i <= 59; $i++) { $combo_minutos[$i] = str_pad($i, 2, 0, STR_PAD_LEFT); $combo_minutos_final[$i] = str_pad($i, 2, 0, STR_PAD_LEFT); } $qtde_minutos->addItems($combo_minutos); $qtde_minutos->setValue(0); $qtde_minutos->setSize(60); $qtde_minutos->setDefaultOption(FALSE); $qtde_minutos_final->addItems($combo_minutos_final); $qtde_minutos_final->setSize(60); // validations $data_ponto->addValidation('Data', new TRequiredValidator()); // add the fields $this->form->addQuickField('Colaborador', $colaborador_nome, 200); $this->form->addQuickField('Data', $data_ponto, 100); $this->form->addQuickFields('Hora entrada', array($qtde_horas, $qtde_minutos)); $this->form->addQuickFields('Hora saida', array($qtde_horas_final, $qtde_minutos_final)); $this->form->addQuickField('Saldo no mês:', $saldo_horas, 125); $this->form->addQuickField('% Produtividade', new TLabel('<span style="background-color: #00B4FF;"><b>> 49% satisfatoria </b></span><br/><span style="background-color: #FFF800;"><b>30%-49% - Atenção</b></span><br/><span style="background-color: #FF0000;"><b>0-29% Baixa </b></span>'), 200); $this->form->addQuickField('', $hora_entrada, 200); $this->form->addQuickField('', $hora_saida, 200); $this->form->addQuickField('', $colaborador_id, 100); $this->form->addQuickField('', $id, 100); // create the form actions $this->form->addQuickAction('Salvar', new TAction(array($this, 'onSave')), 'fa:floppy-o'); $this->form->addQuickAction(_t('New'), new TAction(array($this, 'onEdit')), 'fa:plus-square green'); $this->form->addQuickAction('Excluir', new TAction(array($this, 'onDelete')), 'fa:trash-o red fa-lg'); TButton::disableField('form_Ponto', 'salvar'); TButton::disableField('form_Ponto', 'excluir'); // creates a DataGrid $this->datagrid = new TQuickGrid(); $this->datagrid->setHeight(320); // creates the datagrid columns $data_ponto = $this->datagrid->addQuickColumn('Data', 'data_ponto', 'left', 50); $hora_entrada = $this->datagrid->addQuickColumn('H.Ent', 'hora_entrada', 'left', 30); $hora_saida = $this->datagrid->addQuickColumn('H.Sai', 'hora_saida', 'left', 30); $hora_ponto = $this->datagrid->addQuickColumn('H.Pto', 'hora_ponto', 'left', 30); $intervalo = $this->datagrid->addQuickColumn('Atividades', 'intervalo', 'right', 30); $produtividade = $this->datagrid->addQuickColumn('% prod.', 'produtividade', 'right', 55); // transformers $hora_entrada->setTransformer(array($this, 'tiraSegundos')); $hora_saida->setTransformer(array($this, 'tiraSegundos')); $hora_ponto->setTransformer(array($this, 'calculaDiferenca')); $intervalo->setTransformer(array($this, 'retornaIntervalo')); $produtividade->setTransformer(array($this, 'calculaPercentualProdutividade')); // create the datagrid actions $edit_action = new TDataGridAction(array($this, 'onEdit')); $delete_action = new TDataGridAction(array($this, 'onDelete')); // add the actions to the datagrid $this->datagrid->addQuickAction(_t('Edit'), $edit_action, 'id', 'fa:pencil-square-o blue fa-lg'); // 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()); // 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()); // create the page container $container = TVBox::pack($this->form, $this->datagrid, $this->pageNavigation); parent::add($container); }
/** * */ 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); }