/** * 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); }
/** * Class constructor * Creates the page */ function __construct() { parent::__construct(); TPage::include_css('app/resources/styles.css'); $html1 = new THtmlRenderer('app/resources/welcome.html'); $html2 = new THtmlRenderer('app/resources/bemvindo.html'); // replace the main section variables $html1->enableSection('main', array()); $html2->enableSection('main', array()); $panel1 = new TPanelGroup('Welcome!'); $panel1->add($html1); $panel2 = new TPanelGroup('Bem-vindo!'); $panel2->add($html2); // add the template to the page parent::add(TVBox::pack($panel1, $panel2)); }
public function __construct() { parent::__construct(); // creates one datagrid $this->datagrid = new BootstrapDatagridWrapper(new TQuickGrid()); $this->datagrid->setHeight(320); // add the columns $this->datagrid->addQuickColumn('Code', 'id', 'right', 70); $this->datagrid->addQuickColumn('Título', 'titulo', 'left', 180); $this->datagrid->addQuickColumn('Descrição', 'descricao', 'left', 280); $this->datagrid->addQuickColumn('Prioridade', 'prioridade', 'left', 70); // creates the datagrid model $this->datagrid->createModel(); $panel = new TPanelGroup('Listagem de tarefas'); $panel->style = "max-width: 700px"; $panel->add($this->datagrid); // wrap the page content using vertical box $vbox = new TVBox(); $vbox->add($panel); parent::add($vbox); }
public function onGenerate($param) { try { $this->form->validate(); $data = $this->form->getData(); if (strtoupper(substr($data->select, 0, 6)) !== 'SELECT') { throw new Exception(_t('Invalid command')); } // creates a DataGrid $datagrid = new BootstrapDatagridWrapper(new TDataGrid()); $datagrid->style = 'width: 100%'; $datagrid->setHeight(320); TTransaction::open($data->database); $conn = TTransaction::get(); $result = $conn->query($data->select); $row = $result->fetch(); foreach ($row as $key => $value) { if (is_string($key)) { $col = new TDataGridColumn($key, $key, 'left'); $datagrid->addColumn($col); } } // create the datagrid model $datagrid->createModel(); $datagrid->addItem((object) $row); $i = 1; while ($row = $result->fetch() and $i <= 1000) { $datagrid->addItem((object) $row); $i++; } $panel = new TPanelGroup(_t('Results')); $panel->add($datagrid); $panel->addFooter(_t('^1 records shown', "<b>{$i}</b>")); $this->container->addRow()->addCell($panel); TTransaction::close(); } catch (Exception $e) { new TMessage('error', $e->getMessage()); } }