/** * Constructor Method * Creates the page, the search form and the listing */ public function __construct() { parent::__construct(); parent::setTitle(AdiantiCoreTranslator::translate('Search record')); parent::setSize(0.7, 640); // creates a new form $this->form = new TForm('form_standard_seek'); // creates a new table $table = new TTable(); $table->{'width'} = '100%'; // adds the table into the form $this->form->add($table); // create the form fields $display_field = new TEntry('display_field'); $display_field->setSize('90%'); // keeps the field's value $display_field->setValue(TSession::getValue('tstandardseek_display_value')); // create the action button $find_button = new TButton('busca'); // define the button action $find_button->setAction(new TAction(array($this, 'onSearch')), AdiantiCoreTranslator::translate('Search')); $find_button->setImage('fa:search blue'); // add a row for the filter field $table->addRowSet(new TLabel(_t('Search') . ': '), $display_field, $find_button); // define wich are the form fields $this->form->setFields(array($display_field, $find_button)); // creates a new datagrid $this->datagrid = new TDataGrid(); $this->datagrid->{'style'} = 'width: 100%'; // create two datagrid columns $id = new TDataGridColumn('id', 'ID', 'right', '16%'); $display = new TDataGridColumn('display_field', AdiantiCoreTranslator::translate('Field'), 'left'); // add the columns to the datagrid $this->datagrid->addColumn($id); $this->datagrid->addColumn($display); // create a datagrid action $action1 = new TDataGridAction(array($this, 'onSelect')); $action1->setLabel(AdiantiCoreTranslator::translate('Select')); $action1->setImage('fa:check-circle-o green'); $action1->setUseButton(TRUE); $action1->setField('id'); // add the actions to the datagrid $this->datagrid->addAction($action1); // create the datagrid model $this->datagrid->createModel(); // creates the paginator $this->pageNavigation = new TPageNavigation(); $this->pageNavigation->setAction(new TAction(array($this, 'onReload'))); $this->pageNavigation->setWidth($this->datagrid->getWidth()); $panel = new TPanelGroup(); $panel->add($this->form); // creates the container $vbox = new TVBox(); $vbox->add($panel); $vbox->add($this->datagrid); $vbox->add($this->pageNavigation); $vbox->{'style'} = 'width: 100%'; // add the container to the page parent::add($vbox); }