/**
  * 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);
 }
Exemplo n.º 2
0
 /**
  * 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));
 }
 /**
  * Class constructor
  * Creates the page, the form and the listing
  */
 public function __construct()
 {
     parent::__construct();
     parent::setSize(500, 400);
     parent::setTitle('Telefones');
     // creates a Datagrid
     $this->datagrid = new TDataGrid();
     $this->datagrid = new BootstrapDatagridWrapper($this->datagrid);
     $this->datagrid->style = 'width: 100%';
     $this->datagrid->setHeight(320);
     // $this->datagrid->datatable = 'true';
     // $this->datagrid->enablePopover('Popover', 'Hi <b> {name} </b>');
     // creates the datagrid columns
     $column_check = new TDataGridColumn('check', '', 'center');
     $column_id = new TDataGridColumn('id', 'Id', 'right');
     $column_numero = new TDataGridColumn('numero', 'Numero', 'left');
     // add the columns to the DataGrid
     $this->datagrid->addColumn($column_check);
     $this->datagrid->addColumn($column_id);
     $this->datagrid->addColumn($column_numero);
     // create DELETE action
     $action_del = new TDataGridAction(array($this, 'onDelete'));
     $action_del->setUseButton(TRUE);
     $action_del->setButtonClass('btn btn-default');
     $action_del->setLabel(_t('Delete'));
     $action_del->setImage('fa:trash-o red fa-lg');
     $action_del->setField('id');
     $action_del->setDisplayCondition(array($this, 'checkDelete'));
     $this->datagrid->addAction($action_del);
     // 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());
     $this->datagrid->disableDefaultClick();
     // put datagrid inside a form
     $this->formgrid = new TForm();
     $this->formgrid->add($this->datagrid);
     // creates the delete collection button
     $this->deleteButton = new TButton('delete_collection');
     $this->deleteButton->setAction(new TAction(array($this, 'onDeleteCollection')), AdiantiCoreTranslator::translate('Delete selected'));
     $this->deleteButton->setImage('fa:remove red');
     $this->formgrid->addField($this->deleteButton);
     $gridpack = new TVBox();
     $gridpack->style = 'width: 100%';
     $gridpack->add($this->formgrid);
     $gridpack->add($this->deleteButton)->style = 'background:whiteSmoke;border:1px solid #cccccc; padding: 3px;padding: 5px;';
     $this->transformCallback = array($this, 'onBeforeLoad');
     // vertical box container
     $container = new TVBox();
     $container->style = 'width: 90%';
     // $container->add(new TXMLBreadCrumb('menu.xml', __CLASS__));
     $container->add(TPanelGroup::pack('Title', $this->form));
     $container->add($gridpack);
     $container->add($this->pageNavigation);
     parent::add($container);
 }
 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);
 }
