本文整理汇总了PHP中TEntry::setNumericMask方法的典型用法代码示例。如果您正苦于以下问题:PHP TEntry::setNumericMask方法的具体用法?PHP TEntry::setNumericMask怎么用?PHP TEntry::setNumericMask使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TEntry
的用法示例。
在下文中一共展示了TEntry::setNumericMask方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: TQuickForm
function __construct()
{
parent::__construct();
// creates the form
$this->form = new TQuickForm('form_Product');
$this->form->class = 'tform';
// CSS class
$this->form->style = 'width: 650px;';
// defines the form title
$this->form->setFormTitle('Product');
// define the database and the Active Record
parent::setDatabase('samples');
parent::setActiveRecord('Product');
// units
$units = array('PC' => 'Pieces', 'GR' => 'Grain');
// create the form fields
$id = new TEntry('id');
$description = new TEntry('description');
$stock = new TEntry('stock');
$sale_price = new TEntry('sale_price');
$unity = new TCombo('unity');
$photo_path = new TFile('photo_path');
$id->setEditable(FALSE);
$unity->addItems($units);
$stock->setNumericMask(2, ',', '.', TRUE);
// TRUE: process mask when editing and saving
$sale_price->setNumericMask(2, ',', '.', TRUE);
// TRUE: process mask when editing and saving
// add the form fields
$this->form->addQuickField('ID', $id, 200);
$this->form->addQuickField('Description', $description, 200, new TRequiredValidator());
$this->form->addQuickField('Stock', $stock, 200, new TRequiredValidator());
$this->form->addQuickField('Sale Price', $sale_price, 200, new TRequiredValidator());
$this->form->addQuickField('Unity', $unity, 200, new TRequiredValidator());
$this->form->addQuickField('Photo Path', $photo_path, 200);
$photo_path->setSize(200, 40);
// add the actions
$this->form->addQuickAction(_t('Save'), new TAction(array($this, 'onSave')), 'ico_save.png');
$this->form->addQuickAction(_t('New'), new TAction(array($this, 'onEdit')), 'ico_new.png');
$this->form->addQuickAction(_t('Back'), new TAction(array('ProductList', 'onReload')), 'ico_back.png');
$vbox = new TVBox();
$vbox->add(new TXMLBreadCrumb('menu.xml', 'ProductList'));
$vbox->add($this->form);
parent::add($vbox);
}
示例2: 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);
}
示例3: THtmlRenderer
/**
* Class constructor
* Creates the page
*/
function __construct()
{
parent::__construct();
// load the styles
TPage::include_css('app/resources/formdecorator.css');
// create the HTML Renderer
$html = new THtmlRenderer('app/resources/formdecorator.html');
// create the form using TQuickForm class
$this->form = new TQuickForm();
// create the form fields
$id = new TEntry('id');
$description = new TEntry('description');
$date = new TDate('date');
$time = new TEntry('time');
$number = new TEntry('number');
$text = new TText('text');
$description->setTip('Type the description here...');
$date->setMask('dd/mm/yyyy');
// define date mask
$time->setMask('99:99');
$number->setNumericMask(2, ',', '.');
// define numeric input
// add the fields inside the form
$this->form->addQuickField('Id', $id, 40);
$this->form->addQuickField('Description', $description, 200);
$this->form->addQuickField('Date (dd/mm/yyyy)', $date, 80);
$this->form->addQuickField('Time (99:99)', $time, 60);
$this->form->addQuickField('Numeric Input (9.999,99)', $number, 100);
$this->form->addQuickField('Text', $text, 120);
$text->setSize(200, 100);
// define the form action
$this->form->addQuickAction('Save', new TAction(array($this, 'onSave')), 'ico_save.png');
// replace the main section variables
$replace = array('form' => $this->form);
$html->enableSection('main', $replace);
// wrap the page content using vertical box
$vbox = new TVBox();
$vbox->add(new TXMLBreadCrumb('menu.xml', __CLASS__));
$vbox->add($html);
parent::add($vbox);
}
示例4: __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');
//.........这里部分代码省略.........
示例5: TForm
/**
* 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());
//.........这里部分代码省略.........