function __construct() { parent::__construct(); Clientes::checkCliente(); $this->pagseguro = new PPagSeguro('progs'); $this->setSize(550, 400); $this->setTitle('Lista de Produtos'); $this->grid = new TQuickGrid(); $this->grid->addQuickColumn('id', 'id', 'right', 100); $this->grid->addQuickColumn('nome', 'nome', 'right', 200); $this->grid->addQuickColumn('qtd', 'qtd', 'right', 100); $this->grid->addQuickColumn('preco', 'preco', 'right', 100); $action = new TDataGridAction(array('Carrinho', 'updateItem')); $this->grid->addQuickAction('UpdateItem', $action, 'id', 'ico_edit.png'); $form = new TQuickForm('frm_finalizar'); $action2 = new TAction(array($this, 'finalizar')); $form->addQuickAction('finalizar', $action2); $this->grid->createModel(); $produtos = PCart::getItens(); if ($produtos) { foreach ($produtos as $p) { $item = new stdClass(); $item->id = $p->getId(); $item->nome = $p->getNome(); $item->qtd = $p->getQtd(); $item->preco = $p->getPreco(); $this->grid->addItem($item); } $box = new TVBox(); $box->add($this->grid); $box->add($form); parent::add($box); } }
public function __construct() { parent::__construct(); $this->datagrid = new TQuickGrid(); $this->datagrid->setHeight(320); // define the CSS class $this->datagrid->class = 'customized-table'; // import the CSS file parent::include_css('app/resources/custom-table.css'); // add the columns $this->datagrid->addQuickColumn('ID', 'id', 'left', 50); $this->datagrid->addQuickColumn('Description', 'description', 'left', 250); $this->datagrid->addQuickColumn('Amount', 'amount', 'right', 140); $this->datagrid->addQuickColumn('Price', 'sale_price', 'right', 140); // add the actions $this->datagrid->addQuickAction('Delete', new TDataGridAction(array($this, 'onDelete')), 'id', 'ico_delete.png'); // creates the datagrid model $this->datagrid->createModel(); $form_back = new TQuickForm(); $form_back->addQuickAction('Back', new TAction(array($this, 'onGoToCatalog')), 'ico_back.png'); // wrap the page content using vertical box $vbox = new TVBox(); $vbox->add(new TXMLBreadCrumb('menu.xml', 'ProductCatalogView')); $vbox->add($this->datagrid); $vbox->add($form_back); parent::add($vbox); }
/** * 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()); } }
/** * Open an input dialog */ public function onInputDialog($param) { $form = new TQuickForm('input_form'); $form->style = 'padding:20px'; $login = new TEntry('login'); $pass = new TPassword('password'); $form->addQuickField('Login', $login); $form->addQuickField('Password', $pass); $form->addQuickAction('Confirm 1', new TAction(array($this, 'onConfirm1')), 'ico_save.png'); $form->addQuickAction('Confirm 2', new TAction(array($this, 'onConfirm2')), 'ico_apply.png'); // show the input dialog new TInputDialog('Input dialog title', $form); }
public function __construct() { parent::__construct(); $f = new TQuickForm('f'); $this->formulario = $f; $f->class = 'tform'; $f->setFormTitle('Testando 1,2,3'); // CAMPOS $nome = new TEntry('nome'); $custo = new TEntry('custo'); $f->addQuickField('Nome:', $nome, 400); $f->addQuickField('Custo:', $custo); // ACOES $p = array($this, 'aoGravar'); $gravar = new TAction($p, 'ico_save.png'); $f->addQuickAction('Salvar', $gravar); // Adiciona parent::add($f); }