Exemplo n.º 5
0
 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());
     }
 }
 /**
  * Page constructor
  */
 public function __construct()
 {
     parent::__construct();
     parent::setDatabase('sample');
     // defines the database
     parent::setActiveRecord('Cliente');
     // defines the active record
     parent::setDefaultOrder('id', 'asc');
     // defines the default order
     // parent::setCriteria($criteria) // define a standard filter
     parent::addFilterField('nome', 'like', 'nome');
     // filterField, operator, formField
     // creates the form
     $this->form = new TQuickForm('form_search_Cliente');
     $this->form->class = 'tform';
     // change CSS class
     $this->form = new BootstrapFormWrapper($this->form);
     $this->form->style = 'display: table;width:100%';
     // change style
     $this->form->setFormTitle('Cliente');
     // create the form fields
     $nome = new TEntry('nome');
     // add the fields
     $this->form->addQuickField('Nome', $nome, 200);
     // keep the form filled during navigation with session data
     $this->form->setData(TSession::getValue('Cliente_filter_data'));
     // add the search form actions
     $this->form->addQuickAction(_t('Find'), new TAction(array($this, 'onSearch')), 'fa:search');
     $this->form->addQuickAction(_t('New'), new TAction(array('ClienteForm', 'onEdit')), 'bs:plus-sign green');
     // creates a DataGrid
     $this->datagrid = new TDataGrid();
     $this->datagrid = new BootstrapDatagridWrapper($this->datagrid);
     $this->datagrid->style = 'width: 100%';
     $this->datagrid->setHeight(320);
     // $this->datagrid->datatable = 'true';
     // $this->datagrid->enablePopover('Popover', 'Hi <b> {name} </b>');
     // creates the datagrid columns
     $column_check = new TDataGridColumn('check', '', 'center');
     $column_id = new TDataGridColumn('id', 'Id', 'right');
     $column_nome = new TDataGridColumn('nome', 'Nome', 'left');
     // add the columns to the DataGrid
     $this->datagrid->addColumn($column_check);
     $this->datagrid->addColumn($column_id);
     $this->datagrid->addColumn($column_nome);
     // create EDIT action
     $action_edit = new TDataGridAction(array('ClienteForm', 'onEdit'));
     $action_edit->setUseButton(TRUE);
     $action_edit->setButtonClass('btn btn-default');
     $action_edit->setLabel(_t('Edit'));
     $action_edit->setImage('fa:pencil-square-o blue fa-lg');
     $action_edit->setField('id');
     $action_edit->setDisplayCondition(array($this, 'checkEdit'));
     $this->datagrid->addAction($action_edit);
     // create DELETE action
     $action_del = new TDataGridAction(array($this, 'onDelete'));
     $action_del->setUseButton(TRUE);
     $action_del->setButtonClass('btn btn-default');
     $action_del->setLabel(_t('Delete'));
     $action_del->setImage('fa:trash-o red fa-lg');
     $action_del->setField('id');
     $action_del->setDisplayCondition(array($this, 'checkDelete'));
     $this->datagrid->addAction($action_del);
     $telefone_action = new TDataGridAction(array('telefoneList', 'onReload'));
     $telefone_action->setLabel('Telefones');
     $telefone_action->setImage('bs:search blue');
     $telefone_action->setField('id');
     $this->datagrid->addAction($telefone_action);
     $email_action = new TDataGridAction(array('emailList', 'onReload'));
     $email_action->setLabel('Email');
     $email_action->setImage('bs:search blue');
     $email_action->setField('id');
     $this->datagrid->addAction($email_action);
     // 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());
     $this->datagrid->disableDefaultClick();
     // put datagrid inside a form
     $this->formgrid = new TForm();
     $this->formgrid->add($this->datagrid);
     // creates the delete collection button
     $this->deleteButton = new TButton('delete_collection');
     $this->deleteButton->setAction(new TAction(array($this, 'onDeleteCollection')), AdiantiCoreTranslator::translate('Delete selected'));
     $this->deleteButton->setImage('fa:remove red');
     $this->formgrid->addField($this->deleteButton);
     $gridpack = new TVBox();
     $gridpack->style = 'width: 100%';
     $gridpack->add($this->formgrid);
     $gridpack->add($this->deleteButton)->style = 'background:whiteSmoke;border:1px solid #cccccc; padding: 3px;padding: 5px;';
     $this->transformCallback = array($this, 'onBeforeLoad');
     // vertical box container
     $container = new TVBox();
     $container->style = 'width: 90%';
     // $container->add(new TXMLBreadCrumb('menu.xml', __CLASS__));
     $container->add(TPanelGroup::pack('Title', $this->form));
     $container->add($gridpack);
     $container->add($this->pageNavigation);
     parent::add($container);
 }
 /**
  * Form constructor
  * @param $param Request
  */
 public function __construct($param)
 {
     parent::__construct();
     // creates the form
     $this->form = new TForm('form_Cliente');
     $this->form->class = 'tform';
     // change CSS class
     $note = new TNotebook(400, 300);
     // add a table inside form
     $table = new TTable();
     $table->width = '100%';
     // add a row for the form title
     $row = $table->addRow();
     $row->class = 'tformtitle';
     // CSS class
     $row->addCell(new TLabel('Clientes'))->colspan = 2;
     // create the form fields
     $id = new TEntry('id');
     $nome = new TEntry('nome');
     // campo para telefones
     $multifield = new TMultiField('telefone');
     $telefone_id = new TEntry('id');
     $telefone_id->setEditable(false);
     $telefone = new TEntry('numero');
     $telefone->setMask('(99)99999-9999');
     //    campo para emails
     $multifield_email = new TMultiField('email');
     $email = new TEntry('email');
     $email_id = new TEntry('id');
     $email->addValidation('email', new TEmailValidator());
     $multifield->addField('id', 'Codigo', $telefone_id, 200);
     $multifield->addField('numero', 'Telefone', $telefone, 200, true);
     $multifield_email->addField('id', 'Codigo', $email_id, 200);
     $multifield_email->addField('email', 'Email', $email, 200, true);
     // define the sizes
     $id->setSize(100);
     $nome->setSize(200);
     // add one row for each form field
     $table->addRowSet(new TLabel('id:'), $id);
     $table->addRowSet(new TLabel('nome:'), $nome);
     $this->form->setFields(array($id, $nome, $multifield, $multifield_email));
     // create the form actions
     $save_button = TButton::create('save', array($this, 'onSave'), _t('Save'), 'bs:floppy-disk red');
     $new_button = TButton::create('new', array($this, 'onEdit'), _t('New'), 'bs:edit green');
     $this->form->addField($save_button);
     $this->form->addField($new_button);
     $buttons_box = new THBox();
     $buttons_box->add($save_button);
     $buttons_box->add($new_button);
     // add a row for the form action
     $row = $table->addRow();
     $row->class = 'tformaction';
     // CSS class
     $row->addCell($buttons_box)->colspan = 2;
     $note->appendPage('Clientes', $table);
     $note->appendPage('Telefone', $multifield);
     $note->appendPage('Email', $multifield_email);
     $this->form->add($note);
     // vertical box container
     $container = new TVBox();
     $container->style = 'width: 90%';
     // $container->add(new TXMLBreadCrumb('menu.xml', __CLASS__));
     $container->add(TPanelGroup::pack('Title', $this->form));
     parent::add($container);
 }