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);
 }
 /**
  * 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);
 }
 /**
  * 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);
 }