/** * Class constructor * Creates the page and the registration form */ function __construct() { parent::__construct(); parent::setDatabase("app"); parent::setActiveRecord("TipoMaterialPermanente"); parent::setDefaultOrder("nome", "asc"); // creates the form $this->form = new TQuickForm('form_TipoMaterialPermanente'); $this->form->class = 'tform'; // CSS class $this->form->setFormTitle('Tipo de material permanente'); // define the form title // // create the form fields $id = new TEntry('id'); $id->setEditable(false); $nome = new TEntry('nome'); $nome->addValidation('Tipo do material permanente', new TRequiredValidator()); $custo = new TEntry('custo'); $custo->addValidation('Custo', new TRequiredValidator()); $custo->addValidation('Custo unitário', new TNumericValidator()); // add the fields $this->form->addQuickField('#', $id, 50); $this->form->addQuickField('Tipo de material permanente', $nome, 400); $this->form->addQuickField('Custo unitário', $custo, 100); // create the form 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('Relatório', new TAction(array($this, 'onReport')), 'ico_print.png'); // creates a DataGrid $this->datagrid = new TQuickGrid(); $this->datagrid->setHeight(320); // creates the datagrid columns $id = $this->datagrid->addQuickColumn('#', 'id', 'left', 50); $nome = $this->datagrid->addQuickColumn('Tipo de material permanente', 'nome', 'left', 600); $custo = $this->datagrid->addQuickColumn('Custo unitário', 'custo', 'right', 100); // 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', 'ico_edit.png'); $this->datagrid->addQuickAction(_t('Delete'), $delete_action, 'id', 'ico_delete.png'); // create the datagrid model $this->datagrid->createModel(); // creates the page navigation $this->pageNavigation = new TPageNavigation(); $this->pageNavigation->setAction(new TAction(array($this, 'onReload'))); $this->pageNavigation->setWidth($this->datagrid->getWidth()); // 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); }
/** * Class constructor */ function __construct() { parent::__construct(); // creates the form $this->form = new TForm('form_pdf_shapes'); // creates a table $table = new TTable(); // add the table inside the form $this->form->add($table); // create the form fields $name = new TEntry('name'); $name->addValidation('Name', new TRequiredValidator()); $label = new TLabel('Name' . ': '); $label->setFontColor('red'); $table->addRowSet($label, $name); $save_button = new TButton('generate'); $save_button->setAction(new TAction(array($this, 'onGenerate')), 'Generate'); $save_button->setImage('ico_save.png'); // add a row for the form action $table->addRowSet($save_button); // define wich are the form fields $this->form->setFields(array($name, $save_button)); // 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 table container $table = new TTable(); $table->style = 'width:100%'; // creates the form $this->form = new TForm('form_System_Provider'); $this->form->class = 'tform'; // add the notebook inside the form $this->form->add($table); $row1 = $table->addRow(); $row1->class = 'tformtitle'; $cell1 = $row1->addCell(new TLabel('Add new provider'), ''); $cell1->colspan = 2; // create the form fields $id = new TEntry('id'); $nif = new TEntry('nif'); $name = new TEntry('name'); $id->setEditable(false); // define the sizes $id->setSize(100); $nif->setSize(300); $name->setSize(300); // validations $nif->addValidation('nif', new TRequiredValidator()); $name->addValidation('name', new TRequiredValidator()); // add a row for the field id $table->addRowSet(new TLabel('ID:'), $id); $table->addRowSet(new TLabel('NIF: '), $nif); $table->addRowSet(new TLabel('Name: '), $name); // create an action button (save) $save_button = new TButton('save'); $save_button->setAction(new TAction(array($this, 'onSave')), _t('Save')); $save_button->setImage('fa:floppy-o'); // create an new button (edit with no parameters) $new_button = new TButton('new'); $new_button->setAction(new TAction(array($this, 'onEdit')), _t('New')); $new_button->setImage('fa:plus-square green'); $list_button = new TButton('list'); $list_button->setAction(new TAction(array('SystemProvidersList', 'onReload')), _t('Back to the listing')); $list_button->setImage('fa:table blue'); // define the form fields $this->form->setFields(array($id, $nif, $name, $save_button, $new_button, $list_button)); $buttons = new THBox(); $buttons->add($save_button); $buttons->add($new_button); $buttons->add($list_button); $container = new TTable(); $container->width = '80%'; $container->addRow()->addCell(new TXMLBreadCrumb('menu.xml', 'SystemProvidersList')); $container->addRow()->addCell($this->form); $row = $table->addRow(); $row->class = 'tformaction'; $cell = $row->addCell($buttons); $cell->colspan = 2; // add the form to the page parent::add($container); }
/** * Class constructor * Creates the page */ function __construct() { parent::__construct(); // create the form $this->form = new TForm(); $this->form->class = 'tform'; // creates the form field container $table = new TTable(); $table->width = '100%'; $this->form->add($table); // title row $table->addRowSet(new TLabel('Validation'), '')->class = 'tformtitle'; // create the form fields $field1 = new TEntry('field1'); $field2 = new TEntry('field2'); $field3 = new TEntry('field3'); $field4 = new TEntry('field4'); $field5 = new TEntry('field5'); $field6 = new TEntry('field6'); $field7 = new TEntry('field7'); $field1->addValidation('Field 1', new TMinLengthValidator(), array(3)); // cannot be less the 3 characters $field2->addValidation('Field 2', new TMaxLengthValidator(), array(20)); // cannot be greater the 20 characters $field3->addValidation('Field 3', new TMinValueValidator(), array(1)); // cannot be less the 1 $field4->addValidation('Field 4', new TMaxValueValidator(), array(10)); // cannot be greater the 10 $field5->addValidation('Field 5', new TRequiredValidator()); // required field $field6->addValidation('Field 6', new TEmailValidator()); // email field $field7->addValidation('Field 7', new TNumericValidator()); // numeric field // add a row for one field $table->addRowSet(new TLabel('1. Min length validator (3):'), $field1); $table->addRowSet(new TLabel('2. Max length validator (20):'), $field2); $table->addRowSet(new TLabel('3. Min value validator (1):'), $field3); $table->addRowSet(new TLabel('4. Max value validator (10):'), $field4); $table->addRowSet(new TLabel('5. Required validator:'), $field5); $table->addRowSet(new TLabel('6. Email validator:'), $field6); $table->addRowSet(new TLabel('7. Numeric validator:'), $field7); // creates the action button $button1 = new TButton('action1'); $button1->setAction(new TAction(array($this, 'onSave')), 'Save'); $button1->setImage('ico_save.png'); // add a row for the button $table->addRowSet($button1, '')->class = 'tformaction'; // define wich are the form fields $this->form->setFields(array($field1, $field2, $field3, $field4, $field5, $field6, $field7, $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(); Usuario::checkLogin(); // creates the form $this->form = new TQuickForm('form_Clientes'); $this->form->class = 'tform'; // CSS class // define the form title $this->form->setFormTitle('Clientes'); // defines the database parent::setDatabase('sample'); // defines the active record parent::setActiveRecord('Clientes'); // create the form fields $id = new THidden('id'); $nome = new TEntry('nome'); $sobrenome = new TEntry('sobrenome'); $cep = new TEntry('cep'); $logradouro = new TEntry('logradouro'); $bairro = new TEntry('bairro'); $cidade = new TEntry('cidade'); $email = new TEntry('email'); $dd = new TEntry('dd'); $telefone = new TEntry('telefone'); // mascaras nos campos usa-se o 9 para numero e o # para letra $telefone->setMask('9999-9999'); $dd->setMask('99'); $cep->setMask('99999-999'); // valida email $email->addValidation('E-mail', new TEmailValidator()); // new TRequiredValidator validador que faz com que o campo seja obrigatorio // add the fields $this->form->addQuickField('id', $id, 100); $this->form->addQuickField('nome', $nome, 200, new TRequiredValidator()); $this->form->addQuickField('sobrenome', $sobrenome, 200, new TRequiredValidator()); $this->form->addQuickField('cep', $cep, 200, new TRequiredValidator()); $this->form->addQuickField('logradouro', $logradouro, 200, new TRequiredValidator()); $this->form->addQuickField('bairro', $bairro, 200, new TRequiredValidator()); $this->form->addQuickField('cidade', $cidade, 200, new TRequiredValidator()); $this->form->addQuickField('email', $email, 200, new TRequiredValidator()); $this->form->addQuickField('dd', $dd, 200, new TRequiredValidator()); $this->form->addQuickField('telefone', $telefone, 200, new TRequiredValidator()); // add a form action $this->form->addQuickAction(_t('Save'), new TAction(array($this, 'onSave')), 'ico_save.png'); // add a form action $this->form->addQuickAction(_t('New'), new TAction(array($this, 'onEdit')), 'ico_new.png'); // add the form to the page 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('Informações Pessoais'); // create the form fields $id = new TEntry('id'); $nome = new TEntry('name'); $email = new TEntry('email'); $telefone = new TEntry('phone'); $usuario = new TEntry('login'); $date = new TDate('date'); $cep = new TEntry('cep'); $senha = new TPassword('password'); $cSenha = new TPassword('rpassword'); $telefone->setMask('(99)99999-9999'); $cep->setMask('99.999-999'); //$id->setValue(TSession::getValue('id')); //$usuario->setValue (TSession::getValue('login')); $id->setEditable(FALSE); //Adcionando validaões $nome->addValidation("name", new TRequiredValidator()); $email->addValidation("email", new TEmailValidator()); $telefone->addValidation("telefone", new TRequiredValidator()); $usuario->addValidation("login", new TRequiredValidator()); $date->addValidation("date", new TRequiredValidator()); $senha->addValidation("passsword", new TRequiredValidator()); $cSenha->addValidation("rpasssword", new TRequiredValidator()); // add the fields inside the form $this->form->addQuickField('Código', $id, 80); $this->form->addQuickField('Nome', $nome, 700); $this->form->addQuickField('Usuario', $usuario, 350); $this->form->addQuickField('Nova senha ', $senha, 200); $this->form->addQuickField('Confirma senha', $cSenha, 200); $this->form->addQuickField('E-mail', $email, 280); $this->form->addQuickField('Telefone', $telefone, 180); $this->form->addQuickField('CEP', $cep, 180); $this->form->addQuickField('Data De nascimento', $date, 180); // define the form action $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, the form and the listing */ public function __construct() { parent::__construct(); // define the database parent::setDatabase('samples'); // define the Active Record parent::setActiveRecord('Category'); // define the default order parent::setDefaultOrder('id', 'asc'); // turn off limit for datagrid $this->setLimit(-1); // create the form $this->form = new TQuickForm('form_categories'); $this->form->class = 'tform'; // CSS class $this->form->style = 'width: 500px'; $this->form->setFormTitle('Form/Datagrid'); // create the form fields $id = new TEntry('id'); $name = new TEntry('name'); $name->addValidation(_t('Name'), new TRequiredValidator()); // add the form fields $this->form->addQuickField('ID', $id, 40); $this->form->addQuickField('Name', $name, 200); // define the form 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'); // make id not editable $id->setEditable(FALSE); // create the datagrid $this->datagrid = new TQuickGrid(); $this->datagrid->setHeight(320); // add the columns $this->datagrid->addQuickColumn('ID', 'id', 'center', 50, new TAction(array($this, 'onReload')), array('order', 'id')); $this->datagrid->addQuickColumn('Name', 'name', 'left', 390, new TAction(array($this, 'onReload')), array('order', 'name')); // add the actions $this->datagrid->addQuickAction('Editar', new TDataGridAction(array($this, 'onEdit')), 'id', 'ico_edit.png'); $this->datagrid->addQuickAction('Deletar', new TDataGridAction(array($this, 'onDelete')), 'id', 'ico_delete.png'); // create the datagrid model $this->datagrid->createModel(); // wrap objects inside a table $table = new TTable(); $table->addRow()->addCell(new TXMLBreadCrumb('menu.xml', __CLASS__)); $table->addRow()->addCell($this->form); $table->addRow()->addCell($this->datagrid); // pack the table inside the page parent::add($table); }
function __construct() { parent::__construct(); Usuario::checkLogin(); // cria o formulario $this->form = new TQuickForm('form_Produtos'); $this->form->class = 'tform'; // class css do framework // titulo do formulario $this->form->setFormTitle('Produtos'); // banco de dados em uso parent::setDatabase('sample'); // model em uso parent::setActiveRecord('Produtos'); // cria os campos do formulario $id = new THidden('id'); $nome = new TEntry('nome'); //eleciona a categoria $categoria = new TDBCombo('categoria_id', 'sample', 'Categoria', 'id', 'nome', 'nome'); $descricao = new THtmlEditor('descricao'); $preco = new TEntry('preco'); $imagem = new PFile('imagem'); $imagem->setFolder('uploads'); $preco->addValidation('preco', new TNumericValidator()); // somente numeros $preco->setNumericMask(2, '.', ''); // seta a mascara para o mesmo padrao do mysql // adiciona os campos label,campo,tamanho $this->form->addQuickField('', $id, 100); $this->form->addQuickField('nome', $nome, 200); $this->form->addQuickField('preco', $preco, 200); $this->form->addQuickField('categoria', $categoria, 200); $this->form->addQuickField('imagem', $imagem, 200); $this->form->addQuickField('descricao', $descricao, 200); // para alterar o tamanho de componentes em sua altura e largura //deve coloca-las apos adicionar o campos no form $descricao->setSize(400, 300); // adciona actions no form $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'); // adciona o form na pagina parent::add($this->form); }
/** * Class constructor * Creates the page, the form and the listing */ public function __construct() { parent::__construct(); // create the form $this->form = new TQuickForm('form_categories'); $this->form->class = 'tform'; // CSS class $this->form->style = 'width: 500px'; $this->form->setFormTitle('Manual form/datagrid'); // create the form fields $id = new TEntry('id'); $name = new TEntry('name'); $name->addValidation('Name', new TRequiredValidator()); // add the fields in the form $this->form->addQuickField('ID', $id, 40); $this->form->addQuickField('Name', $name, 200); // create the form actions $this->form->addQuickAction('Salvar', new TAction(array($this, 'onSave')), 'ico_save.png'); $this->form->addQuickAction('Novo', new TAction(array($this, 'onEdit')), 'ico_new.png'); // id not editable $id->setEditable(FALSE); // create the datagrid $this->datagrid = new TQuickGrid(); $this->datagrid->setHeight(320); // add the datagrid columns $this->datagrid->addQuickColumn('ID', 'id', 'center', 50, new TAction(array($this, 'onReload')), array('order', 'id')); $this->datagrid->addQuickColumn('Name', 'name', 'left', 390, new TAction(array($this, 'onReload')), array('order', 'name')); // add the datagrid actions $this->datagrid->addQuickAction('Editar', new TDataGridAction(array($this, 'onEdit')), 'id', 'ico_edit.png'); $this->datagrid->addQuickAction('Deletar', new TDataGridAction(array($this, 'onDelete')), 'id', 'ico_delete.png'); // create the datagrid model $this->datagrid->createModel(); // wrap objects $table = new TTable(); $table->addRow()->addCell(new TXMLBreadCrumb('menu.xml', __CLASS__)); $table->addRow()->addCell($this->form); $table->addRow()->addCell($this->datagrid); // add the table in the page parent::add($table); }
/** * Class constructor * Creates the page and the registration form */ function __construct() { parent::__construct(); // creates the form $this->form = new TForm('form_Ticket'); $this->form->class = 'tform'; // CSS class $table = new TTable(); $table->style = 'width: 600px'; $tablePagamento = new TTable(); $tablePagamento->style = 'width: 600px'; $notebook = new TNotebook(600, 650); $notebook->appendPage('Ticket - Cadastramento', $table); $notebook->appendPage('Ticket - Orçamento / Pagamento', $tablePagamento); // create the form fields $id = new TEntry('id'); $id->setEditable(FALSE); $titulo = new TEntry('titulo'); $origem = new TCombo('origem'); $combo_origem = array(); $combo_origem['I'] = 'Interno'; $combo_origem['E'] = 'Externo'; $origem->addItems($combo_origem); $origem->setDefaultOption(FALSE); $solicitacao_descricao = new TText('solicitacao_descricao'); $providencia = new TText('providencia'); $orcamento_horas = new TEntry('orcamento_horas'); $orcamento_horas->setMask('999999'); $orcamento_valor_hora = new TEntry('orcamento_valor_hora'); $orcamento_valor_hora->setNumericMask(2, ',', '.'); $valor_desconto = new TEntry('valor_desconto'); $valor_desconto->setNumericMask(2, ',', '.'); $valor_total = new TEntry('valor_total'); $valor_total->setNumericMask(2, ',', '.'); $valor_total->setEditable(FALSE); $forma_pagamento = new TEntry('forma_pagamento'); $data_ultimo_pgto = new TEntry('data_ultimo_pgto'); $data_ultimo_pgto->setEditable(FALSE); $valor_ultimo_pgto = new TEntry('valor_ultimo_pgto'); $valor_ultimo_pgto->setNumericMask(2, ',', '.'); $valor_ultimo_pgto->setEditable(FALSE); $valor_total_pago = new TEntry('valor_total_pago'); $valor_total_pago->setNumericMask(2, ',', '.'); $valor_total_pago->setEditable(FALSE); $data_pagamento = new TDate('data_pagamento'); $data_pagamento->setMask('dd/mm/yyyy'); $valor_pagamento = new TEntry('valor_pagamento'); $valor_pagamento->setNumericMask(2, ',', '.'); $valor_total_parcial = new TEntry('valor_total_parcial'); $valor_total_parcial->setNumericMask(2, ',', '.'); $valor_total_parcial->setEditable(FALSE); $valor_saldo = new TEntry('valor_saldo'); $valor_saldo->setNumericMask(2, ',', '.'); $valor_saldo->setEditable(FALSE); $data_cadastro = new TEntry('data_cadastro'); $data_cadastro->setEditable(FALSE); $data_cadastro->setMask('dd/mm/yyyy'); $data_cadastro->setValue(date('d/m/Y')); $data_inicio = new TDate('data_inicio'); $data_inicio->setMask('dd/mm/yyyy'); $data_inicio_oculta = new THidden('data_inicio_oculta'); $data_cancelamento = new TDate('data_cancelamento'); $data_cancelamento->setMask('dd/mm/yyyy'); $data_encerramento = new TDate('data_encerramento'); $data_encerramento->setMask('dd/mm/yyyy'); $data_prevista = new TDate('data_prevista'); $data_prevista->setMask('dd/mm/yyyy'); $data_aprovacao = new TDate('data_aprovacao'); $data_aprovacao->setMask('dd/mm/yyyy'); $observacao = new TText('observacao'); $nome_dtr = new TEntry('nome_dtr'); $nome_dtr->setEditable(FALSE); $criteria = new TCriteria(); $criteria->add(new TFilter("origem", "=", 1)); $criteria->add(new TFilter("ativo", "=", 1)); $criteria->add(new TFilter("codigo_cadastro_origem", "=", 100)); $responsavel_id = new TDBCombo('responsavel_id', 'atividade', 'Pessoa', 'pessoa_codigo', 'pessoa_nome', 'pessoa_nome', $criteria); $tipo_ticket_id = new TDBCombo('tipo_ticket_id', 'atividade', 'TipoTicket', 'id', 'nome'); $tipo_ticket_id->setDefaultOption(FALSE); $sistema_id = new TDBCombo('sistema_id', 'atividade', 'Sistema', 'id', 'nome'); $status_ticket_id = new TDBCombo('status_ticket_id', 'atividade', 'StatusTicket', 'id', 'nome'); $status_ticket_id->setValue(2); $status_ticket_id->setEditable(FALSE); $prioridade_id = new TDBCombo('prioridade_id', 'atividade', 'Prioridade', 'id', 'nome'); $prioridade_id->setDefaultOption(FALSE); $prioridade_id->setValue(3); $combo_tipo_origens = new TCombo('tipo_origens'); $combo_tipo_origens->addItems(array(1 => 'Entidade', 2 => 'Estabelecimento', 3 => 'Empresa')); $combo_codigo_origem = new TCombo('codigo_cadastro_origem'); $combo_solicitante_id = new TCombo('solicitante_id'); try { TTransaction::open('atividade'); $logado = Pessoa::retornaUsuario(); TTransaction::close(); } catch (Exception $e) { new TMessage('error', '<b>Error</b> ' . $e->getMessage()); // shows the exception error message } $logado_id = new THidden('logado_id'); $logado_id->setValue($logado->pessoa_codigo); // define the sizes $id->setSize(100); $origem->setSize(200); $solicitacao_descricao->setSize(400, 180); $data_inicio->setSize(90); $data_encerramento->setSize(90); $data_cancelamento->setSize(90); $providencia->setSize(400, 80); $orcamento_horas->setSize(100); $orcamento_valor_hora->setSize(100); $valor_desconto->setSize(100); $valor_total->setSize(100); $valor_saldo->setSize(121); $forma_pagamento->setSize(400); $data_ultimo_pgto->setSize(100); $data_pagamento->setSize(100); $valor_pagamento->setSize(121); $valor_ultimo_pgto->setSize(100); $valor_total_pago->setSize(100); $valor_total_parcial->setSize(121); $data_cadastro->setSize(100); $data_prevista->setSize(100); $data_aprovacao->setSize(100); $observacao->setSize(400, 80); $nome_dtr->setSize(400); $titulo->setSize(390); $responsavel_id->setSize(390); $tipo_ticket_id->setSize(200); $sistema_id->setSize(200); $status_ticket_id->setSize(200); $prioridade_id->setSize(200); $combo_tipo_origens->setSize(135); $combo_codigo_origem->setSize(250); $combo_solicitante_id->setSize(390); // validações $titulo->addValidation('Titulo', new TRequiredValidator()); $combo_solicitante_id->addValidation('Solicitante', new TRequiredValidator()); $responsavel_id->addValidation('Responsável', new TRequiredValidator()); $sistema_id->addValidation('Sistema', new TRequiredValidator()); $gerar_dr = TButton::create('gerar_dr', array('RequisitoDesenvolvimentoForm', 'onEdit'), 'Gerar DTR', 'ico_add.png'); $link_dtr = new TButton('link_dtr'); $link_dtr->setImage('bs:edit green'); $link_dtr->setLabel('ir para DTR'); $link_dtr->addFunction("__adianti_load_page('index.php?class=RequisitoDesenvolvimentoForm&method=onBuscaDTR&key={$_REQUEST['key']}');"); $this->form->addField($gerar_dr); $this->form->addField($link_dtr); TButton::disableField('form_Ticket', 'gerar_dr'); TButton::disableField('form_Ticket', 'link_dtr'); // add one row for each form field // notebook Cadastramento $table->addRowSet(new TLabel('Ticket:'), array($id, new TLabel('Data Cadastro'), $data_cadastro)); $table->addRowSet($label_combo_origem = new TLabel('Origem:'), array($combo_tipo_origens, $combo_codigo_origem)); $label_combo_origem->setFontColor('#FF0000'); $table->addRowSet($label_solicitante = new TLabel('Solicitante:'), $combo_solicitante_id); $label_solicitante->setFontColor('#FF0000'); $table->addRowSet($label_responsavel = new TLabel('Responsável:'), $responsavel_id); $label_responsavel->setFontColor('#FF0000'); $table->addRowSet($label_titulo = new TLabel('Título:'), $titulo); $label_titulo->setFontColor('#FF0000'); $table->addRowSet(new TLabel('Data Inicio'), array($data_inicio, $label_status = new TLabel('Status:'), $status_ticket_id)); $label_status->setSize(70); $table->addRowSet(new TLabel('Data Encerramento:'), array($data_encerramento, $label_data_cancelamento = new TLabel('Data Cancelamento:'), $data_cancelamento)); $label_data_cancelamento->setSize(160); $table->addRowSet(new TLabel('Prioridade:'), $prioridade_id); $table->addRowSet(new TLabel('Origem:'), $origem); $table->addRowSet(new TLabel('Tipo Ticket:'), $tipo_ticket_id); $table->addRowSet($label_sistema = new TLabel('Sistema:'), $sistema_id); $label_sistema->setFontColor('#FF0000'); $table->addRowSet(new TLabel('Descrição Solicitação:'), $solicitacao_descricao); $table->addRowSet(new TLabel('DR.:'), $nome_dtr); $table->addRowSet(new TLabel(''), array($gerar_dr, $link_dtr)); $table->addRowSet(new TLabel(''), $data_inicio_oculta); // notebook Pagamento $tablePagamento->addRowSet(new TLabel('Data Prevista:'), $data_prevista); $tablePagamento->addRowSet(new TLabel('Data Aprovação:'), $data_aprovacao); $tablePagamento->addRowSet(new TLabel('Qte Horas:'), $orcamento_horas); $tablePagamento->addRowSet(new TLabel('Valor Hora:'), $orcamento_valor_hora); $tablePagamento->addRowSet(new TLabel('Valor Desconto:'), $valor_desconto); $tablePagamento->addRowSet(new TLabel('Valor Total:'), $valor_total); $tablePagamento->addRowSet(new TLabel('Forma de Pgto:'), $forma_pagamento); $tablePagamento->addRowSet(new TLabel('Descrição Providência:'), $providencia); $tablePagamento->addRowSet(new TLabel('Observação:'), $observacao); // creates a frame $frame = new TFrame(); $frame->oid = 'frame-measures'; $frame->setLegend('Pagamentos:'); $row = $tablePagamento->addRow(); $cell = $row->addCell($frame); $cell->colspan = 2; $page2 = new TTable(); $frame->add($page2); $page2->addRowSet(new TLabel('Valor Pgto:'), array($valor_pagamento, $tamanho_label = new TLabel('Valor Ultimo Pgto:'), $valor_ultimo_pgto)); $tamanho_label->setSize(150); $page2->addRowSet(new TLabel('Data Pgto:'), array($data_pagamento, $tamanho_label = new TLabel('Data Ultimo Pgto:'), $data_ultimo_pgto)); $tamanho_label->setSize(150); $page2->addRowSet(new TLabel('Valor Total:'), array($valor_total_parcial, $tamanho_label = new TLabel('Valor Total Pago: '), $valor_total_pago)); $tamanho_label->setSize(150); $page2->addRowSet(new TLabel('Saldo a pagar:'), $valor_saldo); $tablePagamento->addRowSet(new TLabel(''), $logado_id); // Envia campos para o formulario $this->form->setFields(array($id, $titulo, $data_inicio, $data_inicio_oculta, $data_encerramento, $data_cancelamento, $origem, $solicitacao_descricao, $nome_dtr, $providencia, $orcamento_horas, $orcamento_valor_hora, $valor_desconto, $valor_total, $forma_pagamento, $data_ultimo_pgto, $valor_ultimo_pgto, $valor_total_pago, $data_cadastro, $data_prevista, $data_aprovacao, $observacao, $tipo_ticket_id, $sistema_id, $status_ticket_id, $prioridade_id, $responsavel_id, $valor_total_parcial, $valor_pagamento, $data_pagamento, $valor_saldo, $combo_tipo_origens, $combo_codigo_origem, $combo_solicitante_id, $logado_id)); // create the form actions $save_button = TButton::create('save', array($this, 'onSave'), _t('Save'), 'fa:floppy-o'); $new_button = TButton::create('new', array($this, 'onEdit'), _t('New'), 'fa:plus-square green'); $del_button = TButton::create('delete', array($this, 'onDelete'), _t('Delete'), 'fa:trash-o red fa-lg'); $list_button = TButton::create('list', array('TicketList', 'onReload'), _t('List'), 'fa:table blue'); $enviar_email = TButton::create('email', array($this, 'onEnviaEmail'), 'Enviar Email', 'ico_email.png'); $sincronizar = TButton::create('sincronizar', array($this, 'onSincronizarContatos'), 'Sincronizar Contatos', 'sincronizar.png'); $this->form->addField($save_button); $this->form->addField($new_button); $this->form->addField($del_button); $this->form->addField($list_button); $this->form->addField($enviar_email); $this->form->addField($sincronizar); $subtable = new TTable(); $row = $subtable->addRow(); $row->addCell($save_button); $row->addCell($new_button); $row->addCell($del_button); $row->addCell($list_button); $row->addCell($enviar_email); $row->addCell($sincronizar); $pretable = new TTable(); $pretable->style = 'width: 100%'; $row = $pretable->addRow(); $row->class = 'tformtitle'; // CSS class $row->addCell(new TLabel('Cadastro de Ticket'))->colspan = 2; $change_action = new TAction(array($this, 'onCalculaValorTotal')); $orcamento_horas->setExitAction($change_action); $orcamento_valor_hora->setExitAction($change_action); $valor_desconto->setExitAction($change_action); $change_data_action = new TAction(array($this, 'onChangeDataAction')); $data_aprovacao->setExitAction($change_data_action); $change_data_prev = new TAction(array($this, 'onChangeDataPrevista')); $data_prevista->setExitAction($change_data_prev); $change_data_pagamento = new TAction(array($this, 'onChangeDataPagamento')); $data_pagamento->setExitAction($change_data_pagamento); $change_valor = new TAction(array($this, 'onCalculaValorParcial')); $valor_pagamento->setExitAction($change_valor); $change_status = new TAction(array($this, 'onChangeDataInicio')); $data_inicio->setExitAction($change_status); $change_status = new TAction(array($this, 'onChangeDataCancelamento')); $data_cancelamento->setExitAction($change_status); $change_status = new TAction(array($this, 'onChangeDataEncerramento')); $data_encerramento->setExitAction($change_status); $change_origem = new TAction(array($this, 'onChangeOrigem')); $combo_tipo_origens->setChangeAction($change_origem); $change_tipo_origem = new TAction(array($this, 'onChangeTipoOrigem')); $combo_codigo_origem->setChangeAction($change_tipo_origem); $vbox = new TVBox(); $vbox->add($pretable); $vbox->add($notebook); $vbox->add($subtable); $this->form->add($vbox); 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_System_user'); $this->form->class = 'tform'; // creates the table container $table = new TTable(); $table->style = 'width: 100%'; $table->addRowSet(new TLabel('Usuário'), '', '', '')->class = 'tformtitle'; // add the table inside the form $this->form->add($table); $frame_groups = new TFrame(NULL, 280); $frame_groups->setLegend('Grupos'); $frame_groups->style .= ';margin: 4px'; $frame_programs = new TFrame(NULL, 280); $frame_programs->setLegend('Programas'); $frame_programs->style .= ';margin: 15px'; // create the form fields $id = new TEntry('id'); $name = new TEntry('name'); $login = new TEntry('login'); $password = new TPassword('password'); $repassword = new TPassword('repassword'); $email = new TEntry('email'); $multifield_programs = new TMultiField('programs'); $program_id = new TDBSeekButton('program_id', 'esales', 'form_System_user', 'SystemProgram', 'name', 'programs_id', 'programs_name'); $program_name = new TEntry('program_name'); $groups = new TDBCheckGroup('groups', 'esales', 'SystemGroup', 'id', 'name'); $frontpage_id = new TDBSeekButton('frontpage_id', 'esales', 'form_System_user', 'SystemProgram', 'name', 'frontpage_id', 'frontpage_name'); $frontpage_name = new TEntry('frontpage_name'); $scroll = new TScroll(); $scroll->setSize(290, 230); $scroll->add($groups); $frame_groups->add($scroll); $frame_programs->add($multifield_programs); // define the sizes $id->setSize(100); $name->setSize(200); $login->setSize(150); $password->setSize(150); $email->setSize(200); $frontpage_id->setSize(100); $multifield_programs->setHeight(140); // outros $id->setEditable(false); $program_name->setEditable(false); $frontpage_name->setEditable(false); // validations $name->addValidation('Nome', new TRequiredValidator()); $login->addValidation('Login', new TRequiredValidator()); $email->addValidation('Email', new TEmailValidator()); $program_id->setSize(50); $program_name->setSize(200); // configuracoes multifield $multifield_programs->setClass('SystemProgram'); $multifield_programs->addField('id', 'ID', $program_id, 60); $multifield_programs->addField('name', 'Nome', $program_name, 250); $multifield_programs->setOrientation('horizontal'); // add a row for the field id $table->addRowSet(new TLabel('ID:'), $id, new TLabel('Nome' . ': '), $name); $table->addRowSet(new TLabel('login' . ': '), $login, new TLabel('Email' . ': '), $email); $table->addRowSet(new TLabel('Senha' . ': '), $password, new TLabel('Confirmar senha' . ': '), $repassword); $table->addRowSet(new TLabel('Página inicial' . ': '), $frontpage_id, new TLabel('Nome página' . ': '), $frontpage_name); $row = $table->addRow(); $cell = $row->addCell($frame_groups); $cell->colspan = 2; $row = $table->addRow(); $cell = $row->addCell($frame_programs); $cell->colspan = 2; // create an action button (save) $save_button = new TButton('save'); $save_button->setAction(new TAction(array($this, 'onSave')), 'Salvar'); $save_button->setImage('ico_save.png'); // create an new button (edit with no parameters) $new_button = new TButton('new'); $new_button->setAction(new TAction(array($this, 'onEdit')), 'Novo'); $new_button->setImage('ico_new.png'); $list_button = new TButton('list'); $list_button->setAction(new TAction(array('SystemUserList', 'onReload')), 'Voltar para listagem'); $list_button->setImage('ico_datagrid.png'); // define the form fields $this->form->setFields(array($id, $name, $login, $password, $repassword, $multifield_programs, $frontpage_id, $frontpage_name, $groups, $email, $save_button, $new_button, $list_button)); $buttons = new THBox(); $buttons->add($save_button); $buttons->add($new_button); $buttons->add($list_button); $row = $table->addRow(); $row->class = 'tformaction'; $cell = $row->addCell($buttons); $cell->colspan = 4; $container = new TTable(); $container->style = 'width: 80%'; $container->addRow()->addCell(new TXMLBreadCrumb('menu.xml', 'SystemUserList')); $container->addRow()->addCell($this->form); // add the form to the page parent::add($container); }
/** * Class constructor * Creates the page and the registration form */ function __construct() { parent::__construct(); // creates the form $this->form = new TForm('form_cliente'); // creates a table $table_data = new TTable(); $table_contact = new TTable(); $table_skill = new TTable(); $notebook = new TNotebook(500, 250); // add the notebook inside the form $this->form->add($notebook); $notebook->appendPage('Cadastro Cliente', $table_data); // $notebook->appendPage('Cidade', $table_contact); // $notebook->appendPage('Skill (aggregation)', $table_skill); // create the form fields $code = new TEntry('id'); $nome = new TEntry('nome'); $email = new TEntry('email'); $telefone = new TEntry('telefone'); $celular = new TEntry('celular'); $skype = new TEntry('skype'); $endereco = new TEntry('endereco'); // $cidade_id = new TSeekButton('cidade_id'); $cidade_id = new TDBCombo('cidade_id', 'db_crmbf', 'Cidade', 'id', 'nome'); // $birthdate = new TDate('birthdate'); // $email = new TEntry('email'); // $gender = new TRadioGroup('gender'); // $status = new TCombo('status'); // $contacts_list = new TMultiField('contacts_list'); // add field validators $nome->addValidation('Nome', new TRequiredValidator()); $cidade_id->addValidation('Cidade', new TRequiredValidator()); // $birthdate->addValidation('Birthdate', new TRequiredValidator); // $cidade_id->addValidation('Category', new TRequiredValidator); //$obj = new CidadeFormList; //$cidade_id->setAction(new TAction(array($obj, 'onReload'))); // $itemGender = array(); // $itemGender['M'] = 'Male'; // $itemGender['F'] = 'Female'; // // add the combo options // $gender->addItems($itemGender); // $gender->setLayout('horizontal'); // // $itemStatus = array(); // $itemStatus['S'] = 'Single'; // $itemStatus['C'] = 'Committed'; // $itemStatus['M'] = 'Married'; // $status->addItems($itemStatus); // define some properties for the form fields $code->setEditable(FALSE); $code->setSize(100); $nome->setSize(320); $email->setSize(160); $telefone->setSize(160); $celular->setSize(160); $skype->setSize(160); $endereco->setSize(320); $cidade_id->setSize(150); //$cidade_id->setEditable(FALSE); // add a row for the field code $row = $table_data->addRow(); $row->addCell(new TLabel('Code:')); $row->addCell($code); // add a row for the field name $row = $table_data->addRow(); $row->addCell(new TLabel('Nome:')); $cell = $row->addCell($nome); $cell->colspan = 3; // add a row for the field Email $row = $table_data->addRow(); $row->addCell(new TLabel('Email:')); $cell = $row->addCell($email); $cell->colspan = 3; // add a row for the field Telefone $row = $table_data->addRow(); $row->addCell(new TLabel('Telefone:')); $cell = $row->addCell($telefone); $cell->colspan = 3; // add a row for the field celular $row = $table_data->addRow(); $row->addCell(new TLabel('Celular:')); $cell = $row->addCell($celular); // add a row for the field skype $row = $table_data->addRow(); $row->addCell(new TLabel('skype:')); $cell = $row->addCell($skype); // add a row for the field endereco $row = $table_data->addRow(); $row->addCell(new TLabel('Endereço:')); $row->addCell($endereco); // add a row for the field endereco $row = $table_data->addRow(); $row->addCell(new TLabel('Cidade:')); $row->addCell($cidade_id); // add a row for the field Category // $row = $table_data->addRow(); // $row->addCell(new TLabel('Cidade:')); // $cell = $row->addCell($cidade_id); // add a row for the field city // $row=$table_data->addRow(); // $row->addCell(new TLabel('Cidade:')); // $cell = $row->addCell($cidade_id); /* // add a row for the field Phone $row = $table_data->addRow(); $row->addCell(new TLabel('Phone:')); $row->addCell($phone); // add a row for the field BirthDate $row->addCell(new TLabel('BirthDate:')); $row->addCell($birthdate); // add a row for the field status $row = $table_data->addRow(); $row->addCell(new TLabel('Status:')); $cell = $row->addCell($status); // add a row for the field Email $row->addCell(new TLabel('Email:')); $cell = $row->addCell($email); // add a row for the field gender $row->addCell(new TLabel('Gender:')); $row->addCell($gender); $row = $table_contact->addRow(); $cell = $row->addCell(new TLabel('<b>Contact</b>')); $cell->valign = 'top'; // add two fields inside the multifield in the second sheet $contacts_list->setHeight(100); $contacts_list->setClass('Contact'); // define the returning class $contacts_list->addField('type', 'Contact Type: ', new TEntry('type'), 200); $contacts_list->addField('value', 'Contact Value: ', new TEntry('value'), 200); $row = $table_contact->addRow(); $row->addCell($contacts_list); // create the radio button for the skills list $skill_list = new TDBCheckGroup('skill_list', 'samples', 'Skill', 'id', 'name'); $table_skill->addRow()->addCell($lbl = new TLabel('Skills')); $table_skill->addRow()->addCell($skill_list); $lbl->setFontStyle('b'); * */ // 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 (go to list) $button2 = new TButton('list'); $button2->setAction(new TAction(array('ClienteList', 'onReload')), 'Ir para Listagem'); $button2->setImage('ico_datagrid.gif'); // define wich are the form fields $this->form->setFields(array($code, $nome, $email, $telefone, $celular, $skype, $endereco, $cidade_id, $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); }
/** * Class constructor * Creates the page */ public function __construct() { parent::__construct(); new TSession(); // creates the items form and add a table inside $this->form_item = new TForm('form_pos'); $this->form_item->class = 'tform'; $table_item = new TTable(); $table_item->width = '100%'; $this->form_item->add($table_item); // create the form fields $product_id = new TDBSeekButton('product_id', 'samples', 'form_pos', 'Product', 'description', 'product_id', 'product_description'); $product_description = new TEntry('product_description'); $sale_price = new TEntry('sale_price'); $amount = new TEntry('amount'); $discount = new TEntry('discount'); $total = new TEntry('total'); // add validators $product_id->addValidation('Product', new TRequiredValidator()); $amount->addValidation('Amount', new TRequiredValidator()); // define the exit actions $product_id->setExitAction(new TAction(array($this, 'onExitProduct'))); $amount->setExitAction(new TAction(array($this, 'onUpdateTotal'))); $discount->setExitAction(new TAction(array($this, 'onUpdateTotal'))); // define some attributes $product_id->style = 'font-size: 17pt; height: 30px'; $product_description->style = 'font-size: 17pt; height: 30px'; $sale_price->style = 'font-size: 17pt; height: 30px'; $amount->style = 'font-size: 17pt; height: 30px'; $discount->style = 'font-size: 17pt; height: 30px'; $total->style = 'font-size: 17pt; height: 30px'; $product_id->button->style = 'height: 30px; margin-top:0px; vertical-align:top'; // define some properties $product_id->setSize(50); $product_description->setEditable(FALSE); $sale_price->setEditable(FALSE); $total->setEditable(FALSE); $sale_price->setNumericMask(2, '.', ','); $discount->setNumericMask(2, '.', ','); $total->setNumericMask(2, '.', ','); $sale_price->setSize(100); $amount->setSize(100); $discount->setSize(100); $total->setSize(100); // add a row for the form title $row = $table_item->addRow(); $row->class = 'tformtitle'; // CSS class $cell = $row->addCell(new TLabel('Point of Sales')); $cell->colspan = 4; // create the field labels $lab_pro = new TLabel('Product'); $lab_des = new TLabel('Description'); $lab_pri = new TLabel('Price'); $lab_amo = new TLabel('Amount'); $lab_dis = new TLabel('Discount'); $lab_tot = new TLabel('Total'); $lab_pro->setFontSize(17); $lab_des->setFontSize(17); $lab_pri->setFontSize(17); $lab_amo->setFontSize(17); $lab_dis->setFontSize(17); $lab_tot->setFontSize(17); $lab_pro->setFontFace('Trebuchet MS'); $lab_des->setFontFace('Trebuchet MS'); $lab_pri->setFontFace('Trebuchet MS'); $lab_amo->setFontFace('Trebuchet MS'); $lab_dis->setFontFace('Trebuchet MS'); $lab_tot->setFontFace('Trebuchet MS'); $lab_pro->setFontColor('red'); $lab_amo->setFontColor('red'); // creates the action button $button1 = new TButton('add'); $button1->setAction(new TAction(array($this, 'onAddItem')), 'Add item'); $button1->setImage('ico_add.png'); // add the form fields $table_item->addRowSet($lab_pro, $product_id, $lab_des, $product_description); $table_item->addRowSet($lab_pri, $sale_price, $lab_amo, $amount); $table_item->addRowSet($lab_dis, $discount, $lab_tot, array($total, $button1)); // define the form fields $this->form_item->setFields(array($product_id, $product_description, $sale_price, $amount, $discount, $total, $button1)); // creates the customer form and add a table inside it $this->form_customer = new TForm('form_customer'); $this->form_customer->class = 'tform'; $table_customer = new TTable(); $table_customer->width = '100%'; $this->form_customer->add($table_customer); // add a row for the form title $row = $table_customer->addRow(); $row->class = 'tformtitle'; // CSS class $cell = $row->addCell(new TLabel('Customer')); $cell->colspan = 5; // create the form fields $customer_id = new TDBSeekButton('customer_id', 'samples', 'form_customer', 'Customer', 'name', 'customer_id', 'customer_name'); $customer_name = new TEntry('customer_name'); // define validation and other properties $customer_id->addValidation('Customer', new TRequiredValidator()); $customer_id->style = 'font-size: 17pt; height: 30px'; $customer_name->style = 'font-size: 17pt; height: 30px'; $customer_id->button->style = 'height: 30px; margin-top:0px; vertical-align:top'; $customer_id->setSize(50); $customer_name->setEditable(FALSE); // create tha form labels $lab_cus = new TLabel('Customer'); $lab_nam = new TLabel('Name'); $lab_cus->setFontSize(17); $lab_nam->setFontSize(17); $lab_cus->setFontFace('Trebuchet MS'); $lab_nam->setFontFace('Trebuchet MS'); $lab_cus->setFontColor('red'); // action button $button2 = new TButton('save'); $button2->setAction(new TAction(array($this, 'onSave')), 'Save and finish'); $button2->setImage('ico_save.png'); // add the form fields inside the table $table_customer->addRowSet($lab_cus, $customer_id, $lab_nam, $customer_name, $button2); // define the form fields $this->form_customer->setFields(array($customer_id, $customer_name, $button2)); // creates the grid for items $this->cartgrid = new TQuickGrid(); $this->cartgrid->class = 'tdatagrid_table customized-table'; $this->cartgrid->makeScrollable(); $this->cartgrid->setHeight(150); parent::include_css('app/resources/custom-table.css'); $this->cartgrid->addQuickColumn('ID', 'product_id', 'right', 25); $this->cartgrid->addQuickColumn('Description', 'product_description', 'left', 230); $this->cartgrid->addQuickColumn('Price', 'sale_price', 'right', 80); $this->cartgrid->addQuickColumn('Amount', 'amount', 'right', 70); $this->cartgrid->addQuickColumn('Discount', 'discount', 'right', 70); $this->cartgrid->addQuickColumn('Total', 'total', 'right', 100); $this->cartgrid->addQuickAction('Delete', new TDataGridAction(array($this, 'onDelete')), 'product_id', 'ico_delete.png'); $this->cartgrid->createModel(); // wrap the page content using vertical box $vbox = new TVBox(); $vbox->add(new TXMLBreadCrumb('menu.xml', __CLASS__)); $vbox->add($this->form_item); $vbox->add(new TLabel(' ')); $vbox->add($this->cartgrid); $vbox->add(new TLabel(' ')); $vbox->add($this->form_customer); parent::add($vbox); }
/** * Class constructor * Creates the page and the registration form */ function __construct() { parent::__construct(); // creates the table container $table = new TTable(); $table->style = 'width:100%'; $frame_programs = new TFrame(); $frame_programs->setLegend(_t('Programs')); // creates the form $this->form = new TForm('form_System_group'); $this->form->class = 'tform'; // add the notebook inside the form $this->form->add($table); $table->addRowSet(new TLabel(_t('Group')), '')->class = 'tformtitle'; // create the form fields $id = new TEntry('id'); $name = new TEntry('name'); $multifield = new TMultiField('programs'); $program_id = new TDBSeekButton('program_id', 'permission', 'form_System_group', 'SystemProgram', 'name', 'programs_id', 'programs_name'); $program_name = new TEntry('program_name'); $frame_programs->add($multifield); $multifield->setHeight(140); $multifield->setClass('SystemProgram'); $multifield->addField('id', _t('Program') . ' ID', $program_id, 100, true); $multifield->addField('name', _t('Name'), $program_name, 250); $multifield->setOrientation('horizontal'); // define the sizes $program_id->setSize(70); $id->setSize(100); $name->setSize(200); // validations $name->addValidation('name', new TRequiredValidator()); // outras propriedades $id->setEditable(false); $program_name->setEditable(false); // add a row for the field id $table->addRowSet(new TLabel('ID:'), $id); $table->addRowSet(new TLabel(_t('Name') . ': '), $name); // add a row for the field name $row = $table->addRow(); $cell = $row->addCell($frame_programs); $cell->colspan = 2; // 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('New')); $new_button->setImage('ico_new.png'); $list_button = new TButton('list'); $list_button->setAction(new TAction(array('SystemGroupList', 'onReload')), _t('Back to the listing')); $list_button->setImage('ico_datagrid.png'); // define the form fields $this->form->setFields(array($id, $name, $multifield, $save_button, $new_button, $list_button)); $buttons = new THBox(); $buttons->add($save_button); $buttons->add($new_button); $buttons->add($list_button); $container = new TTable(); $container->width = '80%'; $container->addRow()->addCell(new TXMLBreadCrumb('menu.xml', 'SystemGroupList')); $container->addRow()->addCell($this->form); $row = $table->addRow(); $row->class = 'tformaction'; $cell = $row->addCell($buttons); $cell->colspan = 2; // add the form to the page parent::add($container); }
/** * Class constructor * Creates the page and the registration form */ function __construct() { parent::__construct(); // creates the form $this->form = new TForm('form_FreqServForm'); $this->form->class = 'tform'; // creates the table container $table = new TTable(); $table->style = 'width: 100%'; $table->addRowSet(new TLabel('Frequência'), '', '', '')->class = 'tformtitle'; // add the table inside the form $this->form->add($table); $frame_horarios = new TFrame(NULL, 210); $frame_horarios->setLegend('Horários'); $frame_horarios->style .= ';margin: 15px'; $frame_ausencia = new TFrame(NULL, 210); $frame_ausencia->setLegend('Ausência'); $frame_ausencia->style .= ';margin: 15px'; // create the form fields $id = new TEntry('id'); $servidor_id = new TDBSeekButton('servidor_id', 'lacenrh', 'form_FreqServForm', 'Servidor', 'servidor', 'servidor_id', 'servidor_nome'); $servidor_nome = new TEntry('servidor_nome'); $diames = new TDate('diames'); $entrada = new TEntry('entrada'); $intervalo_inicio = new TEntry('intervalo_inicio'); $intervalo_fim = new TEntry('intervalo_fim'); $saida = new TEntry('saida'); $ausencia_id = new TDBSeekButton('ausencia_id', 'lacenrh', 'form_FreqServForm', 'Ausencia', 'ausencia', 'ausencia_id', 'ausencia_desc'); $ausencia_desc = new TEntry('ausencia_desc'); $horas_justificadas = new TEntry('horas_justificadas'); $justificativa = new TText('justificativa'); $horas_trabalhadas = new TEntry('horas_trabalhadas'); // define the sizes $id->setSize(40); $servidor_id->setSize(40); $servidor_nome->setSize(300); $diames->setSize(100); $entrada->setSize(50); $intervalo_inicio->setSize(50); $intervalo_fim->setSize(50); $saida->setSize(50); $ausencia_id->setSize(40); $ausencia_desc->setSize(200); $horas_justificadas->setSize(50); $justificativa->setSize(200, 50); $horas_trabalhadas->setSize(200, 50); // outras propriedades $id->setEditable(false); $servidor_nome->setEditable(false); $diames->setMask('dd/mm/yyyy'); $entrada->setMask('99:99'); $entrada->setValue('00:00'); $intervalo_inicio->setMask('99:99'); $intervalo_inicio->setValue('00:00'); $intervalo_fim->setMask('99:99'); $intervalo_fim->setValue('00:00'); $saida->setMask('99:99'); $saida->setValue('00:00'); $ausencia_desc->setEditable(false); $horas_justificadas->setMask('99:99'); $horas_justificadas->setValue('00:00'); $horas_trabalhadas->setMask('99:99'); // validations $servidor_id->addValidation('Servidor', new TRequiredValidator()); $servidor_nome->addValidation('Nome', new TRequiredValidator()); $diames->addValidation('Data', new TRequiredValidator()); $table_horarios = new TTable(); $table_horarios->addRowSet(new TLabel('Data ' . ': '), $diames); $table_horarios->addRowSet(new TLabel('Entrada ' . ': '), $entrada); $table_horarios->addRowSet(new TLabel('Intervalo - Início ' . ': '), $intervalo_inicio); $table_horarios->addRowSet(new TLabel('Intervalo - Fim' . ': '), $intervalo_fim); $table_horarios->addRowSet(new TLabel('Saída' . ': '), $saida); $frame_horarios->add($table_horarios); $table_ausencia = new TTable(); $table_ausencia->addRowSet(new TLabel('Motivo ' . ': '), $ausencia_id); $table_ausencia->addRowSet(new TLabel('Descrição ' . ': '), $ausencia_desc); $table_ausencia->addRowSet(new TLabel('Horas Justificadas ' . ': '), $horas_justificadas); $table_ausencia->addRowSet(new TLabel('Justificativa ' . ': '), $justificativa); $frame_ausencia->add($table_ausencia); // add a row for the field id $table->addRowSet(new TLabel('ID:'), $id); $table->addRowSet(new TLabel('Servidor' . ': '), $servidor_id); $table->addRowSet(new TLabel('Nome' . ': '), $servidor_nome); $row = $table->addRow(); $cell = $row->addCell($frame_horarios); $cell->colspan = 2; $cell = $row->addCell($frame_ausencia); $cell->colspan = 2; // create an action button (save) $save_button = new TButton('save'); $save_button->setAction(new TAction(array($this, 'onSave')), _t('Save')); $save_button->setImage('fa:floppy-o fa-lg'); // create an new button (edit with no parameters) $new_button = new TButton('new'); $new_button->setAction(new TAction(array($this, 'onEdit')), _t('New')); $new_button->setImage('fa:plus-square green fa-lg'); $list_button = new TButton('list'); $list_button->setAction(new TAction(array('FrequenciaServidorList', 'onReload')), _t('Back to the listing')); $list_button->setImage('fa:table blue fa-lg'); // define the form fields $this->form->setFields(array($id, $servidor_id, $servidor_nome, $diames, $entrada, $intervalo_inicio, $intervalo_fim, $saida, $ausencia_id, $ausencia_desc, $horas_justificadas, $justificativa, $horas_trabalhadas, $save_button, $new_button, $list_button)); $buttons = new THBox(); $buttons->add($save_button); $buttons->add($new_button); $buttons->add($list_button); $row = $table->addRow(); $row->class = 'tformaction'; $cell = $row->addCell($buttons); $cell->colspan = 4; $container = new TTable(); $container->style = 'width: 80%'; $container->addRow()->addCell(new TXMLBreadCrumb('menu.xml', 'FrequenciaServidorList')); $container->addRow()->addCell($this->form); // add the form to the page parent::add($container); }
/** * Class constructor * Creates the page and the registration form */ function __construct() { parent::__construct(); $string = new StringsUtil(); // creates the form $this->form = new TForm('form_Atividade'); $this->form->class = 'tform'; // CSS class $this->form->style = 'width: 500px'; // 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('Atividade'))->colspan = 2; // busca dados do banco try { TTransaction::open('atividade'); $logado = Pessoa::retornaUsuario(); $ultimoPonto = Ponto::retornaUltimoPonto($logado->pessoa_codigo); $ponto = new Ponto($ultimoPonto); if ($ponto->hora_saida) { $action = new TAction(array('PontoFormList', 'onReload')); new TMessage('error', 'Não existe ponto com horario em aberto!', $action); } $data_padrao = $string->formatDateBR($ponto->data_ponto); $hora_padrao = Ponto::retornaHoraInicio($string->formatDate($data_padrao), $logado->pessoa_codigo); TTransaction::close(); } catch (Exception $e) { new TMessage('error', '<b>Error</b> ' . $e->getMessage()); } // create the form fields $id = new THidden('id'); $data_atividade = new TEntry('data_atividade'); $data_atividade->setMask('dd/mm/yyyy'); $data_atividade->setValue($data_padrao); $data_atividade->setEditable(FALSE); $hora_inicio = new TEntry('hora_inicio'); $hora_inicio->setEditable(FALSE); $hora_inicio->setValue($hora_padrao); $hora_fim = new THidden('hora_fim'); $hora_fim->setEditable(FALSE); $tempo_atividade = new TEntry('tempo_atividade'); $tempo_atividade->setEditable(FALSE); $qtde_horas = new TCombo('qtde_horas'); $qtde_minutos = new TCombo('qtde_minutos'); $descricao = new TText('descricao'); $colaborador_id = new THidden('colaborador_id'); $colaborador_id->setValue($logado->pessoa_codigo); $colaborador_nome = new TEntry('colaborador_nome'); $colaborador_nome->setEditable(FALSE); $colaborador_nome->setValue($logado->pessoa_nome); $tipo_atividade_id = new TDBCombo('tipo_atividade_id', 'atividade', 'TipoAtividade', 'id', 'nome', 'nome'); $sistema_id = new TDBCombo('sistema_id', 'atividade', 'Sistema', 'id', 'nome'); $ticket_id = new TCombo('ticket_id'); $criteria = new TCriteria(); $criteria->add(new TFilter("status_ticket_id", "IN", array(1, 5))); $newparam['order'] = 'id'; $newparam['direction'] = 'asc'; $criteria->setProperties($newparam); // order, offset $this->onComboTicket($criteria); $horario = explode(':', $hora_padrao); // cria combos de horas e minutos $combo_horas = array(); for ($i = 8; $i <= 18; $i++) { $combo_horas[$i] = str_pad($i, 2, 0, STR_PAD_LEFT); } $qtde_horas->addItems($combo_horas); $qtde_horas->setValue($horario[0]); $qtde_horas->setDefaultOption(FALSE); $combo_minutos = array(); for ($i = 0; $i <= 59; $i++) { $combo_minutos[$i] = str_pad($i, 2, 0, STR_PAD_LEFT); } $qtde_minutos->addItems($combo_minutos); $qtde_minutos->setValue($horario[1]); $qtde_minutos->setDefaultOption(FALSE); // set exit action for input_exit $change_action = new TAction(array($this, 'onChangeAction')); $qtde_horas->setChangeAction($change_action); $qtde_minutos->setChangeAction($change_action); $change_atividade_action = new TAction(array($this, 'onTrocaTipoAtividade')); $tipo_atividade_id->setChangeAction($change_atividade_action); $change_ticket_action = new TAction(array($this, 'onTrocaTicket')); $ticket_id->setChangeAction($change_ticket_action); // define the sizes $id->setSize(100); $data_atividade->setSize(100); $hora_inicio->setSize(100); $hora_fim->setSize(100); $qtde_horas->setSize(60); $qtde_minutos->setSize(60); $tempo_atividade->setSize(100); $descricao->setSize(300, 80); $colaborador_id->setSize(200); $tipo_atividade_id->setSize(200); $ticket_id->setSize(300); // validações $tempo_atividade->addValidation('Hora Fim', new THoraFimValidator()); $tipo_atividade_id->addValidation('Tipo de Atividade', new TRequiredValidator()); $ticket_id->addValidation('Ticket', new TRequiredValidator()); $sistema_id->addValidation('Sistema', new TRequiredValidator()); $descricao->addValidation('Descrição', new TMinLengthValidator(), array(10)); $sem_atividade = TButton::create('atividade', array($this, 'onSemAtividade'), 'Sem Registro', 'ico_add.png'); $this->form->addField($sem_atividade); // add one row for each form field $table->addRowSet(new TLabel('Colaborador:'), $colaborador_nome); $table->addRowSet(new TLabel('Data Atividade:'), array($data_atividade, $label_data = new TLabel('Data do último ponto'))); $label_data->setFontColor('#A9A9A9'); $table->addRowSet(new TLabel('Hora Inicio:'), $hora_inicio); $table->addRowSet($label_qtde_horas = new TLabel('Hora Fim:'), array($qtde_horas, $qtde_minutos, $sem_atividade)); $label_qtde_horas->setFontColor('#FF0000'); $table->addRowSet(new TLabel('Tempo Atividade:'), $tempo_atividade); $table->addRowSet($label_atividade = new TLabel('Tipo Atividade:'), $tipo_atividade_id); $label_atividade->setFontColor('#FF0000'); $table->addRowSet($label_ticket = new TLabel('Ticket:'), $ticket_id); $label_ticket->setFontColor('#FF0000'); $table->addRowSet($label_sistema = new TLabel('Sistema:'), $sistema_id); $label_sistema->setFontColor('#FF0000'); $table->addRowSet($label_descricao = new TLabel('Descrição:'), $descricao); $label_descricao->setFontColor('#FF0000'); $table->addRowSet(new TLabel(''), $id); $table->addRowSet(new TLabel(''), $colaborador_id); $table->addRowSet(new TLabel(''), $hora_fim); //esconder $this->form->setFields(array($id, $data_atividade, $hora_inicio, $qtde_horas, $qtde_minutos, $hora_fim, $tempo_atividade, $descricao, $colaborador_id, $colaborador_nome, $tipo_atividade_id, $ticket_id, $sistema_id)); // create the form actions $save_button = TButton::create('save', array($this, 'onSave'), _t('Save'), 'fa:floppy-o'); $new_button = TButton::create('new', array($this, 'onEdit'), _t('New'), 'fa:plus-square green'); $del_button = TButton::create('delete', array($this, 'onDelete'), _t('Delete'), 'fa:trash-o red fa-lg'); $list_button = TButton::create('list', array('AtividadeList', 'onClean'), _t('List'), 'fa:table blue'); $this->form->addField($save_button); $this->form->addField($new_button); $this->form->addField($del_button); $this->form->addField($list_button); $buttons_box = new THBox(); $buttons_box->add($save_button); $buttons_box->add($new_button); $buttons_box->add($del_button); $buttons_box->add($list_button); // add a row for the form action $row = $table->addRow(); $row->class = 'tformaction'; // CSS class $row->addCell($buttons_box)->colspan = 2; // TScript::create(' $( "#descricao" ).focus(); '); 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_System_user'); $this->form->class = 'tform'; // creates the table container $table = new TTable(); $table1 = new TTable(); $table2 = new TTable(); $hbox1 = new THBox(); $hbox2 = new THBox(); $table->style = 'width: 100%'; $table1->style = 'width: 100%'; $table2->style = 'width: 100%'; $this->form->add($table); $table->addRowSet(new TLabel(_t('User')), '', '', '')->class = 'tformtitle'; $table->addRowSet($hbox1); $table->addRowSet($hbox2); $hbox1->add($table1); $hbox1->add($table2); // add the table inside the form $this->form->add($table); $frame_groups = new TFrame(NULL, 280); $frame_groups->setLegend(_t('Groups')); $frame_groups->style .= ';margin: 4px'; $frame_programs = new TFrame(NULL, 280); $frame_programs->setLegend(_t('Programs')); $frame_programs->style .= ';margin: 4px'; // create the form fields $id = new TEntry('id'); $name = new TEntry('name'); $login = new TEntry('login'); $password = new TPassword('password'); $repassword = new TPassword('repassword'); $email = new TEntry('email'); $multifield_programs = new TMultiField('programs'); $program_id = new TDBSeekButton('program_id', 'permission', 'form_System_user', 'SystemProgram', 'name', 'programs_id', 'programs_name'); $program_name = new TEntry('program_name'); $groups = new TDBCheckGroup('groups', 'permission', 'SystemGroup', 'id', 'name'); $frontpage_id = new TDBSeekButton('frontpage_id', 'permission', 'form_System_user', 'SystemProgram', 'name', 'frontpage_id', 'frontpage_name'); $frontpage_name = new TEntry('frontpage_name'); $scroll = new TScroll(); $scroll->setSize(290, 240); $scroll->add($groups); $frame_groups->add($scroll); $frame_programs->add($multifield_programs); // define the sizes $id->setSize('50%'); $name->setSize('100%'); $login->setSize('100%'); $password->setSize('100%'); $repassword->setSize('100%'); $email->setSize('100%'); $frontpage_id->setSize('20%'); $multifield_programs->setHeight(140); // outros $id->setEditable(false); $program_name->setEditable(false); $frontpage_name->setEditable(false); // validations $name->addValidation(_t('Name'), new TRequiredValidator()); $login->addValidation('Login', new TRequiredValidator()); $email->addValidation('Email', new TEmailValidator()); $program_id->setSize(50); $program_name->setSize(200); // configuracoes multifield $multifield_programs->setClass('SystemProgram'); $multifield_programs->addField('id', 'ID', $program_id, 60); $multifield_programs->addField('name', _t('Name'), $program_name, 250); $multifield_programs->setOrientation('horizontal'); // add a row for the field id $row = $table1->addRow(); $row->addCell(new TLabel('ID:'))->style = 'width:150px'; $row->addCell($id); $table1->addRowSet(new TLabel(_t('Login') . ': '), $login); $table1->addRowSet(new TLabel(_t('Password') . ': '), $password); $table1->addRowSet(new TLabel(_t('Password confirmation') . ': '), $repassword); $row = $table2->addRow(); $row->addCell(new TLabel('Name:'))->style = 'width:150px'; $row->addCell($name); $table2->addRowSet(new TLabel(_t('Email') . ': '), $email); $table2->addRowSet(new TLabel(_t('Front page') . ': '), $frontpage_id); $table2->addRowSet(new TLabel(_t('Page name') . ': '), $frontpage_name); $hbox2->add($frame_groups); $hbox2->add($frame_programs); // create an action button (save) $save_button = new TButton('save'); $save_button->setAction(new TAction(array($this, 'onSave')), _t('Save')); $save_button->setImage('fa:floppy-o'); // create an new button (edit with no parameters) $new_button = new TButton('new'); $new_button->setAction(new TAction(array($this, 'onEdit')), _t('New')); $new_button->setImage('fa:plus-square green'); $list_button = new TButton('list'); $list_button->setAction(new TAction(array('SystemUserList', 'onReload')), _t('Back to the listing')); $list_button->setImage('fa:table blue'); // define the form fields $this->form->setFields(array($id, $name, $login, $password, $repassword, $multifield_programs, $frontpage_id, $frontpage_name, $groups, $email, $save_button, $new_button, $list_button)); $buttons = new THBox(); $buttons->add($save_button); $buttons->add($new_button); $buttons->add($list_button); $row = $table->addRow(); $row->class = 'tformaction'; $cell = $row->addCell($buttons); $cell->colspan = 4; $container = new TTable(); $container->style = 'width: 80%'; $container->addRow()->addCell(new TXMLBreadCrumb('menu.xml', 'SystemUserList')); $container->addRow()->addCell($this->form); // add the form to the page parent::add($container); }
/** * Class constructor * Creates the page and the registration form */ function __construct() { parent::__construct(); // creates the table container $table = new TTable(); $table->style = 'width:100%'; $frame_programs = new TFrame(); // creates the form $this->form = new TForm('form_System_RRHH'); $this->form->class = 'tform'; // add the notebook inside the form $this->form->add($table); $table->addRowSet(new TLabel('Employees'), '')->class = 'tformtitle'; // create the form fields $id = new TEntry('id'); $dni = new TEntry('dni'); $name = new TEntry('name'); $address = new TEntry('address'); $email = new TEntry('email'); $phone = new TEntry('phone'); // define the sizes $id->setSize(100); $dni->setSize(100); $name->setSize(200); $address->setSize(200); $email->setSize(200); $phone->setSize(200); // validations $dni->addValidation('dni', new TRequiredValidator()); $name->addValidation('name', new TRequiredValidator()); $address->addValidation('addres', new TRequiredValidator()); $email->addValidation('email', new TRequiredValidator()); $phone->addValidation('phone', new TRequiredValidator()); // add a row for the field id $table->addRowSet(new TLabel('ID:'), $dni); $table->addRowSet(new TLabel('DNI:'), $dni); $table->addRowSet(new TLabel('Name: '), $name); $table->addRowSet(new TLabel('Address: '), $address); $table->addRowSet(new TLabel('Email: '), $email); $table->addRowSet(new TLabel('Phone: '), $phone); // create an action button (save) $save_button = new TButton('save'); $save_button->setAction(new TAction(array($this, 'onSave')), _t('Save')); $save_button->setImage('fa:floppy-o'); // create an new button (edit with no parameters) $new_button = new TButton('new'); $new_button->setAction(new TAction(array($this, 'onEdit')), _t('New')); $new_button->setImage('fa:plus-square green'); $list_button = new TButton('list'); $list_button->setAction(new TAction(array('SystemStockList', 'onReload')), _t('Back to the listing')); $list_button->setImage('fa:table blue'); // define the form fields $this->form->setFields(array($id, $dni, $name, $address, $email, $phone, $save_button, $new_button, $list_button)); $buttons = new THBox(); $buttons->add($save_button); $buttons->add($new_button); $buttons->add($list_button); $container = new TTable(); $container->width = '80%'; $container->addRow()->addCell(new TXMLBreadCrumb('menu.xml', 'SystemRRHHList')); $container->addRow()->addCell($this->form); $row = $table->addRow(); $row->class = 'tformaction'; $cell = $row->addCell($buttons); $cell->colspan = 2; // add the form to the page parent::add($container); }
/** * Class constructor * Creates the page and the registration form */ function __construct() { parent::__construct(); // creates the form $this->form = new TForm('form_RequisitoDesenvolvimento'); $this->form->class = 'tform'; // CSS class $this->form->style = 'width: 500px'; $this->string = new StringsUtil(); // 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('Cadastro de DTr'))->colspan = 2; // create the form fields $id = new THidden('id'); $titulo = new TEntry('titulo'); $data_cadastro = new TEntry('data_cadastro'); $data_cadastro->setEditable(FALSE); $data_cadastro->setMask('dd/mm/yyyy'); $data_cadastro->setValue(date('d/m/Y')); $rotina = new TEntry('rotina'); $objetivo = new TText('objetivo'); $entrada = new TText('entrada'); $processamento = new TText('processamento'); $saida = new TText('saida'); $ticket_id = new TEntry('ticket_id'); $ticket_id->setEditable(FALSE); $ticket_titulo = new TEntry('ticket_titulo'); $ticket_titulo->setEditable(FALSE); // define the sizes $id->setSize(100); $titulo->setSize(300); $data_cadastro->setSize(100); $rotina->setSize(300); $objetivo->setSize(300, 60); $entrada->setSize(300, 60); $processamento->setSize(300, 60); $saida->setSize(300, 60); $ticket_id->setSize(45); $ticket_titulo->setSize(250); // validations $titulo->addValidation('Título', new TRequiredValidator()); $objetivo->addValidation('Objetivo', new TRequiredValidator()); $ticket_id->addValidation('Ticket', new TRequiredValidator()); // add one row for each form field $table->addRowSet($label_titulo = new TLabel('Título:'), $titulo); $label_titulo->setFontColor('#FF0000'); $table->addRowSet($label_ticket_id = new TLabel('Ticket:'), array($ticket_id, $ticket_titulo)); $label_ticket_id->setFontColor('#FF0000'); $table->addRowSet(new TLabel('Data de Cadastro:'), $data_cadastro); $table->addRowSet(new TLabel('Rotina:'), $rotina); $table->addRowSet($label_objetivo = new TLabel('Objetivo:'), $objetivo); $label_objetivo->setFontColor('#FF0000'); $table->addRowSet(new TLabel('Entrada:'), $entrada); $table->addRowSet(new TLabel('Processamento:'), $processamento); $table->addRowSet(new TLabel('Saida:'), $saida); $table->addRowSet(new TLabel(''), $id); $this->form->setFields(array($id, $titulo, $data_cadastro, $rotina, $objetivo, $entrada, $processamento, $saida, $ticket_id, $ticket_titulo)); // create the form actions $save_button = TButton::create('save', array($this, 'onSave'), _t('Save'), 'fa:floppy-o'); $list_button = TButton::create('list', array('RequisitoDesenvolvimentoList', 'onReload'), _t('List'), 'fa:table blue'); $gerar_dtr = TButton::create('gerar_dtr', array($this, 'onGenerate'), 'Gerar DTr', 'fa:floppy-o'); $gerar_kanban = TButton::create('gerar_kanban', array($this, 'onGenerateKanban'), 'Gerar Kanban', 'fa:floppy-o'); TButton::disableField('form_RequisitoDesenvolvimento', 'save'); TButton::disableField('form_RequisitoDesenvolvimento', 'gerar_dtr'); TButton::disableField('form_RequisitoDesenvolvimento', 'gerar_kanban'); $this->form->addField($save_button); $this->form->addField($list_button); $this->form->addField($gerar_dtr); $this->form->addField($gerar_kanban); $buttons_box = new THBox(); $buttons_box->add($save_button); $buttons_box->add($list_button); $buttons_box->add($gerar_dtr); $buttons_box->add($gerar_kanban); // 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 onStep2() { try { $data = $this->form->getData(); $this->form->validate(); $page2 = new TTable(); $this->notebook->appendPage('Page 2', $page2); $gender_options = array('M' => 'Male', 'F' => 'Female'); $ocupation_optins = array('S' => 'Self employed', 'B' => 'Business', 'R' => 'Retired'); switch ($data->field1) { case 'combo': $field3 = new TCombo('field3'); break; case 'radio': $field3 = new TRadioGroup('field3'); $field3->setLayout('horizontal'); break; case 'check': $field3 = new TCheckGroup('field3'); $field3->setLayout('horizontal'); break; } $field3->addValidation('Field 3', new TRequiredValidator()); switch ($data->field2) { case '1': $label = 'Gender'; $field3->addItems($gender_options); break; case '2': $label = 'Ocupation'; $field3->addItems($ocupation_optins); break; } $field4 = new TEntry('field4'); $field4->addValidation('Field 4', new TRequiredValidator()); // add a row for one field $row = $page2->addRow(); $row->addCell($l3 = new TLabel($label . ':')); $cell = $row->addCell($field3); // add a row for one field $row = $page2->addRow(); $row->addCell($l4 = new TLabel('Next tab title:')); $cell = $row->addCell($field4); $l3->setFontColor('#FF0000'); $l4->setFontColor('#FF0000'); // creates the action button $button2 = new TButton('action2'); $button2->setAction(new TAction(array($this, 'onStep3')), 'Next'); $button2->setImage('ico_next.png'); $row = $page2->addRow(); $row->addCell($button2); $this->form->addField($field3); $this->form->addField($field4); $this->form->addField($button2); $this->notebook->setCurrentPage(1); $this->form->setData($data); } catch (Exception $e) { new TMessage('error', $e->getMessage()); } }
/** * 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(); $table_contact = new TTable(); $table_skill = new TTable(); $notebook = new TNotebook(500, 500); // add the notebook inside the form $this->form->add($notebook); $notebook->appendPage('Cadastro Cliente', $table); // $notebook->appendPage('Cidade', $table_contact); // $notebook->appendPage('Skill (aggregation)', $table_skill); // create the form fields $code = new TEntry('id'); $projeto_id = new TDBCombo('projeto_id', 'db_crmbf', 'Projeto', 'id', 'nome'); $titulo = new TEntry('titulo'); $data = new TEntry('data'); $data->setEditable(false); $responsavel_id = new TDBCombo('responsavel_id', 'db_crmbf', 'user', 'id', 'name'); $tempo = new TSpinner('tempo'); $porcentagem = new TSlider('porcentagem'); $descricao = new TText('descricao'); $tipo_id = new TDBCombo('tipo_id', 'db_crmbf', 'Tipo', 'id', 'nome'); $cliente_id = new TDBCombo('cliente_id', 'db_crmbf', 'Cliente', 'id', 'nome'); $prioridade_id = new TDBCombo('prioridade_id', 'db_crmbf', 'Prioridade', 'id', 'nome'); $status_id = new TDBCombo('status_id', 'db_crmbf', 'Status', 'id', 'nome'); $usuarioalteracao = new THidden('usuarioalteracao'); $solicitante = new TEntry('solicitante'); // add field validators $titulo->addValidation('Nome', new TRequiredValidator()); // $cidade_id->addValidation('Cidade', new TRequiredValidator); // $birthdate->addValidation('Birthdate', new TRequiredValidator); // $cidade_id->addValidation('Category', new TRequiredValidator); //$obj = new CidadeFormList; //$cidade_id->setAction(new TAction(array($obj, 'onReload'))); // $itemGender = array(); // $itemGender['M'] = 'Male'; // $itemGender['F'] = 'Female'; // // add the combo options // $gender->addItems($itemGender); // $gender->setLayout('horizontal'); // // $itemStatus = array(); // $itemStatus['S'] = 'Single'; // $itemStatus['C'] = 'Committed'; // $itemStatus['M'] = 'Married'; // $status->addItems($itemStatus); // define some properties for the form fields $code->setEditable(FALSE); $code->setSize(100); $projeto_id->setSize(320); $titulo->setSize(320); $data->setSize(160); $data->setValue(date("d/m/Y H:i:s")); $responsavel_id->setSize(160); $tempo->setRange(0, 1000, 1); $tempo->setSize(160); $porcentagem->setRange(0, 100, 1); $porcentagem->setSize(150); $porcentagem->setTip('Porcentagem %'); $descricao->setSize(320); $tipo_id->setSize(150); $cliente_id->setSize(150); $prioridade_id->setSize(150); $status_id->setSize(150); $solicitante->setSize(150); $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('Projeto:')); $cell = $row->addCell($projeto_id); // add a row for the field name $row = $table->addRow(); $row->addCell(new TLabel('Titulo:')); $cell = $row->addCell($titulo); // add a row for the field Email $row = $table->addRow(); $row->addCell(new TLabel('Data:')); $cell = $row->addCell($data); // add a row for the field Telefone $row = $table->addRow(); $row->addCell(new TLabel('Responsavel:')); $cell = $row->addCell($responsavel_id); // add a row for the field celular $row = $table->addRow(); $row->addCell(new TLabel('Tempo:')); $cell = $row->addCell($tempo); // add a row for the field skype $row = $table->addRow(); $row->addCell(new TLabel('Porcentagem:')); $cell = $row->addCell($porcentagem); // add a row for the field endereco $row = $table->addRow(); $row->addCell(new TLabel('Tipo:')); $row->addCell($tipo_id); // add a row for the field endereco $row = $table->addRow(); $row->addCell(new TLabel('Cliente:')); $row->addCell($cliente_id); // add a row for the field endereco $row = $table->addRow(); $row->addCell(new TLabel('Prioridade:')); $row->addCell($prioridade_id); // add a row for the field endereco $row = $table->addRow(); $row->addCell(new TLabel('Solicitante:')); $row->addCell($solicitante); // add a row for the field endereco $row = $table->addRow(); $row->addCell(new TLabel('Descrição:')); $row->addCell($descricao); // add a row for the field celular $row = $table->addRow(); $row->addCell(new TLabel('Status:')); $cell = $row->addCell($status_id); // add a row for the field Category // $row = $table_data->addRow(); // $row->addCell(new TLabel('Cidade:')); // $cell = $row->addCell($cidade_id); // add a row for the field city // $row=$table_data->addRow(); // $row->addCell(new TLabel('Cidade:')); // $cell = $row->addCell($cidade_id); /* // add a row for the field Phone $row = $table_data->addRow(); $row->addCell(new TLabel('Phone:')); $row->addCell($phone); // add a row for the field BirthDate $row->addCell(new TLabel('BirthDate:')); $row->addCell($birthdate); // add a row for the field status $row = $table_data->addRow(); $row->addCell(new TLabel('Status:')); $cell = $row->addCell($status); // add a row for the field Email $row->addCell(new TLabel('Email:')); $cell = $row->addCell($email); // add a row for the field gender $row->addCell(new TLabel('Gender:')); $row->addCell($gender); $row = $table_contact->addRow(); $cell = $row->addCell(new TLabel('<b>Contact</b>')); $cell->valign = 'top'; // add two fields inside the multifield in the second sheet $contacts_list->setHeight(100); $contacts_list->setClass('Contact'); // define the returning class $contacts_list->addField('type', 'Contact Type: ', new TEntry('type'), 200); $contacts_list->addField('value', 'Contact Value: ', new TEntry('value'), 200); $row = $table_contact->addRow(); $row->addCell($contacts_list); // create the radio button for the skills list $skill_list = new TDBCheckGroup('skill_list', 'samples', 'Skill', 'id', 'name'); $table_skill->addRow()->addCell($lbl = new TLabel('Skills')); $table_skill->addRow()->addCell($skill_list); $lbl->setFontStyle('b'); * */ // 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 (go to list) $button2 = new TButton('list'); $button2->setAction(new TAction(array('CRMList', 'onReload')), 'Ir para Listagem'); $button2->setImage('ico_datagrid.gif'); // define wich are the form fields $this->form->setFields(array($code, $projeto_id, $titulo, $data, $responsavel_id, $tempo, $porcentagem, $descricao, $tipo_id, $cliente_id, $prioridade_id, $status_id, $usuarioalteracao, $solicitante, $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); }
/** * Class constructor * Creates the page and the registration form */ function __construct() { parent::__construct(); // creates the notebook $this->notebook = new TNotebook(); $this->notebook->setSize(700, 390); // creates the table container $tableCampos = new TTable(); // creates the form $this->form = new TForm('form_System_user'); $this->notebook->appendPage(_t('User'), $tableCampos); // add the notebook inside the form $this->form->add($this->notebook); $frame_groups = new TFrame(300, 250); $frame_groups->setLegend(_t('Groups')); $frame_groups->style = 'margin: 4px'; $frame_programs = new TFrame(340, 250); $frame_programs->setLegend(_t('Programs')); $frame_programs->style = 'margin: 4px'; // create the form fields $id = new TEntry('id'); $name = new TEntry('name'); $login = new TEntry('login'); $password = new TPassword('password'); $repassword = new TPassword('repassword'); $email = new TEntry('email'); $multifield_programs = new TMultiField('programs'); $program_id = new TDBSeekButton('program_id', 'permission', 'form_System_user', 'SystemProgram', 'name', 'programs_id', 'programs_name'); $program_name = new TEntry('program_name'); $groups = new TDBCheckGroup('groups', 'permission', 'SystemGroup', 'id', 'name'); $frontpage_id = new TDBSeekButton('frontpage_id', 'permission', 'form_System_user', 'SystemProgram', 'name', 'frontpage_id', 'frontpage_name'); $frontpage_name = new TEntry('frontpage_name'); $scroll = new TScroll(); $scroll->setSize(290, 230); $scroll->add($groups); $frame_groups->add($scroll); $frame_programs->add($multifield_programs); // define the sizes $id->setSize(100); $name->setSize(200); $login->setSize(150); $password->setSize(150); $email->setSize(200); $frontpage_id->setSize(100); $multifield_programs->setHeight(140); // outros $id->setEditable(false); $program_name->setEditable(false); $frontpage_name->setEditable(false); // validations $name->addValidation(_t('Name'), new TRequiredValidator()); $login->addValidation('Login', new TRequiredValidator()); $email->addValidation('Email', new TEmailValidator()); $program_id->setSize(50); $program_name->setSize(200); // configuracoes multifield $multifield_programs->setClass('SystemProgram'); $multifield_programs->addField('id', 'ID', $program_id, 60); $multifield_programs->addField('name', _t('Name'), $program_name, 250); $multifield_programs->setOrientation('horizontal'); // add a row for the field id $tableCampos->addRowSet(new TLabel('ID:'), $id, new TLabel(_t('Name') . ': '), $name); $tableCampos->addRowSet(new TLabel(_t('Login') . ': '), $login, new TLabel(_t('Email') . ': '), $email); $tableCampos->addRowSet(new TLabel(_t('Password') . ': '), $password, new TLabel(_t('Password confirmation') . ': '), $repassword); $tableCampos->addRowSet(new TLabel(_t('Front page') . ': '), $frontpage_id, new TLabel(_t('Page name') . ': '), $frontpage_name); $row = $tableCampos->addRow(); $cell = $row->addCell($frame_groups); $cell->colspan = 2; $cell = $row->addCell($frame_programs); $cell->colspan = 2; // 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('New')); $new_button->setImage('ico_new.png'); $list_button = new TButton('list'); $list_button->setAction(new TAction(array('SystemUserList', 'onReload')), _t('Back to the listing')); $list_button->setImage('ico_datagrid.png'); // define the form fields $this->form->setFields(array($id, $name, $login, $password, $repassword, $multifield_programs, $frontpage_id, $frontpage_name, $groups, $email, $save_button, $new_button, $list_button)); $table_buttons = new TTable(); $row_buttons = $table_buttons->addRow(); $row_buttons->addCell($save_button); $row_buttons->addCell($new_button); $row_buttons->addCell($list_button); $container = new TTable(); $container->addRow()->addCell(new TXMLBreadCrumb('menu.xml', 'SystemUserList')); $container->addRow()->addCell($this->form); $container->addRow()->addCell($table_buttons); // add the form to the page parent::add($container); }
/** * */ public function makeTEntry($properties) { $widget = new TEntry((string) $properties->{'name'}); $widget->setValue((string) $properties->{'value'}); $widget->setMask((string) $properties->{'mask'}); $widget->setSize((int) $properties->{'width'}); if (isset($properties->{'maxlen'})) { $widget->setMaxLength((int) $properties->{'maxlen'}); } if (isset($properties->{'tip'})) { $widget->setTip((string) $properties->{'tip'}); } if (isset($properties->{'required'}) and $properties->{'required'} == '1') { $widget->addValidation((string) $properties->{'name'}, new TRequiredValidator()); } $widget->setEditable((string) $properties->{'editable'}); $this->fields[] = $widget; $this->fieldsByName[(string) $properties->{'name'}] = $widget; return $widget; }
/** * Class constructor * Creates the page and the registration form */ function __construct() { parent::__construct(); // creates the form $this->form = new TForm('form_customer'); // creates a table $table_data = new TTable(); $table_contact = new TTable(); $table_skill = new TTable(); $notebook = new TNotebook(500, 250); // add the notebook inside the form $this->form->add($notebook); $notebook->appendPage('Registration Data', $table_data); $notebook->appendPage('Contact (composition)', $table_contact); $notebook->appendPage('Skill (aggregation)', $table_skill); // create the form fields $code = new TEntry('id'); $name = new TEntry('name'); $address = new TEntry('address'); $phone = new TEntry('phone'); $city_id = new TSeekButton('city_id'); $city_name = new TEntry('city_name'); $birthdate = new TDate('birthdate'); $email = new TEntry('email'); $gender = new TRadioGroup('gender'); $status = new TCombo('status'); $contacts_list = new TMultiField('contacts_list'); $category_id = new TDBCombo('category_id', 'samples', 'Category', 'id', 'name'); // add field validators $name->addValidation('Name', new TRequiredValidator()); $city_id->addValidation('City', new TRequiredValidator()); $birthdate->addValidation('Birthdate', new TRequiredValidator()); $category_id->addValidation('Category', new TRequiredValidator()); $obj = new CitySeek(); $city_id->setAction(new TAction(array($obj, 'onReload'))); $itemGender = array(); $itemGender['M'] = 'Male'; $itemGender['F'] = 'Female'; // add the combo options $gender->addItems($itemGender); $gender->setLayout('horizontal'); $itemStatus = array(); $itemStatus['S'] = 'Single'; $itemStatus['C'] = 'Committed'; $itemStatus['M'] = 'Married'; $status->addItems($itemStatus); // define some properties for the form fields $code->setEditable(FALSE); $code->setSize(100); $city_id->setSize(100); $city_name->setSize(150); $city_name->setEditable(FALSE); $name->setSize(320); $address->setSize(320); $phone->setSize(120); $email->setSize(160); $birthdate->setSize(90); $status->setSize(120); $category_id->setSize(120); // add a row for the field code $table_data->addRowSet(new TLabel('Code:'), $code); $table_data->addRowSet(new TLabel('Name:'), $name); $table_data->addRowSet(new TLabel('Address:'), $address); $table_data->addRowSet(new TLabel('City:'), array($city_id, new TLabel('Name:'), $city_name)); $table_data->addRowSet(new TLabel('Phone:'), array($phone, new TLabel('BirthDate:'), $birthdate)); $table_data->addRowSet(new TLabel('Status:'), array($status, new TLabel('Email:'), $email)); $table_data->addRowSet(new TLabel('Category:'), array($category_id, new TLabel('Gender:'), $gender)); $row = $table_contact->addRow(); $cell = $row->addCell(new TLabel('<b>Contact</b>')); $cell->valign = 'top'; // add two fields inside the multifield in the second sheet $contacts_list->setHeight(100); $contacts_list->setClass('Contact'); // define the returning class $contacts_list->addField('type', 'Contact Type: ', new TEntry('type'), 200); $contacts_list->addField('value', 'Contact Value: ', new TEntry('value'), 200); $row = $table_contact->addRow(); $row->addCell($contacts_list); // create the radio button for the skills list $skill_list = new TDBCheckGroup('skill_list', 'samples', 'Skill', 'id', 'name'); $table_skill->addRow()->addCell($lbl = new TLabel('Skills')); $table_skill->addRow()->addCell($skill_list); $lbl->setFontStyle('b'); // 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 (go to list) $button2 = new TButton('list'); $button2->setAction(new TAction(array('CustomerDataGridView', 'onReload')), 'Go to Listing'); $button2->setImage('ico_datagrid.gif'); // define wich are the form fields $this->form->setFields(array($code, $name, $address, $phone, $city_id, $city_name, $birthdate, $email, $gender, $status, $category_id, $contacts_list, $skill_list, $button1, $button2)); $subtable = new TTable(); $row = $subtable->addRow(); $row->addCell($button1); $row->addCell($button2); // wrap the page content $vbox = new TVBox(); $vbox->add(new TXMLBreadCrumb('menu.xml', 'CustomerDataGridView')); $vbox->add($this->form); $vbox->add($subtable); // add the form inside the page parent::add($vbox); }
/** * Form constructor * @param $param Request */ public function __construct($param) { parent::__construct(); // creates the form $this->form = new TForm('form_Cliente'); $this->form->class = 'tform'; // change CSS class $note = new TNotebook(400, 300); // add a table inside form $table = new TTable(); $table->width = '100%'; // add a row for the form title $row = $table->addRow(); $row->class = 'tformtitle'; // CSS class $row->addCell(new TLabel('Clientes'))->colspan = 2; // create the form fields $id = new TEntry('id'); $nome = new TEntry('nome'); // campo para telefones $multifield = new TMultiField('telefone'); $telefone_id = new TEntry('id'); $telefone_id->setEditable(false); $telefone = new TEntry('numero'); $telefone->setMask('(99)99999-9999'); // campo para emails $multifield_email = new TMultiField('email'); $email = new TEntry('email'); $email_id = new TEntry('id'); $email->addValidation('email', new TEmailValidator()); $multifield->addField('id', 'Codigo', $telefone_id, 200); $multifield->addField('numero', 'Telefone', $telefone, 200, true); $multifield_email->addField('id', 'Codigo', $email_id, 200); $multifield_email->addField('email', 'Email', $email, 200, true); // define the sizes $id->setSize(100); $nome->setSize(200); // add one row for each form field $table->addRowSet(new TLabel('id:'), $id); $table->addRowSet(new TLabel('nome:'), $nome); $this->form->setFields(array($id, $nome, $multifield, $multifield_email)); // create the form actions $save_button = TButton::create('save', array($this, 'onSave'), _t('Save'), 'bs:floppy-disk red'); $new_button = TButton::create('new', array($this, 'onEdit'), _t('New'), 'bs:edit green'); $this->form->addField($save_button); $this->form->addField($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; $note->appendPage('Clientes', $table); $note->appendPage('Telefone', $multifield); $note->appendPage('Email', $multifield_email); $this->form->add($note); // vertical box container $container = new TVBox(); $container->style = 'width: 90%'; // $container->add(new TXMLBreadCrumb('menu.xml', __CLASS__)); $container->add(TPanelGroup::pack('Title', $this->form)); parent::add($container); }
/** * Class constructor * Creates the page and the registration form */ function __construct() { parent::__construct(); // security check if (TSession::getValue('logged') !== TRUE) { throw new Exception(_t('Not logged')); } // security check TTransaction::open('changeman'); if (Member::newFromLogin(TSession::getValue('login'))->role_mnemonic == 'CUSTOMER') { throw new Exception(_t('Permission denied')); } TTransaction::close(); $table = new TTable(); // creates the form $this->form = new TForm('form_Issue'); $this->form->add($table); $table->width = '100%'; $this->form->style = 'width: 750px'; $this->form->class = 'tform'; $table->addRowSet(new TLabel(_t('Issue')), '')->class = 'tformtitle'; $table1 = new TTable(); $table2 = new TTable(); // create the form fields $id = new TEntry('id'); $id_user = new TDBCombo('id_user', 'changeman', 'Member', 'id', 'name'); $id_status = new TDBCombo('id_status', 'changeman', 'Status', 'id', 'complete_description'); $id_project = new TDBCombo('id_project', 'changeman', 'Project', 'id', 'description'); $id_priority = new TDBCombo('id_priority', 'changeman', 'Priority', 'id', 'description_translated'); $id_category = new TDBCombo('id_category', 'changeman', 'Category', 'id', 'description_translated'); $id_release = new TDBCombo('id_release', 'changeman', 'Release', 'id', 'name'); $id_member = new TDBCombo('id_member', 'changeman', 'Member', 'id', 'name'); $register_date = new TDate('register_date'); $close_date = new TDate('close_date'); $time = new TEntry('issue_time'); $title = new TEntry('title'); $description = new THtmlEditor('description'); $solution = new THtmlEditor('solution'); $id_user->addValidation(_t('User'), new TRequiredValidator()); $id_status->addValidation(_t('Status'), new TRequiredValidator()); $id_project->addValidation(_t('Project'), new TRequiredValidator()); $id_priority->addValidation(_t('Priority'), new TRequiredValidator()); $id_category->addValidation(_t('Category'), new TRequiredValidator()); $register_date->addValidation(_t('Start date'), new TRequiredValidator()); $title->addValidation(_t('Title'), new TRequiredValidator()); $description->addValidation(_t('Description'), new TRequiredValidator()); // define the sizes $id->setSize(100); $id_user->setSize(200); $id_status->setSize(200); $id_project->setSize(200); $id_priority->setSize(200); $id_category->setSize(200); $id_release->setSize(200); $id_member->setSize(200); $register_date->setSize(100); $close_date->setSize(100); $time->setSize(200); $title->setSize(200, 40); $description->setSize(680, 300); $solution->setSize(680, 300); $register_date->setMask('yyyy-mm-dd'); $close_date->setMask('yyyy-mm-dd'); $id->setEditable(FALSE); // add a row for the field id $table1->addRowSet(new TLabel('ID:'), $id); $table1->addRowSet(new TLabel(_t('User') . ': '), $id_user); $table1->addRowSet(new TLabel(_t('Status') . ': '), $id_status); $table1->addRowSet(new TLabel(_t('Project') . ': '), $id_project); $table1->addRowSet(new TLabel(_t('Priority') . ': '), $id_priority); $table1->addRowSet(new TLabel(_t('Category') . ': '), $id_category); $table2->addRowSet(new TLabel(_t('Release') . ': '), $id_release); $table2->addRowSet(new TLabel(_t('Assigned to')), $id_member); $table2->addRowSet(new TLabel(_t('Start date') . ':'), $register_date); $table2->addRowSet(new TLabel(_t('Due date') . ':'), $close_date); $table2->addRowSet(new TLabel(_t('Time') . ':'), $time); $table2->addRowSet(new TLabel(_t('Title') . ':'), $title); $row = $table->addRow(); $row->addCell($table1); $row->addCell($table2); $subnotebook = new TNotebook(); $subnotebook->setSize(710, 320); $subnotebook->style = 'padding: 50px'; $subnotebook->appendPage(_t('Description'), $description); $subnotebook->appendPage(_t('Solution'), $solution); $hbox = new THBox(); $hbox->add($subnotebook); $hbox->style = 'margin: 10px'; $row = $table->addRow(); $cell = $row->addCell($hbox); $cell->colspan = 3; // create an action button (save) $save_button = new TButton('save'); // define the button action $save_button->setAction(new TAction(array($this, 'onSave')), _t('Save')); $save_button->setImage('ico_save.png'); $table->addRowSet($save_button, '')->class = 'tformaction'; // define wich are the form fields $this->form->setFields(array($id, $id_user, $id_status, $id_project, $id_priority, $id_category, $id_release, $id_member, $register_date, $close_date, $time, $title, $description, $solution, $save_button)); // add the form to the page parent::add($this->form); }
/** * Class constructor * Creates the page and the registration form */ function __construct() { parent::__construct(); // creates the table container $table = new TTable(); $table->style = 'width:100%'; $frame_programs = new TFrame(); // creates the form $this->form = new TForm('form_System_Receipt'); $this->form->class = 'tform'; // add the notebook inside the form $this->form->add($table); $row1 = $table->addRow(); $row1->class = 'tformtitle'; $cell1 = $row1->addCell(new TLabel('Add new receipt'), ''); $cell1->colspan = 2; // create the form fields $id = new TEntry('id'); $client = new TDBCombo('client', 'permission', 'SystemClients', 'name', 'name'); $amount = new TEntry('account_money'); $date = new TDate('date'); $id->setEditable(false); // define the sizes $id->setSize(100); $client->setSize(300); $amount->setSize(300); $date->setSize(300); // validations $client->addValidation('client', new TRequiredValidator()); $amount->addValidation('account_money', new TRequiredValidator()); $date->addValidation('date', new TRequiredValidator()); // add a row for the field id $table->addRowSet(new TLabel('ID:'), $id); $table->addRowSet(new TLabel('Client: '), $client); $table->addRowSet(new TLabel('Account money: '), $amount); $table->addRowSet(new TLabel('Date: '), $date); // create an action button (save) $save_button = new TButton('save'); $save_button->setAction(new TAction(array($this, 'onSave')), _t('Save')); $save_button->setImage('fa:floppy-o'); // create an new button (edit with no parameters) $new_button = new TButton('new'); $new_button->setAction(new TAction(array($this, 'onEdit')), _t('New')); $new_button->setImage('fa:plus-square green'); $list_button = new TButton('list'); $list_button->setAction(new TAction(array('SystemInvoicesList', 'onReload')), _t('Back to the listing')); $list_button->setImage('fa:table blue'); // define the form fields $this->form->setFields(array($id, $client, $amount, $date, $save_button, $new_button, $list_button)); $buttons = new THBox(); $buttons->add($save_button); $buttons->add($new_button); $buttons->add($list_button); $container = new TTable(); $container->width = '80%'; $container->addRow()->addCell(new TXMLBreadCrumb('menu.xml', 'SystemInvoicesList')); $container->addRow()->addCell($this->form); $row = $table->addRow(); $row->class = 'tformaction'; $cell = $row->addCell($buttons); $cell->colspan = 2; // add the form to the page parent::add($container); }
/** * Class constructor * Creates the page, the form and the listing */ public function __construct() { parent::__construct(); // create the form $this->form = new TQuickForm('form_categories'); $this->form->class = 'tform'; // CSS class $this->form->style = 'width: 100%'; $this->form->setFormTitle('Lista de Endereços'); // create the form fields $id = new TEntry('id'); $name = new TEntry('name'); $cep = new TEntry('cep'); $rua = new TEntry('rua'); $bairro = new TEntry('bairro'); $numero = new TEntry('numero'); $cUser = new THidden('system_user_id'); $complemento = new TText('complemento'); //Adicionando validações $cep->addValidation("cep", new TRequiredValidator()); $rua->addValidation("rua", new TRequiredValidator()); $bairro->addValidation("bairro", new TRequiredValidator()); $numero->addValidation("numero", new TRequiredValidator()); #$name->addValidation('Name', new TRequiredValidator); $cep->setMask('99.999-999'); $numero->setMask('999999999'); $cUser->setValue(TSession::getValue('id')); // add the fields in the form $this->form->addQuickField('ID', $id, 40); $this->form->addQuickField('cUser', $cUser, 40); $this->form->addQuickField('Cep', $cep, 200); $this->form->addQuickField('Rua', $rua, 200); $this->form->addQuickField('Bairro', $bairro, 200); $this->form->addQuickField('Numero', $numero, 80); $this->form->addQuickField('Complemento', $complemento, 200); $complemento->setSize(400, 70); // create the form actions $this->form->addQuickAction('Salvar', new TAction(array($this, 'onSave')), 'ico_save.png'); $this->form->addQuickAction('Novo', new TAction(array($this, 'onEdit')), 'ico_new.png'); // id not editable $id->setEditable(FALSE); // create the datagrid $this->datagrid = new TQuickGrid(); $this->datagrid->setHeight(320); $this->datagrid->style = "width:100%"; // add the datagrid columns $this->datagrid->addQuickColumn('Rua', 'rua', 'center', 50, new TAction(array($this, 'onReload')), array('order', 'id')); $this->datagrid->addQuickColumn('Bairro', 'bairro', 'left', 390, new TAction(array($this, 'onReload')), array('order', 'bairro')); $this->datagrid->addQuickColumn('Complemento', 'complemento', 'left', 390, new TAction(array($this, 'onReload')), array('order', 'complemento')); $this->datagrid->addQuickColumn('Numero', 'numero', 'left', 390, new TAction(array($this, 'onReload')), array('order', 'numero')); $this->datagrid->addQuickColumn('CEP', 'cep', 'left', 390, new TAction(array($this, 'onReload')), array('order', 'cep')); // add the datagrid actions $this->datagrid->addQuickAction('Editar', new TDataGridAction(array($this, 'onEdit')), 'id', 'ico_edit.png'); $this->datagrid->addQuickAction('Deletar', new TDataGridAction(array($this, 'onDelete')), 'id', 'ico_delete.png'); // create the datagrid model $this->datagrid->createModel(); // wrap objects $table = new TTable(); $table->style = "width:100%"; $table->addRow()->addCell(new TXMLBreadCrumb('menu.xml', __CLASS__)); $table->addRow()->addCell($this->form); $table->addRow()->addCell($this->datagrid); // add the table in the page parent::add($table); }
/** * Construtor de classe * Cria o formulário de material consumo */ function __construct() { parent::__construct(); parent::setDatabase("app"); parent::setActiveRecord("MaterialConsumoDerivado"); parent::setDefaultOrder("id", "asc"); // Cria o formulário $this->form = new TQuickForm('form_MaterialConsumo'); $this->form->class = 'tform'; // CSS class $this->form->setFormTitle('Material de consumo (novos ou necessidade extraordinária) a ser incluído na Proposta Orçamentária de 2017'); // define the form title // Cria os campos de formulário $id = new THidden('id'); $tipo_material_consumo_id = new TDBCombo('tipo_material_consumo_id', 'app', 'TipoMaterialConsumo', 'id', 'nome', 'nome'); $tipo_material_consumo_id->addValidation('Tipo do material', new TRequiredValidator()); $change_action = new TAction(array($this, 'onChangeAction')); $tipo_material_consumo_id->setChangeAction($change_action); $descricao = new TEntry('descricao'); $justificativa = new TText('justificativa'); $justificativa->addValidation('Justificativa', new TRequiredValidator()); $quantidade = new TEntry('quantidade'); $quantidade->addValidation('Quantidade', new TRequiredValidator()); $quantidade->addValidation('Quantidade', new TNumericValidator()); $custo = new TEntry('custo'); $custo->addValidation('Custo', new TRequiredValidator()); $custo->addValidation('Custo', new TNumericValidator()); $total = new TEntry('total'); $total->setEditable(false); // Adiciona os campos $this->form->addQuickField('', $id); //$this->form->add($id); $this->form->addQuickField('Tipo de material consumo', $tipo_material_consumo_id, 480); $this->form->addQuickField('Descrição', $descricao, 480); $this->form->addQuickField('Justificativa', $justificativa, 200); $justificativa->setSize(480, 100); $this->form->addQuickField('Quantidade', $quantidade, 200); $this->form->addQuickField('Previsão de custo unitário', $custo, 200); $this->form->addQuickField('Total', $total, 200); // Cria as ações do formulário $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'); $actionHelp = new TAction(array("PaginaAjuda", 'onHelp')); $actionHelp->setParameters(array("key" => 3)); $this->form->addQuickAction(_t('Help'), $actionHelp, 'ico_help.png'); // Cria o datagrid $this->datagrid = new TQuickGrid(); $this->datagrid->setHeight(320); // Cria as colunas do datagrid $this->datagrid->addQuickColumn('Tipo de material consumo', 'tipoMaterialConsumo->nome', 'left', 200); $this->datagrid->addQuickColumn('Descrição', 'descricao', 'left', 200); $this->datagrid->addQuickColumn('Quant.', 'quantidade', 'right', 100); $this->datagrid->addQuickColumn('Previsão de custo', 'custo', 'right', 100); $this->datagrid->addQuickColumn('Total', 'total', 'right', 100); // Cria as ações do datagrid $edit_action = new TDataGridAction(array($this, 'onEdit')); $delete_action = new TDataGridAction(array($this, 'onDelete')); // Adiciona as ações do datagrid $this->datagrid->addQuickAction(_t('Edit'), $edit_action, 'id', 'ico_edit.png'); $this->datagrid->addQuickAction(_t('Delete'), $delete_action, 'id', 'ico_delete.png'); // Cria o modelo do datagrid $this->datagrid->createModel(); // Cria a navegação de página $this->pageNavigation = new TPageNavigation(); $this->pageNavigation->setAction(new TAction(array($this, 'onReload'))); $this->pageNavigation->setWidth($this->datagrid->getWidth()); // Cria o container da página $container = TVBox::pack($this->form, $this->datagrid, $this->pageNavigation); parent::add($container); }
/** * Class constructor * Creates the page and the registration form */ function __construct() { parent::__construct(); // security check if (TSession::getValue('logged') !== TRUE) { throw new Exception(_t('Not logged')); } // security check TTransaction::open('changeman'); if (Member::newFromLogin(TSession::getValue('login'))->role_mnemonic !== 'ADMINISTRATOR' and Member::newFromLogin(TSession::getValue('login'))->role_mnemonic !== 'MANAGER') { throw new Exception(_t('Permission denied')); } TTransaction::close(); // creates a table $table = new TTable(); // creates the form $this->form = new TForm('form_Release'); $this->form->class = 'tform'; $this->form->style = 'width: 640px'; $this->form->add($table); $table->width = '100%'; $table->addRowSet(new TLabel(_t('Release')), '')->class = 'tformtitle'; $options = array('Y' => _t('Yes'), 'N' => _t('No')); // create the form fields $id = new TEntry('id'); $id_project = new TDBCombo('id_project', 'changeman', 'Project', 'id', 'description'); $name = new TEntry('name'); $sendmail = new TRadioGroup('sendmail'); $description = new THtmlEditor('description'); $id_project->addValidation(_t('Project'), new TRequiredValidator()); $name->addValidation(_t('Name'), new TRequiredValidator()); $id->setEditable(FALSE); // define the sizes $id->setSize(100); $id_project->setSize(200); $name->setSize(200, 40); $description->setSize(530, 200); $sendmail->addItems($options); $sendmail->setLayout('horizontal'); $sendmail->setValue('N'); $table->addRowSet(new TLabel('ID:'), $id); $table->addRowSet(new TLabel(_t('Project') . ': '), $id_project); $table->addRowSet(new TLabel(_t('Name') . ': '), $name); $table->addRowSet(new TLabel(_t('Send e-mail') . ': '), $sendmail); $hbox = new THBox(); $hbox->style = 'margin: 10px'; $hbox->add($description); // add a row for the field description $row = $table->addRow(); $row->addCell($lbl = new TLabel(_t('Description') . ': ')); $lbl->setFontStyle('b'); $row = $table->addRow(); $cell = $row->addCell($hbox); $cell->colspan = 3; // create an action button (save) $save_button = new TButton('save'); // define the button action $save_button->setAction(new TAction(array($this, 'onSave')), _t('Save')); $save_button->setImage('ico_save.png'); $table->addRowSet($save_button, '')->class = 'tformaction'; // define wich are the form fields $this->form->setFields(array($id, $id_project, $name, $description, $sendmail, $save_button)); // add the form to the page parent::add($this->form); }