本文整理汇总了PHP中TEntry::addValidation方法的典型用法代码示例。如果您正苦于以下问题:PHP TEntry::addValidation方法的具体用法?PHP TEntry::addValidation怎么用?PHP TEntry::addValidation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TEntry
的用法示例。
在下文中一共展示了TEntry::addValidation方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: TQuickForm
/**
* 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);
}
示例2: TForm
/**
* 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);
}
示例3: TTable
/**
* 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);
}
示例4: TForm
/**
* 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);
}
示例5: TQuickForm
/**
* 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);
}
示例6: TQuickForm
/**
* 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);
}
示例7: __construct
/**
* 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);
}
示例8: TQuickForm
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);
}
示例9: __construct
/**
* 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);
}
示例10: TForm
//.........这里部分代码省略.........
$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');
示例11: TForm
/**
* 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
//.........这里部分代码省略.........
示例12: TForm
/**
* 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
//.........这里部分代码省略.........
示例13: __construct
/**
* 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');
//.........这里部分代码省略.........
示例14: TTable
/**
* 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);
}
示例15: TForm
/**
* 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');
//.........这里部分代码省略.........