本文整理汇总了PHP中TEntry::setValue方法的典型用法代码示例。如果您正苦于以下问题:PHP TEntry::setValue方法的具体用法?PHP TEntry::setValue怎么用?PHP TEntry::setValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TEntry
的用法示例。
在下文中一共展示了TEntry::setValue方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* Class constructor
* Creates the page, the form and the listing
*/
public function __construct()
{
parent::__construct();
Usuario::checkLogin();
parent::setDatabase('sample');
// defines the database
parent::setActiveRecord('Usuario');
// defines the active record
parent::setDefaultOrder('id', 'asc');
// defines the default order
parent::setFilterField('login');
// defines the filter field
// creates the form, with a table inside
$this->form = new TForm('form_search_Usuario');
$table = new TTable();
$this->form->add($table);
// create the form fields
$filter = new TEntry('login');
$filter->setValue(TSession::getValue('Usuario_login'));
// add a row for the filter field
$table->addRowSet(new TLabel('login:'), $filter);
// create two action buttons to the form
$find_button = new TButton('find');
$new_button = new TButton('new');
$find_button->setAction(new TAction(array($this, 'onSearch')), _t('Find'));
$new_button->setAction(new TAction(array('UsuarioForm', 'onEdit')), _t('New'));
$find_button->setImage('ico_find.png');
$new_button->setImage('ico_new.png');
// add a row for the form actions
$table->addRowSet($find_button, $new_button);
// define wich are the form fields
$this->form->setFields(array($filter, $find_button, $new_button));
// creates a DataGrid
$this->datagrid = new TQuickGrid();
$this->datagrid->setHeight(320);
// creates the datagrid columns
$id = $this->datagrid->addQuickColumn('id', 'id', 'right', 100);
$login = $this->datagrid->addQuickColumn('login', 'login', 'left', 200);
$senha = $this->datagrid->addQuickColumn('senha', 'senha', 'left', 200);
// create the datagrid actions
$edit_action = new TDataGridAction(array('UsuarioForm', 'onEdit'));
$delete_action = new TDataGridAction(array($this, 'onDelete'));
// add the actions to the datagrid
$this->datagrid->addQuickAction(_t('Edit'), $edit_action, 'id', 'ico_edit.png');
$this->datagrid->addQuickAction(_t('Delete'), $delete_action, 'id', 'ico_delete.png');
// create the datagrid model
$this->datagrid->createModel();
// create the page navigation
$this->pageNavigation = new TPageNavigation();
$this->pageNavigation->setAction(new TAction(array($this, 'onReload')));
$this->pageNavigation->setWidth($this->datagrid->getWidth());
// create the page container
$container = new TVBox();
$container->add($this->form);
$container->add($this->datagrid);
$container->add($this->pageNavigation);
parent::add($container);
}
示例2: __construct
/**
* Constructor Method
* Creates the page, the search form and the listing
*/
public function __construct()
{
parent::__construct();
// creates a new form
$this->form = new TForm('form_standard_seek');
// creates a new table
$table = new TTable();
// adds the table into the form
$this->form->add($table);
// create the form fields
$display_field = new TEntry('display_field');
// keeps the field's value
$display_field->setValue(TSession::getValue('tstandardseek_display_value'));
// add a row for the filter field
$row = $table->addRow();
$row->addCell(new TLabel('Field:'));
$row->addCell($display_field);
// create the action button
$find_button = new TButton('busca');
// define the button action
$find_button->setAction(new TAction(array($this, 'onSearch')), TAdiantiCoreTranslator::translate('Search'));
$find_button->setImage('ico_find.png');
// add a row for the button in the table
$row = $table->addRow();
$row->addCell($find_button);
// define wich are the form fields
$this->form->setFields(array($display_field, $find_button));
// creates a new datagrid
$this->datagrid = new TDataGrid();
// create two datagrid columns
$id = new TDataGridColumn('id', 'ID', 'right', 70);
$display = new TDataGridColumn('display_field', 'Field', 'left', 220);
// add the columns to the datagrid
$this->datagrid->addColumn($id);
$this->datagrid->addColumn($display);
// create a datagrid action
$action1 = new TDataGridAction(array($this, 'onSelect'));
$action1->setLabel('Selecionar');
$action1->setImage('ico_apply.png');
$action1->setField('id');
// add the actions to the datagrid
$this->datagrid->addAction($action1);
// create the datagrid model
$this->datagrid->createModel();
// creates the paginator
$this->pageNavigation = new TPageNavigation();
$this->pageNavigation->setAction(new TAction(array($this, 'onReload')));
$this->pageNavigation->setWidth($this->datagrid->getWidth());
// creates the container
$vbox = new TVBox();
$vbox->add($this->form);
$vbox->add($this->datagrid);
$vbox->add($this->pageNavigation);
// add the container to the page
parent::add($vbox);
}
示例3: __construct
/**
* Class constructor
* Creates the page, the form and the listing
*/
public function __construct()
{
parent::__construct();
Usuario::checkLogin();
parent::setDatabase('sample');
// defines the database
parent::setActiveRecord('Pedidos');
// defines the active record
parent::setDefaultOrder('id', 'asc');
// defines the default order
parent::setFilterField('id');
// defines the filter field
// creates the form, with a table inside
$this->form = new TForm('form_search_Pedidos');
$table = new TTable();
$this->form->add($table);
// create the form fields
$filter = new TEntry('id');
$filter->setValue(TSession::getValue('Pedidos_id'));
// add a row for the filter field
$table->addRowSet(new TLabel('id:'), $filter);
// create two action buttons to the form
$find_button = new TButton('find');
$find_button->setAction(new TAction(array($this, 'onSearch')), _t('Find'));
$find_button->setImage('ico_find.png');
// add a row for the form actions
$table->addRowSet($find_button);
// define wich are the form fields
$this->form->setFields(array($filter, $find_button));
// creates a DataGrid
$this->datagrid = new TQuickGrid();
$this->datagrid->setHeight(320);
// creates the datagrid columns
$id = $this->datagrid->addQuickColumn('id', 'id', 'right', 100);
$dataP = $this->datagrid->addQuickColumn('dataP', 'dataP', 'left', 100);
$clientes_id = $this->datagrid->addQuickColumn('cliente', 'clientes->nome', 'right', 100);
$status = $this->datagrid->addQuickColumn('status', 'status', 'right', 100);
// create the datagrid actions
$itens_action = new TDataGridAction(array($this, 'showItens'));
// add the actions to the datagrid
$this->datagrid->addQuickAction("Produtos", $itens_action, 'id', 'ico_find.png');
// create the datagrid model
$this->datagrid->createModel();
// create the page navigation
$this->pageNavigation = new TPageNavigation();
$this->pageNavigation->setAction(new TAction(array($this, 'onReload')));
$this->pageNavigation->setWidth($this->datagrid->getWidth());
// create the page container
$container = new TVBox();
$container->add($this->form);
$container->add($this->datagrid);
$container->add($this->pageNavigation);
parent::add($container);
}
示例4: onInputDialog
/**
* Open an input dialog
*/
public function onInputDialog($param)
{
$name = new TEntry('name');
$amount = new TEntry('amount');
$name->setValue($param['key']);
$form = new TForm('input_form');
$form->style = 'padding:20px';
$table = new TTable();
$table->addRowSet(new TLabel('Name: '), $name);
$table->addRowSet($lbl = new TLabel('Amount: '), $amount);
$lbl->setFontColor('red');
$form->setFields(array($name, $amount));
$form->add($table);
// show the input dialog
new TInputDialog('Input dialog', $form, new TAction(array($this, 'onConfirm')), 'Confirm');
}
示例5: makeTEntry
/**
*
*/
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;
}
示例6: updateItem
/**
* Metodo para alterar a quantidade do item
*/
public function updateItem($param)
{
// pega o item a ser alterado
$produtos = $this->cart->getIten($param['key']);
try {
TTransaction::open('sample');
$produto_old = new Produtos($param['key']);
// pega o item antigo ara podermos usar a imagem do banco
/**
* nessa parte usamos os get da class PProduto para
mostrar os dados, lembrando que todo produto inserido no carinho
é do tipo PProduto da PWD */
$row = $this->table->addRow();
$row->addCell(new PLabel($produtos->getNome(), 'primary'))->colspan = 2;
$row = $this->table->addRow();
$row->addCell(new TImage('uploads/' . $produto_old->imagem));
$row->addCell($produtos->getDescricao());
$row = $this->table->addRow();
$row->addCell(new PLabel('R$ ' . $produtos->getPreco(), 'success'));
$row = $this->table->addRow();
$row->addCell('Qtd');
$qtd = new TEntry('qtd');
$qtd->setValue($produtos->getQtd());
$row->addCell($qtd);
$row = $this->table->addRow();
$btn = new PButton('add', 'success');
$btn->setLabel('Update');
$action = new TAction(array($this, 'addItem'));
$action->setParameter('id', $param['key']);
$action->setParameters(array('id' => $param['key'], 'qtd' => $qtd->getValue()));
$btn->setAction($action, 'add+');
$row->addCell($btn);
$this->form->setFields(array($btn, $qtd));
// inserimos os campos no form
TTransaction::close();
} catch (Exception $e) {
new TMessage('info', $e->getMessage());
}
}
示例7: TCalendar
/**
* Class constructor
* Creates the page
*/
function __construct()
{
parent::__construct();
// create the calendar
$this->calendar = new TCalendar();
// Gett actual data
$this->calendar->setMonth(date('m'));
$this->calendar->setYear(date('Y'));
$this->calendar->selectDays(date("j"));
$this->calendar->setSize(750, 500);
$this->calendar->setAction(new TAction(array($this, 'onSelect')));
// creates a simple form
$this->form = new TQuickForm('calendar_helper');
// creates the notebook around the form
$notebook = new TNotebook(300, 180);
$notebook->appendPage('Calendar Helper', $this->form);
// creates the form fields
$year = new TEntry('year');
$month = new TEntry('month');
$day = new TEntry('day');
$year->setValue($this->calendar->getYear());
$month->setValue($this->calendar->getMonth());
$day->setValue($this->calendar->getSelectedDays());
$this->form->addQuickField('Year', $year, 100);
$this->form->addQuickField('Month', $month, 100);
//$this->form->addQuickField('Day', $day, 100);
// creates a table to wrap the treeview and the form
$table = new TTable();
$this->form->addQuickAction('Back', new TAction(array($this, 'onBack')), 'ico_back.png');
$this->form->addQuickAction('Next', new TAction(array($this, 'onNext')), 'ico_next.png');
$row = $table->addRow();
$cell = $row->addCell($this->calendar)->valign = 'top';
$cell = $row->addCell($notebook)->valign = 'top';
// wrap the page content using vertical box
$vbox = new TVBox();
$vbox->add(new TXMLBreadCrumb('menu.xml', __CLASS__));
$vbox->add($table);
parent::add($vbox);
}
示例8: __construct
/**
* Class constructor
* Creates the page, the search form and the listing
*/
public function __construct()
{
parent::__construct();
parent::setSize(600, 400);
parent::setTitle('Search record');
new TSession();
// creates the form
$this->form = new TQuickForm('form_search_city');
// create the form fields
$name = new TEntry('name');
$name->setValue(TSession::getValue('city_name'));
// add the form fields
$this->form->addQuickField('name', $name, 200);
// define the form action
$this->form->addQuickAction('Find', new TAction(array($this, 'onSearch')), 'ico_find.png');
// creates a DataGrid
$this->datagrid = new TQuickGrid();
$this->datagrid->setHeight(230);
// creates the datagrid columns
$this->datagrid->addQuickColumn('Id', 'id', 'right', 40);
$this->datagrid->addQuickColumn('Name', 'name', 'left', 340);
// creates two datagrid actions
$this->datagrid->addQuickAction('Select', new TDataGridAction(array($this, 'onSelect')), 'id', 'ico_apply.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());
// creates the page structure using a table
$table = new TTable();
$table->addRow()->addCell($this->form);
$table->addRow()->addCell($this->datagrid);
$table->addRow()->addCell($this->pageNavigation);
// add the table inside the page
parent::add($table);
}
示例9: __construct
public function __construct()
{
parent::__construct();
$this->form = new TForm('form_search_PlantaValores');
$this->form->class = 'tform';
$table = new TTable();
$table->style = 'width:100%';
$table->addRowSet(new TLabel('Planta de Valores'), '')->class = 'tformtitle';
$this->form->add($table);
$plantavalores_id = new TEntry('plantavalores_id');
$plantavalores_id->setValue(TSession::getValue('plantavalores_id'));
$anobase = new TEntry('anobase');
$anobase->setValue(TSession::getValue('anobase'));
$row = $table->addRowSet(new TLabel('ID: '), $plantavalores_id);
$row = $table->addRowSet(new TLabel('Ano Base: '), $anobase);
$find_button = new TButton('find');
$new_button = new TButton('new');
// define the button actions
$find_button->setAction(new TAction(array($this, 'onSearch')), _t('Find'));
$find_button->setImage('ico_find.png');
$new_button->setAction(new TAction(array('PlantaValoresForm', 'onEdit')), _t('New'));
$new_button->setImage('ico_new.png');
$this->form->setFields(array($plantavalores_id, $anobase, $find_button, $new_button));
$container = new THBox();
$container->add($find_button);
$container->add($new_button);
$row = $table->addRow();
$row->class = 'tformaction';
$cell = $row->addCell($container);
$cell->colspan = 2;
$this->datagrid = new TDataGrid();
$this->datagrid->style = 'width: 100%';
$this->datagrid->setHeight(320);
$plantavalores_id = new TDataGridColumn('plantavalores_id', 'ID', 'right');
$anobase = new TDataGridColumn('anobase', 'Ano Base', 'left');
$this->datagrid->addColumn($plantavalores_id);
$this->datagrid->addColumn($anobase);
$order_id = new TAction(array($this, 'onReload'));
$order_id->setParameter('order', 'plantavalores_id');
$plantavalores_id->setAction($order_id);
$order_data = new TAction(array($this, 'onReload'));
$order_data->setParameter('order', 'anobase');
$anobase->setAction($order_data);
$action1 = new TDataGridAction(array('PlantaValoresForm', 'onEdit'));
$action1->setLabel(_t('Edit'));
$action1->setImage('ico_edit.png');
$action1->setField('anobase_id');
$action2 = new TDataGridAction(array($this, 'onDelete'));
$action2->setLabel(_t('Delete'));
$action2->setImage('ico_delete.png');
$action2->setField('plantavalores_id');
$this->datagrid->addAction($action1);
$this->datagrid->addAction($action2);
$this->datagrid->createModel();
$this->pageNavigation = new TPageNavigation();
$this->pageNavigation->setAction(new TAction(array($this, 'onReload')));
$this->pageNavigation->setWidth($this->datagrid->getWidth());
$table = new TTable();
$table->style = 'width: 80%';
$table->addRow()->addCell(new TXMLBreadCrumb('menu.xml', __CLASS__));
$table->addRow()->addCell($this->form);
$table->addRow()->addCell($this->datagrid);
$table->addRow()->addCell($this->pageNavigation);
parent::add($table);
}
示例10: TNotebook
/**
* Class constructor
* Creates the page
*/
function __construct()
{
parent::__construct();
// create the notebook
$notebook = new TNotebook(620, 410);
// create the form
$this->form = new TForm();
// creates the notebook page
$table = new TTable();
// add the notebook inside the form
$this->form->add($table);
// adds the notebook page
$notebook->appendPage('Input elements', $this->form);
// 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 TPassword('field6');
$field7 = new TDate('field7');
$field8 = new TSpinner('field8');
$field9 = new TSlider('field9');
$field10 = new TText('field10');
$field1->setTip('Tip for field 1');
$field2->setTip('Tip for field 2');
$field3->setTip('Tip for field 3');
$field4->setTip('Tip for field 4');
$field5->setTip('Tip for field 5');
$field6->setTip('Tip for field 6');
$field7->setTip('Tip for field 7');
$field8->setTip('Tip for field 8');
$field9->setTip('Tip for field 9');
$field10->setTip('Tip for field 10');
$field2->setValue('123');
$field2->setEditable(FALSE);
$field3->setMask('99.999-999');
$field4->setMaxLength(10);
$field5->setCompletion(array('Allen', 'Albert', 'Alberto', 'Alladin'));
$field7->setSize(100);
$field8->setRange(0, 100, 10);
$field9->setRange(0, 100, 10);
$field8->setValue(30);
$field9->setValue(50);
$field10->setSize(300, 80);
// add a row for one field
$row = $table->addRow();
$row->addCell(new TLabel('TEntry object:'));
$cell = $row->addCell($field1);
// add a row for one field
$row = $table->addRow();
$row->addCell(new TLabel('TEntry not editable:'));
$cell = $row->addCell($field2);
// add a row for one field
$row = $table->addRow();
$row->addCell(new TLabel('TEntry with mask:'));
$cell = $row->addCell($field3);
$cell = $row->addCell(new TLabel('99.999-999'));
// add a row for one field
$row = $table->addRow();
$row->addCell(new TLabel('TEntry with maxlength (10):'));
$cell = $row->addCell($field4);
// add a row for one field
$row = $table->addRow();
$row->addCell(new TLabel('TEntry with completion (a..):'));
$cell = $row->addCell($field5);
// add a row for one field
$row = $table->addRow();
$row->addCell(new TLabel('TPassword object:'));
$cell = $row->addCell($field6);
// add a row for one field
$row = $table->addRow();
$row->addCell(new TLabel('TDate Object:'));
$cell = $row->addCell($field7);
// add a row for one field
$row = $table->addRow();
$row->addCell(new TLabel('Spinner Object:'));
$cell = $row->addCell($field8);
// add a row for one field
$row = $table->addRow();
$row->addCell(new TLabel('Slider Object:'));
$cell = $row->addCell($field9);
// add a row for one field
$row = $table->addRow();
$row->addCell(new TLabel('TText Object:'));
$cell = $row->addCell($field10);
// creates the action button
$button1 = new TButton('action1');
// define the button action
$button1->setAction(new TAction(array($this, 'onSave')), 'Save');
$button1->setImage('ico_save.png');
// define wich are the form fields
$this->form->setFields(array($field1, $field2, $field3, $field4, $field5, $field6, $field7, $field8, $field9, $field10, $button1));
// add a row for the button
$row = $table->addRow();
$row->addCell($button1);
//.........这里部分代码省略.........
示例11: __construct
public function __construct()
{
parent::__construct();
$this->form = new TForm('form_search_Contribuinte');
$this->form->class = 'tform';
$table = new TTable();
$table->style = 'width:100%';
$table->addRowSet(new TLabel('Contribuinte'), '')->class = 'tformtitle';
$this->form->add($table);
$contribuinte_id = new TEntry('contribuinte_id');
$contribuinte_id->setValue(TSession::getValue('contribuinte_id'));
$contribuinte_nome = new TEntry('contribuinte_nome');
$contribuinte_nome->setValue(TSession::getValue('contribuinte_nome'));
$row = $table->addRowSet(new TLabel('ID: '), $contribuinte_id);
$row = $table->addRowSet(new TLabel('Nome/Razão Social: '), $contribuinte_nome);
$find_button = new TButton('find');
$new_button = new TButton('new');
$find_button->setAction(new TAction(array($this, 'onSearch')), _t('Find'));
$find_button->setImage('ico_find.png');
$new_button->setAction(new TAction(array('ContribuinteForm', 'onEdit')), _t('New'));
$new_button->setImage('ico_new.png');
$this->form->setFields(array($contribuinte_id, $contribuinte_nome, $find_button, $new_button));
$container = new THBox();
$container->add($find_button);
$container->add($new_button);
$row = $table->addRow();
$row->class = 'tformaction';
$cell = $row->addCell($container);
$cell->colspan = 2;
// creates a DataGrid
$this->datagrid = new TDataGrid();
$this->datagrid->style = 'width: 100%';
$this->datagrid->setHeight(320);
$contribuinte_id = new TDataGridColumn('contribuinte_id', 'ID', 'right');
$contribuinte_nome = new TDataGridColumn('contribuinte_nome', 'Nome/Razão Social', 'left');
$contribuinte_tipo = new TDataGridColumn('contribuinte_tipo', 'Tipo', 'left');
$contribuinte_tipo = new TDataGridColumn('contribuinte_tipos', 'Tipo', 'left');
$this->datagrid->addColumn($contribuinte_id);
$this->datagrid->addColumn($contribuinte_nome);
$this->datagrid->addColumn($contribuinte_tipo);
$order_id = new TAction(array($this, 'onReload'));
$order_id->setParameter('order', 'contribuinte_id');
$contribuinte_id->setAction($order_id);
$order_name = new TAction(array($this, 'onReload'));
$order_name->setParameter('order', 'contribuinte_nome');
$contribuinte_nome->setAction($order_name);
$name_edit = new TDataGridAction(array($this, 'onInlineEdit'));
$name_edit->setField('contribuinte_id');
$contribuinte_nome->setEditAction($name_edit);
// creates two datagrid actions
$action1 = new TDataGridAction(array('ContribuinteForm', 'onEdit'));
$action1->setLabel(_t('Edit'));
$action1->setImage('ico_edit.png');
$action1->setField('contribuinte_id');
$action2 = new TDataGridAction(array($this, 'onDelete'));
$action2->setLabel(_t('Delete'));
$action2->setImage('ico_delete.png');
$action2->setField('contribuinte_id');
$this->datagrid->addAction($action1);
$this->datagrid->addAction($action2);
$this->datagrid->createModel();
$this->pageNavigation = new TPageNavigation();
$this->pageNavigation->setAction(new TAction(array($this, 'onReload')));
$this->pageNavigation->setWidth($this->datagrid->getWidth());
$table = new TTable();
$table->style = 'width: 80%';
$table->addRow()->addCell(new TXMLBreadCrumb('menu.xml', __CLASS__));
$table->addRow()->addCell($this->form);
$table->addRow()->addCell($this->datagrid);
$table->addRow()->addCell($this->pageNavigation);
// add the table inside the page
parent::add($table);
}
示例12: TForm
/**
* Class constructor
* Creates the page and the registration form
*/
function __construct()
{
parent::__construct();
// creates the form
$this->form = new TForm('form_crm');
// creates a table
$table = new TTable();
$notebook = new TNotebook(500, 320);
// add the notebook inside the form
$this->form->add($notebook);
$notebook->appendPage('Cadastro Registro CRM', $table);
// create the form fields
$code = new TEntry('id');
$crm_id = new TCombo('crm_id');
$tiporegistro_id = new TDBCombo('tiporegistro_id', 'db_crmbf', 'RegistroTipo', 'id', 'nome');
$registro = new TText('registro');
$temporegistro = new TEntry('tempo_registro');
// $temporegistro->setEditable(false);
$dataregistro = new TDate('data_registro');
$hora_registro = new TEntry('hora_registro');
$numero_registro = new TEntry('numero_registro');
// finaliza a transacao
TTransaction::close();
$items1 = array();
//dados do cliente CRM
TTransaction::open('db_crmbf');
$criteria = new TCriteria();
$criteria->add(new TFilter('cliente_id', '=', $_GET['fk']));
$repository = new TRepository('CRM');
$cadastros = $repository->load($criteria);
//adiciona os objetos no combo
foreach ($cadastros as $object) {
$items1[$object->id] = $object->titulo;
}
// adiciona as opcoes na combo
$crm_id->addItems($items1);
TTransaction::close();
// add field validators
$registro->addValidation('Registro deve ser informado', new TRequiredValidator());
// define some properties for the form fields
$code->setEditable(FALSE);
$code->setSize(100);
$crm_id->setSize(320);
// $crm_id->setEditable(FALSE);
$registro->setSize(320);
$temporegistro->setSize(160);
$temporegistro->setValue(date("d/m/Y H:i:s"));
$tiporegistro_id->setSize(160);
$dataregistro->setSize(90);
$hora_registro->setSize(150);
$hora_registro->setTip('Horario EX: 8:14');
$numero_registro->setSize(320);
$row = $table->addRow();
$row->addCell(new TLabel('Code:'));
$row->addCell($code);
// add a row for the field name
$row = $table->addRow();
$row->addCell(new TLabel('CRM Titulo:'));
$cell = $row->addCell($crm_id);
// add a row for the field Telefone
$row = $table->addRow();
$row->addCell(new TLabel('Tipo Registro:'));
$cell = $row->addCell($tiporegistro_id);
// add a row for the field Email
$row = $table->addRow();
$row->addCell(new TLabel('Tempo:'));
$cell = $row->addCell($temporegistro);
// add a row for the field celular
$row = $table->addRow();
$row->addCell(new TLabel('Data:'));
$cell = $row->addCell($dataregistro);
// add a row for the field skype
$row = $table->addRow();
$row->addCell(new TLabel('Hora:'));
$cell = $row->addCell($hora_registro);
// add a row for the field endereco
$row = $table->addRow();
$row->addCell(new TLabel('Numero Registro:'));
$row->addCell($numero_registro);
// add a row for the field name
$row = $table->addRow();
$row->addCell(new TLabel('Registro:'));
$cell = $row->addCell($registro);
// create an action button
$button1 = new TButton('action1');
$button1->setAction(new TAction(array($this, 'onSave')), 'Save');
$button1->setImage('ico_save.png');
// create an action button
$button2 = new TButton('action3');
$action2 = new TAction(array('ClienteRegistroDetalhe', 'onEdit'));
//parametro fk e key da sessao
$action2->setParameter('fk', TSession::getValue('cliente_fk'));
$action2->setParameter('key', TSession::getValue('crm_key'));
$button2->setImage('ico_datagrid.png');
$button2->setAction($action2, 'Voltar');
// define wich are the form fields
//.........这里部分代码省略.........
示例13: TNotebook
/**
* Class constructor
* Creates the page
*/
function __construct()
{
parent::__construct();
// create the notebook
$notebook = new TNotebook(620, 340);
// create the form
$this->form = new TForm();
// creates the notebook page
$table = new TTable();
// add the notebook inside the form
$this->form->add($table);
// adds the notebook page
$notebook->appendPage('Input elements', $this->form);
// create the form fields
$field1 = new TEntry('field1');
$field2 = new TEntry('field2');
$field3 = new TEntry('field3');
$field4 = new TEntry('field4');
$field5 = new TPassword('field5');
$field6 = new TDate('field6');
$field7 = new TSpinner('field7');
$field8 = new TSlider('field8');
$field9 = new TText('field9');
$field1->setTip('Tip for field 1');
$field2->setTip('Tip for field 2');
$field3->setTip('Tip for field 3');
$field4->setTip('Tip for field 4');
$field5->setTip('Tip for field 5');
$field6->setTip('Tip for field 6');
$field7->setTip('Tip for field 7');
$field8->setTip('Tip for field 8');
$field9->setTip('Tip for field 9');
$field2->setValue('123');
$field2->setEditable(FALSE);
$field3->setMask('99.999-999');
$field4->setMaxLength(10);
$field6->setSize(100);
$field7->setRange(0, 100, 10);
$field8->setRange(0, 100, 10);
$field7->setValue(30);
$field8->setValue(50);
$field9->setSize(300, 50);
// add rows for the fields
$table->addRowSet(new TLabel('TEntry object:'), $field1);
$table->addRowSet(new TLabel('TEntry not editable:'), $field2);
$table->addRowSet(new TLabel('TEntry with mask:'), $field3, new TLabel('99.999-999'));
$table->addRowSet(new TLabel('TEntry with maxlength (10):'), $field4);
$table->addRowSet(new TLabel('TPassword object:'), $field5);
$table->addRowSet(new TLabel('TDate Object:'), $field6);
$table->addRowSet(new TLabel('Spinner Object:'), $field7);
$table->addRowSet(new TLabel('Slider Object:'), $field8);
$table->addRowSet(new TLabel('TText Object:'), $field9);
// creates the action button
$button1 = new TButton('action1');
// define the button action
$button1->setAction(new TAction(array($this, 'onSave')), 'Save');
$button1->setImage('ico_save.png');
// define wich are the form fields
$this->form->setFields(array($field1, $field2, $field3, $field4, $field5, $field6, $field7, $field8, $field9, $button1));
// add a row for the button
$row = $table->addRow();
$row->addCell($button1);
// wrap the page content using vertical box
$vbox = new TVBox();
$vbox->add(new TXMLBreadCrumb('menu.xml', __CLASS__));
$vbox->add($notebook);
parent::add($vbox);
}
示例14: __construct
/**
* constructor method
*/
public function __construct()
{
parent::__construct();
parent::setTitle('Busca de Pessoas');
parent::setSize(800, 600);
new TSession();
// creates the form
$this->form = new TForm('form_city_Pessoa');
// creates the table
$table = new TTable();
// add the table inside the form
$this->form->add($table);
// create the form fields
$name = new TEntry('pessoa_nome');
// keep the session value
$name->setValue(TSession::getValue('test_pessoa_name'));
// add the field inside the table
$row = $table->addRow();
$row->addCell(new TLabel('Nome:'));
$row->addCell($name);
// create a find button
$find_button = new TButton('search');
// define the button action
$find_button->setAction(new TAction(array($this, 'onSearch')), 'Search');
$find_button->setImage('ico_find.png');
// add a row for the find button
$row = $table->addRow();
$row->addCell($find_button);
// define wich are the form fields
$this->form->setFields(array($name, $find_button));
// create the datagrid
$this->datagrid = new TDataGrid();
// create the datagrid columns
$id = new TDataGridColumn('pessoa_codigo', 'Id', 'right', 25);
$name = new TDataGridColumn('pessoa_nome', 'Nome', 'left', 250);
$origem = new TDataGridColumn('origem_nome', 'Origem', 'left', 330);
$order1 = new TAction(array($this, 'onReload'));
$order2 = new TAction(array($this, 'onReload'));
$order1->setParameter('order', 'pessoa_codigo');
$order2->setParameter('order', 'pessoa_nome');
// define the column actions
$id->setAction($order1);
$name->setAction($order2);
// add the columns inside the datagrid
$this->datagrid->addColumn($id);
$this->datagrid->addColumn($name);
$this->datagrid->addColumn($origem);
// create one datagrid action
$action1 = new TDataGridAction(array($this, 'onSelect'));
$action1->setLabel('Selecionar');
$action1->setImage('fa:check-circle-o green');
$action1->setField('pessoa_codigo');
// add the action to the datagrid
$this->datagrid->addAction($action1);
// create the datagrid model
$this->datagrid->createModel();
// create the page navigator
$this->pageNavigation = new TPageNavigation();
$this->pageNavigation->setAction(new TAction(array($this, 'onReload')));
$this->pageNavigation->setWidth($this->datagrid->getWidth());
// create a table for layout
$table = new TTable();
// create a row for the form
$row = $table->addRow();
$row->addCell($this->form);
// create a row for the datagrid
$row = $table->addRow();
$row->addCell($this->datagrid);
// create a row for the page navigator
$row = $table->addRow();
$row->addCell($this->pageNavigation);
$table->style = 'width: 100%;max-width: 1200px;';
$this->datagrid->style = ' width: 100%; max-width: 1200px;';
// add the table inside the page
parent::add($table);
}
示例15: StringsUtil
/**
* 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);
//.........这里部分代码省略.........