本文整理汇总了PHP中TPage::__construct方法的典型用法代码示例。如果您正苦于以下问题:PHP TPage::__construct方法的具体用法?PHP TPage::__construct怎么用?PHP TPage::__construct使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TPage
的用法示例。
在下文中一共展示了TPage::__construct方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: TTable
/**
* Class constructor
* Creates the page and the registration form
*/
function __construct()
{
parent::__construct();
$table = new TTable();
$table->width = '100%';
// creates the form
$this->form = new TForm('form_login');
$this->form->class = 'tform';
$this->form->style = 'margin:auto;width: 350px';
// add the notebook inside the form
$this->form->add($table);
// create the form fields
$login = new TEntry('login');
$password = new TPassword('password');
// define the sizes
$login->setSize(150, 40);
$password->setSize(150, 40);
// create an action button (save)
$save_button = new TButton('save');
$save_button->setAction(new TAction(array($this, 'onLogin')), _t('Login'));
$save_button->setImage('ico_apply.png');
// add a row for the field login
$row = $table->addRow();
$cell = $row->addCell(new TLabel('Login'));
$cell->colspan = 2;
$row->class = 'tformtitle';
$table->addRowSet(new TLabel(_t('User') . ': '), $login);
$table->addRowSet(new TLabel(_t('Password') . ': '), $password);
$row = $table->addRowSet($save_button, '');
$row->class = 'tformaction';
$this->form->setFields(array($login, $password, $save_button));
// add the form to the page
parent::add($this->form);
}
示例2: __construct
public function __construct()
{
parent::__construct();
// creates one datagrid
$this->datagrid = new TDataGrid();
// make scrollable and define height
$this->datagrid->setHeight(300);
$this->datagrid->makeScrollable();
// create the datagrid columns
$code = new TDataGridColumn('code', 'Code', 'right', 70);
$name = new TDataGridColumn('name', 'Name', 'left', 180);
$address = new TDataGridColumn('address', 'Address', 'left', 180);
$telephone = new TDataGridColumn('fone', 'Phone', 'left', 160);
// add the columns to the datagrid
$this->datagrid->addColumn($code);
$this->datagrid->addColumn($name);
$this->datagrid->addColumn($address);
$this->datagrid->addColumn($telephone);
// creates the datagrid model
$this->datagrid->createModel();
// wrap the page content using vertical box
$vbox = new TVBox();
$vbox->add(new TXMLBreadCrumb('menu.xml', __CLASS__));
$vbox->add($this->datagrid);
parent::add($vbox);
}
示例3: BootstrapFormWrapper
/**
* Class constructor
* Creates the page
*/
function __construct()
{
parent::__construct();
// create the form using TQuickForm class
$this->form = new BootstrapFormWrapper(new TQuickForm());
$this->form->setFormTitle('cadastroTarefas');
// create the form fields
$id = new TEntry('id');
$id->setEditable(FALSE);
$description = new TEntry('titulo');
$list = new TCombo('prioridade');
$text = new TText('descricao');
$combo_items = array();
$combo_items['1'] = 'Baixa';
$combo_items['2'] = 'Media';
$combo_items['3'] = 'Alta';
$list->addItems($combo_items);
// add the fields inside the form
$this->form->addQuickField('Id', $id, 40);
$this->form->addQuickField('Título', $description, 250);
$this->form->addQuickField('Descrição', $text, 120);
$this->form->addQuickField('Prioridade', $list, 120);
$text->setSize(250, 50);
// define the form action
$btn = $this->form->addQuickAction('Save', new TAction(array($this, 'onSave')), 'fa:save');
$btn->class = 'btn btn-success';
$panel = new TPanelGroup('Cadastro de taredas');
$panel->add($this->form);
// wrap the page content using vertical box
$vbox = new TVBox();
$vbox->add($panel);
parent::add($vbox);
}
示例4: __construct
public function __construct()
{
parent::__construct();
try {
TTransaction::open('samples');
// open transaction
// create a new object
$giovani = new Customer();
$giovani->name = 'Giovanni Dall Oglio';
$giovani->address = 'Rua da Conceicao';
$giovani->phone = '(51) 8111-2222';
$giovani->birthdate = '2013-02-15';
$giovani->status = 'S';
$giovani->email = 'giovanni@dalloglio.net';
$giovani->gender = 'M';
$giovani->category_id = '1';
$giovani->city_id = '1';
$giovani->store();
// store the object
new TMessage('info', 'Objeto stored successfully');
TTransaction::close();
// Closes the transaction
} catch (Exception $e) {
new TMessage('error', $e->getMessage());
}
}
示例5: TQuickForm
function __construct()
{
parent::__construct();
// create the form using TQuickForm class
$this->form = new TQuickForm();
$this->form->class = 'tform';
$this->form->setFormTitle('Formas de Pagamentos');
$combo = new TCombo('pagamento');
$combo_items = array();
$combo_items['a'] = 'Cartão de Crédito Visa';
$combo_items['b'] = 'Cartão de Crédito Mastercard';
$combo_items['c'] = 'Ticket Vale Refeição';
$combo_items['d'] = 'PagSeguro';
$combo_items['e'] = 'PayPal';
$combo_items['f'] = 'DriverCoins';
$combo->addItems($combo_items);
$this->form->addQuickField('Forma de Pagamentos', $combo, 500);
$this->form->addQuickAction('Salvar', new TAction(array($this, 'onSave')), 'ico_save.png');
// wrap the page content using vertical box
$vbox = new TVBox();
$vbox->style = 'width: 100%';
$vbox->add(new TXMLBreadCrumb('menu.xml', __CLASS__));
$vbox->add($this->form);
parent::add($vbox);
}
示例6: __construct
public function __construct()
{
parent::__construct();
// show the message dialog
new TMessage('error', 'Error message');
parent::add(new TXMLBreadCrumb('menu.xml', __CLASS__));
}
示例7: __construct
public function __construct()
{
parent::__construct();
try {
// connection info
$db = array();
$db['host'] = '';
$db['port'] = '';
$db['name'] = 'app/database/samples.db';
$db['user'] = '';
$db['pass'] = '';
$db['type'] = 'sqlite';
TTransaction::open(NULL, $db);
// open transaction
$conn = TTransaction::get();
// get PDO connection
// make query
$result = $conn->query('SELECT id, name from customer order by id');
// iterate results
foreach ($result as $row) {
print $row['id'] . '-';
print $row['name'] . "<br>\n";
}
TTransaction::close();
// close transaction
} catch (Exception $e) {
new TMessage('error', $e->getMessage());
}
}
示例8: __construct
/**
* Form constructor
* @param $param Request
*/
public function __construct($param)
{
parent::__construct();
// creates the form
$this->form = new TQuickForm('form_Sistema');
$this->form->class = 'tform';
// change CSS class
$this->form->style = 'display: table;width:100%';
// change style
// define the form title
$this->form->setFormTitle('Sistema');
// create the form fields
$id = new TSeekButton('id');
$nome = new TText('nome');
// add the fields
$this->form->addQuickField('Id', $id, 100);
$this->form->addQuickField('Nome', $nome, 200);
if (!empty($id)) {
$id->setEditable(FALSE);
}
/** samples
$this->form->addQuickFields('Date', array($date1, new TLabel('to'), $date2)); // side by side fields
$fieldX->addValidation( 'Field X', new TRequiredValidator ); // add validation
$fieldX->setSize( 100, 40 ); // set size
**/
// create the form actions
$this->form->addQuickAction(_t('Save'), new TAction(array($this, 'onSave')), 'fa:floppy-o');
$this->form->addQuickAction(_t('New'), new TAction(array($this, 'onClear')), 'bs:plus-sign green');
// vertical box container
$container = new TVBox();
$container->style = 'width: 90%';
// $container->add(new TXMLBreadCrumb('menu.xml', __CLASS__));
$container->add($this->form);
parent::add($container);
}
示例9: TQuickForm
/**
* Class constructor
* Creates the page
*/
function __construct()
{
parent::__construct();
// create the form using TQuickForm class
$this->form = new TQuickForm('form_seek_sample');
$this->form->setFormTitle('Seek button');
$this->form->class = 'tform';
// create the form fields
$city_id1 = new TSeekButton('city_id1');
$city_name1 = new TEntry('city_name1');
$criteria = new TCriteria();
$criteria->add(new TFilter('id', '>', 1));
$criteria->add(new TFilter('id', '<', 5));
$criteria->setProperty('order', 'name');
// define the action for city_id1
$obj = new TestCitySeek();
$action = new TAction(array($obj, 'onReload'));
$city_id1->setAction($action);
$city_id1->setSize(100);
$city_name1->setEditable(FALSE);
$this->form->addQuickFields('Manual SeekButton', array($city_id1, $city_name1));
$this->form->addQuickAction('Save', new TAction(array($this, 'onSave')), 'fa:floppy-o');
// wrap the page content using vertical box
$vbox = new TVBox();
$vbox->add($this->form);
parent::add($vbox);
}
示例10: TQuickForm
/**
* Class constructor
* Cria da página e o formulário de registro
*/
function __construct()
{
parent::__construct();
// cria o formulário
$this->form = new TQuickForm('form_Funcionalidade');
$this->form->setFormTitle('Cadastro de Funcionalidades');
$this->form->class = 'tform';
// CSS class
// Cria os campos do formulário
$id = new TEntry('id');
$nome = new TEntry('nome');
$classe = new TEntry('classe');
$id->setEditable(false);
// Adiciona os campos ao formulário
$this->form->addQuickField('Código:', $id, 50);
$this->form->addQuickField('Nome: ', $nome, 500);
$this->form->addQuickField('Classe de controle: ', $classe, 500);
// Validadores
$nome->addValidation('Nome', new TRequiredValidator());
$classe->addValidation('Classe de controle', new TRequiredValidator());
// Adiciona as ações do formulário
$this->form->addQuickAction('Salvar', new TAction(array($this, 'onSave')), 'ico_save.png');
$this->form->addQuickAction('Novo', new TAction(array($this, 'onEdit')), 'ico_new.png');
$this->form->addQuickAction('Voltar para a listagem', new TAction(array('FuncionalidadeList', 'onReload')), 'ico_datagrid.png');
$container = new TTable();
$container->style = 'width: 80%';
$container->addRow()->addCell(new TXMLBreadCrumb('menu.xml', 'FuncionalidadeList'));
$container->addRow()->addCell($this->form);
// Adiciona o formulário a pagina
parent::add($container);
}
示例11: __construct
public function __construct()
{
parent::__construct();
// creates one datagrid
$this->datagrid = new TDataGrid();
// create the datagrid columns
$code = new TDataGridColumn('code', 'Code', 'right', 70);
$name = new TDataGridColumn('name', 'Name', 'left', 180);
$address = new TDataGridColumn('address', 'Address', 'left', 180);
$telephone = new TDataGridColumn('fone', 'Phone', 'left', 160);
// add the columns to the datagrid
$this->datagrid->addColumn($code);
$this->datagrid->addColumn($name);
$this->datagrid->addColumn($address);
$this->datagrid->addColumn($telephone);
// creates two datagrid actions
$action1 = new TDataGridAction(array($this, 'onView'));
$action1->setLabel('View');
$action1->setImage('ico_find.png');
$action1->setField('name');
$action1->setDisplayCondition(array($this, 'displayColumn'));
// add the actions to the datagrid
$this->datagrid->addAction($action1);
// creates the datagrid model
$this->datagrid->createModel();
// wrap the page content using vertical box
$vbox = new TVBox();
$vbox->add(new TXMLBreadCrumb('menu.xml', __CLASS__));
$vbox->add($this->datagrid);
parent::add($vbox);
}
示例12: __construct
/**
* Constructor method
*/
public function __construct()
{
parent::__construct();
// load the styles
TPage::include_css('app/resources/styles.css');
// define two actions
$action1 = new TAction(array($this, 'onAction1'));
$action2 = new TAction(array($this, 'onAction2'));
// create a quick form with two action buttons
$form = new TQuickForm();
$form->addQuickAction('Action 1', $action1, 'ico_view.png');
$form->addQuickAction('Action 2', $action2, 'ico_view.png');
try {
// create the HTML Renderer
$this->html = new THtmlRenderer('app/resources/content.html');
// define replacements for the main section
$replace = array();
$replace['name'] = 'Test name';
$replace['address'] = 'Test address';
// replace the main section variables
$this->html->enableSection('main', $replace);
// Table wrapper (form and HTML)
$table = new TTable();
$table->addRow()->addCell(new TXMLBreadCrumb('menu.xml', __CLASS__));
$table->addRow()->addCell($form);
$table->addRow()->addCell($this->html);
parent::add($table);
} catch (Exception $e) {
new TMessage('error', $e->getMessage());
}
}
示例13: __construct
public function __construct()
{
parent::__construct();
// instancia objeto DataGrid
$this->datagrid = new TDataGrid();
// instancia as colunas da DataGrid
$codigo = new TDataGridColumn('codigo', 'Código', 'left', 50);
$nome = new TDataGridColumn('nome', 'Nome', 'left', 180);
$endereco = new TDataGridColumn('endereco', 'Endereço', 'left', 140);
$telefone = new TDataGridColumn('fone', 'Fone', 'center', 100);
// adiciona as colunas à DataGrid
$this->datagrid->addColumn($codigo);
$this->datagrid->addColumn($nome);
$this->datagrid->addColumn($endereco);
$this->datagrid->addColumn($telefone);
// instancia duas ações da DataGrid
$action1 = new TDataGridAction(array($this, 'onDelete'));
$action1->setLabel('Deletar');
$action1->setImage('ico_delete.png');
$action1->setField('codigo');
$action2 = new TDataGridAction(array($this, 'onView'));
$action2->setLabel('Visualizar');
$action2->setImage('ico_view.png');
$action2->setField('nome');
// adiciona as ações à DataGrid
$this->datagrid->addAction($action1);
$this->datagrid->addAction($action2);
// cria o modelo da DataGrid, montando sua estrutura
$this->datagrid->createModel();
// adiciona a DataGrid à página
parent::add($this->datagrid);
}
示例14: __construct
public function __construct()
{
parent::__construct();
$this->form = new TForm();
// creates one datagrid
$this->datagrid = new TQuickGrid();
$this->datagrid->disableDefaultClick();
// important!
$this->form->add($this->datagrid);
// add the columns
$this->datagrid->addQuickColumn('Check', 'check', 'right', 40);
$this->datagrid->addQuickColumn('Code', 'code', 'right', 70);
$this->datagrid->addQuickColumn('Name', 'name', 'left', 180);
$this->datagrid->addQuickColumn('Address', 'address', 'left', 180);
$this->datagrid->addQuickColumn('Phone', 'fone', 'left', 120);
// creates the datagrid model
$this->datagrid->createModel();
// 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');
$this->form->addField($button1);
// wrap the page content using vertical box
$vbox = new TVBox();
$vbox->add(new TXMLBreadCrumb('menu.xml', __CLASS__));
$vbox->add($this->form);
$vbox->add($button1);
parent::add($vbox);
}
示例15: TForm
/**
* Class constructor
* Creates the page
*/
function __construct()
{
parent::__construct();
// create the form
$this->form = new TForm();
// create the form fields
$html = new THtmlEditor('html_text');
$html->setSize(500, 200);
// creates the action button
$button1 = new TButton('action1');
$button1->setAction(new TAction(array($this, 'onShow')), 'Show');
$button1->setImage('ico_apply.png');
// creates the table wrapper and put it inside the form
$table = new TTable();
$this->form->add($table);
// pack elements
$table->addRow()->addCell(new TLabel('HTML:'));
$table->addRow()->addCell($html);
$table->addRow()->addCell($button1);
// define wich are the form fields
$this->form->setFields(array($html, $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);
}