コード例 #1
0
 /**
  * Class constructor
  * Creates the page and the registration form
  */
 function __construct()
 {
     parent::__construct();
     $table = new TTable();
     $table->width = '100%';
     // creates the form
     $this->form = new TForm('form_login');
     $this->form->class = 'tform';
     $this->form->style = 'margin:auto;width: 350px';
     // add the notebook inside the form
     $this->form->add($table);
     // create the form fields
     $login = new TEntry('login');
     $password = new TPassword('password');
     // define the sizes
     $login->setSize(150, 40);
     $password->setSize(150, 40);
     // create an action button (save)
     $save_button = new TButton('save');
     $save_button->setAction(new TAction(array($this, 'onLogin')), _t('Login'));
     $save_button->setImage('ico_apply.png');
     // add a row for the field login
     $row = $table->addRow();
     $cell = $row->addCell(new TLabel('Login'));
     $cell->colspan = 2;
     $row->class = 'tformtitle';
     $table->addRowSet(new TLabel(_t('User') . ': '), $login);
     $table->addRowSet(new TLabel(_t('Password') . ': '), $password);
     $row = $table->addRowSet($save_button, '');
     $row->class = 'tformaction';
     $this->form->setFields(array($login, $password, $save_button));
     // add the form to the page
     parent::add($this->form);
 }
コード例 #2
0
 public function __construct()
 {
     parent::__construct();
     $this->form = new TForm();
     // creates one datagrid
     $this->datagrid = new TQuickGrid();
     $this->datagrid->disableDefaultClick();
     // important!
     $this->form->add($this->datagrid);
     // add the columns
     $this->datagrid->addQuickColumn('Check', 'check', 'right', 40);
     $this->datagrid->addQuickColumn('Code', 'code', 'right', 70);
     $this->datagrid->addQuickColumn('Name', 'name', 'left', 180);
     $this->datagrid->addQuickColumn('Address', 'address', 'left', 180);
     $this->datagrid->addQuickColumn('Phone', 'fone', 'left', 120);
     // creates the datagrid model
     $this->datagrid->createModel();
     // creates the action button
     $button1 = new TButton('action1');
     // define the button action
     $button1->setAction(new TAction(array($this, 'onSave')), 'Save');
     $button1->setImage('ico_save.png');
     $this->form->addField($button1);
     // wrap the page content using vertical box
     $vbox = new TVBox();
     $vbox->add(new TXMLBreadCrumb('menu.xml', __CLASS__));
     $vbox->add($this->form);
     $vbox->add($button1);
     parent::add($vbox);
 }
コード例 #3
0
 public function __construct()
 {
     parent::__construct();
     $this->form = new TForm();
     // creates one datagrid
     $this->datagrid = new TQuickGrid();
     $this->datagrid->disableDefaultClick();
     $this->form->add($this->datagrid);
     // creates the action button
     $button1 = new TButton('action1');
     // define the button action
     $action_button1 = new TAction(array($this, 'onUpdate'));
     $action_button1->setParameter('id', filter_input(INPUT_GET, 'id'));
     $button1->setAction($action_button1, 'Atualizar');
     $button1->setImage('fa:check-circle-o green');
     $this->form->addField($button1);
     // add the columns
     $this->datagrid->addQuickColumn('Tipo de Atividade', 'nome', 'left', 180);
     $this->datagrid->addQuickColumn('Ticket', 'ticket', 'left', 180);
     $this->datagrid->addQuickColumn('Sistema', 'sistema', 'left', 180);
     // creates the datagrid model
     $this->datagrid->createModel();
     // wrap the page content using vertical box
     $vbox = new TVBox();
     $vbox->add($button1);
     $vbox->add($this->form);
     parent::add($vbox);
 }
コード例 #4
0
 /**
  * Class constructor
  */
 function __construct()
 {
     parent::__construct();
     // creates the form
     $this->form = new TForm('form_pdf_shapes');
     // creates a table
     $table = new TTable();
     // add the table inside the form
     $this->form->add($table);
     // create the form fields
     $name = new TEntry('name');
     $name->addValidation('Name', new TRequiredValidator());
     $label = new TLabel('Name' . ': ');
     $label->setFontColor('red');
     $table->addRowSet($label, $name);
     $save_button = new TButton('generate');
     $save_button->setAction(new TAction(array($this, 'onGenerate')), 'Generate');
     $save_button->setImage('ico_save.png');
     // add a row for the form action
     $table->addRowSet($save_button);
     // define wich are the form fields
     $this->form->setFields(array($name, $save_button));
     // wrap the page content using vertical box
     $vbox = new TVBox();
     $vbox->add(new TXMLBreadCrumb('menu.xml', __CLASS__));
     $vbox->add($this->form);
     parent::add($vbox);
 }
コード例 #5
0
 /**
  * Class constructor
  * Creates the page
  */
 function __construct()
 {
     parent::__construct();
     // create the form
     $this->form = new TForm();
     // create the form fields
     $html = new THtmlEditor('html_text');
     $html->setSize(500, 200);
     // creates the action button
     $button1 = new TButton('action1');
     $button1->setAction(new TAction(array($this, 'onShow')), 'Show');
     $button1->setImage('ico_apply.png');
     // creates the table wrapper and put it inside the form
     $table = new TTable();
     $this->form->add($table);
     // pack elements
     $table->addRow()->addCell(new TLabel('HTML:'));
     $table->addRow()->addCell($html);
     $table->addRow()->addCell($button1);
     // define wich are the form fields
     $this->form->setFields(array($html, $button1));
     // wrap the page content using vertical box
     $vbox = new TVBox();
     $vbox->add(new TXMLBreadCrumb('menu.xml', __CLASS__));
     $vbox->add($this->form);
     parent::add($vbox);
 }
コード例 #6
0
 /**
  * Class constructor
  * Creates the page
  */
 function __construct()
 {
     parent::__construct();
     $this->form = new TForm();
     $list1 = new TSortList('list1');
     $list2 = new TSortList('list2');
     $list1->addItems(array('1' => 'One', '2' => 'Two', '3' => 'Three'));
     $list2->addItems(array('a' => 'A', 'b' => 'B', 'c' => 'C'));
     $list1->setSize(200, 100);
     $list2->setSize(200, 100);
     $list1->connectTo($list2);
     $list2->connectTo($list1);
     // creates the action button
     $button1 = new TButton('action1');
     $button1->setAction(new TAction(array($this, 'onSave')), 'Save');
     $button1->setImage('ico_save.png');
     $table = new TTable();
     $row = $table->addRow();
     $row->addCell($list1);
     $row->addCell($list2);
     $table->addRow()->addCell($button1);
     $this->form->setFields(array($list1, $list2, $button1));
     $this->form->add($table);
     // wrap the page content using vertical box
     $vbox = new TVBox();
     $vbox->add(new TXMLBreadCrumb('menu.xml', __CLASS__));
     $vbox->add($this->form);
     parent::add($vbox);
 }
コード例 #7
0
 /**
  * Class constructor
  * Creates the page and the registration form
  */
 function __construct()
 {
     parent::__construct();
     // creates the form
     $this->form = new TForm('form_City');
     $this->form->class = 'tform';
     // CSS class
     $this->form->style = 'width: 500px';
     // creates a table
     $table = new TTable();
     $table->width = '100%';
     $table_buttons = new TTable();
     // add the table inside the form
     $this->form->add($table);
     // create the form fields
     $id = new TEntry('id');
     $name = new TEntry('name');
     // define the sizes
     $id->setSize(100);
     $name->setSize(100);
     $id->setEditable(FALSE);
     // define the form title
     $row = $table->addRow();
     $row->class = 'tformtitle';
     $cell = $row->addCell(new TLabel('Manual form'));
     $cell->colspan = 2;
     // add the form fields
     $table->addRowSet(new TLabel('ID:'), $id);
     $table->addRowSet(new TLabel('Name:'), $name);
     // create an action button (save)
     $save_button = new TButton('save');
     $save_button->setAction(new TAction(array($this, 'onSave')), 'Save');
     $save_button->setImage('ico_save.png');
     // create an action button (new)
     $new_button = new TButton('new');
     $new_button->setAction(new TAction(array($this, 'onEdit')), 'New');
     $new_button->setImage('ico_new.png');
     // create an action button (go to list)
     $goto_button = new TButton('list');
     $goto_button->setAction(new TAction(array('CompleteDataGridView', 'onReload')), 'Listing');
     $goto_button->setImage('ico_datagrid.gif');
     // add a row for the form action
     $row = $table_buttons->addRow();
     $row->addCell($save_button);
     $row->addCell($new_button);
     $row->addCell($goto_button);
     // add a row for the form action
     $row = $table->addRow();
     $row->class = 'tformaction';
     $cell = $row->addCell($table_buttons);
     $cell->colspan = 2;
     // define wich are the form fields
     $this->form->setFields(array($id, $name, $save_button, $new_button, $goto_button));
     // wrap the page content using vertical box
     $vbox = new TVBox();
     $vbox->add(new TXMLBreadCrumb('menu.xml', __CLASS__));
     $vbox->add($this->form);
     parent::add($vbox);
 }
コード例 #8
0
 /**
  * Class constructor
  * Creates the page and the registration form
  */
 function __construct()
 {
     parent::__construct();
     // creates the table container
     $table = new TTable();
     $table->style = 'width:100%';
     // creates the form
     $this->form = new TForm('form_System_Provider');
     $this->form->class = 'tform';
     // add the notebook inside the form
     $this->form->add($table);
     $row1 = $table->addRow();
     $row1->class = 'tformtitle';
     $cell1 = $row1->addCell(new TLabel('Add new provider'), '');
     $cell1->colspan = 2;
     // create the form fields
     $id = new TEntry('id');
     $nif = new TEntry('nif');
     $name = new TEntry('name');
     $id->setEditable(false);
     // define the sizes
     $id->setSize(100);
     $nif->setSize(300);
     $name->setSize(300);
     // validations
     $nif->addValidation('nif', new TRequiredValidator());
     $name->addValidation('name', new TRequiredValidator());
     // add a row for the field id
     $table->addRowSet(new TLabel('ID:'), $id);
     $table->addRowSet(new TLabel('NIF: '), $nif);
     $table->addRowSet(new TLabel('Name: '), $name);
     // create an action button (save)
     $save_button = new TButton('save');
     $save_button->setAction(new TAction(array($this, 'onSave')), _t('Save'));
     $save_button->setImage('fa:floppy-o');
     // create an new button (edit with no parameters)
     $new_button = new TButton('new');
     $new_button->setAction(new TAction(array($this, 'onEdit')), _t('New'));
     $new_button->setImage('fa:plus-square green');
     $list_button = new TButton('list');
     $list_button->setAction(new TAction(array('SystemProvidersList', 'onReload')), _t('Back to the listing'));
     $list_button->setImage('fa:table blue');
     // define the form fields
     $this->form->setFields(array($id, $nif, $name, $save_button, $new_button, $list_button));
     $buttons = new THBox();
     $buttons->add($save_button);
     $buttons->add($new_button);
     $buttons->add($list_button);
     $container = new TTable();
     $container->width = '80%';
     $container->addRow()->addCell(new TXMLBreadCrumb('menu.xml', 'SystemProvidersList'));
     $container->addRow()->addCell($this->form);
     $row = $table->addRow();
     $row->class = 'tformaction';
     $cell = $row->addCell($buttons);
     $cell->colspan = 2;
     // add the form to the page
     parent::add($container);
 }
コード例 #9
0
 /**
  * Class constructor
  * Creates the page, the form and the listing
  */
 public function __construct()
 {
     parent::__construct();
     Usuario::checkLogin();
     parent::setDatabase('sample');
     // defines the database
     parent::setActiveRecord('Usuario');
     // defines the active record
     parent::setDefaultOrder('id', 'asc');
     // defines the default order
     parent::setFilterField('login');
     // defines the filter field
     // creates the form, with a table inside
     $this->form = new TForm('form_search_Usuario');
     $table = new TTable();
     $this->form->add($table);
     // create the form fields
     $filter = new TEntry('login');
     $filter->setValue(TSession::getValue('Usuario_login'));
     // add a row for the filter field
     $table->addRowSet(new TLabel('login:'******'find');
     $new_button = new TButton('new');
     $find_button->setAction(new TAction(array($this, 'onSearch')), _t('Find'));
     $new_button->setAction(new TAction(array('UsuarioForm', 'onEdit')), _t('New'));
     $find_button->setImage('ico_find.png');
     $new_button->setImage('ico_new.png');
     // add a row for the form actions
     $table->addRowSet($find_button, $new_button);
     // define wich are the form fields
     $this->form->setFields(array($filter, $find_button, $new_button));
     // creates a DataGrid
     $this->datagrid = new TQuickGrid();
     $this->datagrid->setHeight(320);
     // creates the datagrid columns
     $id = $this->datagrid->addQuickColumn('id', 'id', 'right', 100);
     $login = $this->datagrid->addQuickColumn('login', 'login', 'left', 200);
     $senha = $this->datagrid->addQuickColumn('senha', 'senha', 'left', 200);
     // create the datagrid actions
     $edit_action = new TDataGridAction(array('UsuarioForm', 'onEdit'));
     $delete_action = new TDataGridAction(array($this, 'onDelete'));
     // add the actions to the datagrid
     $this->datagrid->addQuickAction(_t('Edit'), $edit_action, 'id', 'ico_edit.png');
     $this->datagrid->addQuickAction(_t('Delete'), $delete_action, 'id', 'ico_delete.png');
     // 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());
     // create the page container
     $container = new TVBox();
     $container->add($this->form);
     $container->add($this->datagrid);
     $container->add($this->pageNavigation);
     parent::add($container);
 }
コード例 #10
0
 /**
  * Class constructor
  * Creates the page and the registration form
  */
 function __construct()
 {
     parent::__construct();
     // security check
     if (TSession::getValue('logged') !== TRUE) {
         throw new Exception(_t('Not logged'));
     }
     // security check
     TTransaction::open('changeman');
     if (Member::newFromLogin(TSession::getValue('login'))->role_mnemonic !== 'ADMINISTRATOR' and Member::newFromLogin(TSession::getValue('login'))->role_mnemonic !== 'MANAGER') {
         throw new Exception(_t('Permission denied'));
     }
     TTransaction::close();
     // creates a table
     $table = new TTable();
     // creates the form
     $this->form = new TForm('form_Document');
     $this->form->add($this->notebook);
     $this->form->class = 'tform';
     $this->form->add($table);
     $table->addRowSet(new TLabel(_t('Document')), '')->class = 'tformtitle';
     // create the form fields
     $id = new TEntry('id');
     $id_project = new TDBCombo('id_project', 'changeman', 'Project', 'id', 'description');
     $title = new TEntry('title');
     $content = new THtmlEditor('content');
     $id->setEditable(FALSE);
     // define the sizes
     $id->setSize(100);
     $id_project->setSize(200);
     $title->setSize(200, 40);
     $content->setSize(680, 350);
     $table->addRowSet(new TLabel('ID:'), $id);
     $table->addRowSet(new TLabel(_t('Project') . ': '), $id_project);
     $table->addRowSet(new TLabel(_t('Title') . ': '), $title);
     $hbox = new THBox();
     $hbox->style = 'margin: 10px';
     $hbox->add($content);
     $row = $table->addRow();
     $row->addCell($lbl = new TLabel(_t('Content') . ': '));
     $lbl->setFontStyle('b');
     $row = $table->addRow();
     $cell = $row->addCell($hbox);
     $cell->colspan = 3;
     // create an action button (save)
     $save_button = new TButton('save');
     // define the button action
     $save_button->setAction(new TAction(array($this, 'onSave')), _t('Save'));
     $save_button->setImage('ico_save.png');
     // define wich are the form fields
     $this->form->setFields(array($id, $id_project, $title, $content, $save_button));
     $table->addRowSet($save_button, '')->class = 'tformaction';
     $container = new TTable();
     $container->addRow()->addCell($this->form);
     // add the form to the page
     parent::add($container);
 }
コード例 #11
0
 /**
  * 
  */
 public function makeTButton($properties)
 {
     $widget = new TButton((string) $properties->{'name'});
     $widget->setImage((string) $properties->{'icon'});
     $widget->setAction(new TAction(array($this->controller, (string) $properties->{'action'})), (string) $properties->{'value'});
     $this->fields[] = $widget;
     $this->fieldsByName[(string) $properties->{'name'}] = $widget;
     return $widget;
 }
コード例 #12
0
 /**
  * Class constructor
  * Creates the page
  */
 function __construct()
 {
     parent::__construct();
     // create the form
     $this->form = new TForm();
     $this->form->class = 'tform';
     // creates the form field container
     $table = new TTable();
     $table->width = '100%';
     $this->form->add($table);
     // title row
     $table->addRowSet(new TLabel('Validation'), '')->class = 'tformtitle';
     // create the form fields
     $field1 = new TEntry('field1');
     $field2 = new TEntry('field2');
     $field3 = new TEntry('field3');
     $field4 = new TEntry('field4');
     $field5 = new TEntry('field5');
     $field6 = new TEntry('field6');
     $field7 = new TEntry('field7');
     $field1->addValidation('Field 1', new TMinLengthValidator(), array(3));
     // cannot be less the 3 characters
     $field2->addValidation('Field 2', new TMaxLengthValidator(), array(20));
     // cannot be greater the 20 characters
     $field3->addValidation('Field 3', new TMinValueValidator(), array(1));
     // cannot be less the 1
     $field4->addValidation('Field 4', new TMaxValueValidator(), array(10));
     // cannot be greater the 10
     $field5->addValidation('Field 5', new TRequiredValidator());
     // required field
     $field6->addValidation('Field 6', new TEmailValidator());
     // email field
     $field7->addValidation('Field 7', new TNumericValidator());
     // numeric field
     // add a row for one field
     $table->addRowSet(new TLabel('1. Min length validator (3):'), $field1);
     $table->addRowSet(new TLabel('2. Max length validator (20):'), $field2);
     $table->addRowSet(new TLabel('3. Min value validator (1):'), $field3);
     $table->addRowSet(new TLabel('4. Max value validator (10):'), $field4);
     $table->addRowSet(new TLabel('5. Required validator:'), $field5);
     $table->addRowSet(new TLabel('6. Email validator:'), $field6);
     $table->addRowSet(new TLabel('7. Numeric validator:'), $field7);
     // creates the action button
     $button1 = new TButton('action1');
     $button1->setAction(new TAction(array($this, 'onSave')), 'Save');
     $button1->setImage('ico_save.png');
     // add a row for the button
     $table->addRowSet($button1, '')->class = 'tformaction';
     // define wich are the form fields
     $this->form->setFields(array($field1, $field2, $field3, $field4, $field5, $field6, $field7, $button1));
     // wrap the page content using vertical box
     $vbox = new TVBox();
     $vbox->add(new TXMLBreadCrumb('menu.xml', __CLASS__));
     $vbox->add($this->form);
     parent::add($vbox);
 }
コード例 #13
0
 /**
  * Constructor Method
  * Creates the page, the search form and the listing
  */
 public function __construct()
 {
     parent::__construct();
     // creates a new form
     $this->form = new TForm('form_standard_seek');
     // creates a new table
     $table = new TTable();
     // adds the table into the form
     $this->form->add($table);
     // create the form fields
     $display_field = new TEntry('display_field');
     // keeps the field's value
     $display_field->setValue(TSession::getValue('tstandardseek_display_value'));
     // add a row for the filter field
     $row = $table->addRow();
     $row->addCell(new TLabel('Field:'));
     $row->addCell($display_field);
     // create the action button
     $find_button = new TButton('busca');
     // define the button action
     $find_button->setAction(new TAction(array($this, 'onSearch')), TAdiantiCoreTranslator::translate('Search'));
     $find_button->setImage('ico_find.png');
     // add a row for the button in the table
     $row = $table->addRow();
     $row->addCell($find_button);
     // define wich are the form fields
     $this->form->setFields(array($display_field, $find_button));
     // creates a new datagrid
     $this->datagrid = new TDataGrid();
     // create two datagrid columns
     $id = new TDataGridColumn('id', 'ID', 'right', 70);
     $display = new TDataGridColumn('display_field', 'Field', 'left', 220);
     // 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('Selecionar');
     $action1->setImage('ico_apply.png');
     $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());
     // creates the container
     $vbox = new TVBox();
     $vbox->add($this->form);
     $vbox->add($this->datagrid);
     $vbox->add($this->pageNavigation);
     // add the container to the page
     parent::add($vbox);
 }
コード例 #14
0
 /**
  * Class constructor
  * Creates the page, the form and the listing
  */
 public function __construct()
 {
     parent::__construct();
     Usuario::checkLogin();
     parent::setDatabase('sample');
     // defines the database
     parent::setActiveRecord('Pedidos');
     // defines the active record
     parent::setDefaultOrder('id', 'asc');
     // defines the default order
     parent::setFilterField('id');
     // defines the filter field
     // creates the form, with a table inside
     $this->form = new TForm('form_search_Pedidos');
     $table = new TTable();
     $this->form->add($table);
     // create the form fields
     $filter = new TEntry('id');
     $filter->setValue(TSession::getValue('Pedidos_id'));
     // add a row for the filter field
     $table->addRowSet(new TLabel('id:'), $filter);
     // create two action buttons to the form
     $find_button = new TButton('find');
     $find_button->setAction(new TAction(array($this, 'onSearch')), _t('Find'));
     $find_button->setImage('ico_find.png');
     // add a row for the form actions
     $table->addRowSet($find_button);
     // define wich are the form fields
     $this->form->setFields(array($filter, $find_button));
     // creates a DataGrid
     $this->datagrid = new TQuickGrid();
     $this->datagrid->setHeight(320);
     // creates the datagrid columns
     $id = $this->datagrid->addQuickColumn('id', 'id', 'right', 100);
     $dataP = $this->datagrid->addQuickColumn('dataP', 'dataP', 'left', 100);
     $clientes_id = $this->datagrid->addQuickColumn('cliente', 'clientes->nome', 'right', 100);
     $status = $this->datagrid->addQuickColumn('status', 'status', 'right', 100);
     // create the datagrid actions
     $itens_action = new TDataGridAction(array($this, 'showItens'));
     // add the actions to the datagrid
     $this->datagrid->addQuickAction("Produtos", $itens_action, 'id', 'ico_find.png');
     // 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());
     // create the page container
     $container = new TVBox();
     $container->add($this->form);
     $container->add($this->datagrid);
     $container->add($this->pageNavigation);
     parent::add($container);
 }
コード例 #15
0
 /**
  * Class constructor
  * Creates the page
  */
 function __construct()
 {
     parent::__construct();
     // create the form
     $this->form = new TForm();
     $this->form->class = 'tform';
     // creates the form field container
     $table = new TTable();
     $table->width = '100%';
     $this->form->add($table);
     // title row
     $table->addRowSet(new TLabel('Automatic selections'), '')->class = 'tformtitle';
     // create the form fields
     // parameters (name, database, model, key, value)
     $radio = new TDBRadioGroup('radio', 'samples', 'Category', 'id', 'name');
     $check = new TDBCheckGroup('check', 'samples', 'Category', 'id', 'name');
     $combo = new TDBCombo('combo', 'samples', 'Category', 'id', 'name');
     $select = new TDBSelect('select', 'samples', 'Category', 'id', 'name');
     $search = new TDBMultiSearch('search', 'samples', 'Category', 'id', 'name');
     $autocomp = new TDBEntry('autocomplete', 'samples', 'Category', 'name');
     $search->setMinLength(3);
     $search->setOperator('like');
     //default data:
     $radio->setValue(2);
     $check->setValue(array(1, 3));
     $combo->setValue(2);
     $select->setValue(array(1, 3));
     $search->setValue(array(99 => 'Predefined'));
     $radio->setLayout('horizontal');
     $check->setLayout('horizontal');
     $combo->setSize(160);
     $select->setSize(200, 70);
     $search->setSize(300, 70);
     // add the fields to the table
     $table->addRowSet(new TLabel('TDBRadioGroup:'), $radio);
     $table->addRowSet(new TLabel('TDBCheckGroup:'), $check);
     $table->addRowSet(new TLabel('TDBCombo:'), $combo);
     $table->addRowSet(new TLabel('TDBSelect:'), $select);
     $table->addRowSet(new TLabel('TDBMultiSearch:'), $search);
     $table->addRowSet(new TLabel('TDBEntry:'), $autocomp);
     // creates the action button
     $button1 = new TButton('action1');
     // define the button action
     $button1->setAction(new TAction(array($this, 'onSave')), 'Save');
     $button1->setImage('ico_save.png');
     $table->addRowSet($button1, '')->class = 'tformaction';
     // define wich are the form fields
     $this->form->setFields(array($radio, $check, $combo, $select, $search, $autocomp, $button1));
     // wrap the page content using vertical box
     $vbox = new TVBox();
     $vbox->add(new TXMLBreadCrumb('menu.xml', __CLASS__));
     $vbox->add($this->form);
     parent::add($vbox);
 }
コード例 #16
0
 /**
  * Add a form action
  * @param $name Action name
  * @param $callback Action callback
  * @param $label Action label
  * @param $icon Action icon 
  */
 public function addAction($name, $callback, $label, $icon)
 {
     // creates the action button
     $button1 = new TButton($name);
     $button1->setAction($callback, $label);
     $button1->setImage($icon);
     // add the field to the form
     parent::addField($button1);
     // add a row for the button
     $row = $this->table->addRow();
     $row->addCell($button1);
 }
コード例 #17
0
 /**
  * Class constructor
  * Creates the page and the registration form
  */
 function __construct()
 {
     parent::__construct();
     // creates the form
     $this->form = new TForm('form_Customer_Report');
     $this->form->class = 'tform';
     // CSS class
     // creates a table
     $table = new TTable();
     $table->width = '100%';
     // add the table inside the form
     $this->form->add($table);
     // create the form fields
     $name = new TEntry('name');
     $city_id = new TDBSeekButton('city_id', 'samples', 'form_Customer_Report', 'City', 'name', 'city_id', 'city_name');
     $city_name = new TEntry('city_name');
     $category_id = new TDBCombo('category_id', 'samples', 'Category', 'id', 'name');
     $output_type = new TRadioGroup('output_type');
     $options = array('html' => 'HTML', 'pdf' => 'PDF', 'rtf' => 'RTF');
     $output_type->addItems($options);
     $output_type->setValue('pdf');
     $output_type->setLayout('horizontal');
     // define the sizes
     $name->setSize(200);
     $city_id->setSize(100);
     $category_id->setSize(100);
     $city_name->setEditable(FALSE);
     // add a row for the field name
     $row = $table->addRowSet(new TLabel('Report filters'), '');
     $row->class = 'tformtitle';
     // CSS class
     // add the fields into the table
     $table->addRowSet(new TLabel('Name' . ': '), $name);
     $table->addRowSet(new TLabel('City' . ': '), array($city_id, $city_name));
     $table->addRowSet(new TLabel('Category' . ': '), $category_id);
     $table->addRowSet(new TLabel('Output' . ': '), $output_type);
     // create an action button (save)
     $save_button = new TButton('generate');
     $save_button->setAction(new TAction(array($this, 'onGenerate')), 'Generate');
     $save_button->setImage('ico_save.png');
     // add a row for the form action
     $row = $table->addRowSet($save_button, '');
     $row->class = 'tformaction';
     // define wich are the form fields
     $this->form->setFields(array($name, $city_id, $city_name, $category_id, $output_type, $save_button));
     // wrap the page content using vertical box
     $vbox = new TVBox();
     $vbox->add(new TXMLBreadCrumb('menu.xml', __CLASS__));
     $vbox->add($this->form);
     parent::add($vbox);
 }
コード例 #18
0
 /**
  * Class constructor
  * Creates the page
  */
 function __construct()
 {
     parent::__construct();
     // create the notebook
     $notebook = new TNotebook(520, 320);
     // create the form
     $this->form = new TForm();
     // creates the notebook page
     $table = new TTable();
     // add the notebook inside the form
     $this->form->add($table);
     // adds the notebook page
     $notebook->appendPage('Multi field component', $this->form);
     // create the form fields
     $multifield = new TMultiField('contacts');
     $multifield->setOrientation('horizontal');
     $subfield1 = new TEntry('name');
     $subfield2 = new TEntry('phone');
     $subfield3 = new TComboCombined('type_id', 'type_value');
     $subfield3->addItems(array(1 => 'Cellphone', 2 => 'Landline'));
     $subfield3->setSize(160);
     $multifield->setHeight(140);
     $multifield->addField('name', 'Name', $subfield1, 160, TRUE);
     $multifield->addField('phone', 'Phone', $subfield2, 120, TRUE);
     $multifield->addField('type_id', 'Type', $subfield3, 150);
     $subfield1->setSize(120);
     $subfield2->setSize(120);
     // add a row for one field
     $row = $table->addRow();
     $row->addCell($lbl = new TLabel('Multifield object:'));
     $lbl->setFontStyle('b');
     $row = $table->addRow();
     $row->addCell($multifield);
     // creates the action button
     $button1 = new TButton('action1');
     // define the button action
     $button1->setAction(new TAction(array($this, 'onSave')), 'Save');
     $button1->setImage('ico_save.png');
     // add a row for the button
     $row = $table->addRow();
     $row->addCell($button1);
     // define wich are the form fields
     $this->form->setFields(array($multifield, $button1));
     // wrap the page content using vertical box
     $vbox = new TVBox();
     $vbox->add(new TXMLBreadCrumb('menu.xml', __CLASS__));
     $vbox->add($notebook);
     parent::add($vbox);
 }
コード例 #19
0
 /**
  * Class constructor
  * Creates the page and the registration form
  */
 function __construct()
 {
     parent::__construct();
     Usuario::checkLogin();
     // creates the form
     $this->form = new TForm('form_Usuario');
     $this->form->class = 'tform';
     // CSS class
     // add a table inside form
     $table = new TTable();
     $table->width = '100%';
     $this->form->add($table);
     // add a row for the form title
     $row = $table->addRow();
     $row->class = 'tformtitle';
     // CSS class
     $row->addCell(new TLabel('Usuario'))->colspan = 2;
     // create the form fields
     $id = new TEntry('id');
     $login = new TEntry('login');
     $senha = new TPassword('senha');
     // define the sizes
     $id->setSize(100);
     $login->setSize(200);
     $senha->setSize(200);
     // add one row for each form field
     $table->addRowSet(new TLabel('id:'), $id);
     $table->addRowSet(new TLabel('login:'******'senha:'), $senha);
     // create an action button (save)
     $save_button = new TButton('save');
     $save_button->setAction(new TAction(array($this, 'onSave')), _t('Save'));
     $save_button->setImage('ico_save.png');
     // create an new button (edit with no parameters)
     $new_button = new TButton('new');
     $new_button->setAction(new TAction(array($this, 'onEdit')), _t('New'));
     $new_button->setImage('ico_new.png');
     $this->form->setFields(array($id, $login, $senha, $save_button, $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;
     parent::add($this->form);
 }
コード例 #20
0
 /**
  * método construtor
  * Cria a página e o formulário de cadastro
  */
 function __construct()
 {
     parent::__construct();
     // instancia um formulário
     $this->form = new TForm('form_login');
     // cria um notebook
     $notebook = new TNotebook();
     $notebook->setSize(340, 130);
     // instancia uma tabela
     $table = new TTable();
     // adiciona a tabela ao formulário
     $this->form->add($table);
     $langs = array();
     $langs['pt'] = 'Portugues';
     $langs['en'] = 'English';
     // cria os campos do formulário
     $user = new TEntry('user');
     $pass = new TPassword('password');
     $lang = new TCombo('language');
     $lang->addItems($langs);
     $lang->setValue(TSession::getValue('language'));
     // adiciona uma linha para o campo
     $row = $table->addRow();
     $row->addCell(new TLabel(_t('Login') . ':'));
     $row->addCell($user);
     // adiciona uma linha para o campo
     $row = $table->addRow();
     $row->addCell(new TLabel(_t('Password') . ':'));
     $row->addCell($pass);
     // adiciona uma linha para o campo
     $row = $table->addRow();
     $row->addCell(new TLabel(_t('Language') . ':'));
     $row->addCell($lang);
     // cria um botão de ação (salvar)
     $save_button = new TButton('login');
     // define a ação do botão
     $save_button->setAction(new TAction(array($this, 'onLogin')), _t('Login'));
     $save_button->setImage('ico_apply.png');
     // adiciona uma linha para a ação do formulário
     $row = $table->addRow();
     $row->addCell($save_button);
     // define quais são os campos do formulário
     $this->form->setFields(array($user, $pass, $lang, $save_button));
     $notebook->appendPage(_t('Data'), $this->form);
     // adiciona o notebook à página
     parent::add($notebook);
 }
コード例 #21
0
 /**
  * Class constructor
  * Creates the page and the registration form
  */
 function __construct()
 {
     parent::__construct();
     // security check
     if (TSession::getValue('logged') !== TRUE) {
         throw new Exception(_t('Not logged'));
     }
     // creates the form
     $this->form = new TForm('form_Issue');
     $this->form->class = 'tform';
     $this->form->style = 'width: 400px';
     $table = new TTable();
     $table->width = '100%';
     $table->addRowSet(new TLabel(_t('Password')), '')->class = 'tformtitle';
     $this->form->add($table);
     // create the form fields
     $current_password = new TPassword('current_password');
     $new_password1 = new TPassword('new_password1');
     $new_password2 = new TPassword('new_password2');
     $current_password->addValidation(_t('Current password'), new TRequiredValidator());
     $new_password1->addValidation(_t('New password'), new TRequiredValidator());
     $new_password2->addValidation(_t('Confirm new password'), new TRequiredValidator());
     // add a row for the field
     $row = $table->addRow();
     $row->addCell(new TLabel(_t('Current password') . ': '));
     $row->addCell($current_password);
     // add a row for the field
     $row = $table->addRow();
     $row->addCell(new TLabel(_t('New password') . ': '));
     $row->addCell($new_password1);
     // add a row for the field
     $row = $table->addRow();
     $row->addCell(new TLabel(_t('Confirm new password') . ': '));
     $row->addCell($new_password2);
     // create an action button (save)
     $save_button = new TButton('save');
     // define the button action
     $save_button->setAction(new TAction(array($this, 'onSave')), _t('Save'));
     $save_button->setImage('ico_save.png');
     $table->addRowSet($save_button, '')->class = 'tformaction';
     // define wich are the form fields
     $this->form->setFields(array($current_password, $new_password1, $new_password2, $save_button));
     $container = new TVBox();
     $container->add($this->form);
     parent::add($container);
 }
コード例 #22
0
 /**
  * Class constructor
  * Creates the page and the registration form
  */
 function __construct()
 {
     parent::__construct();
     // security check
     if (TSession::getValue('logged') !== TRUE) {
         throw new Exception(_t('Not logged'));
     }
     // creates the form
     $this->form = new TForm('form_Note');
     $this->form->class = 'tform';
     // creates a table
     $table = new TTable();
     $table->addRowSet(new TLabel(_t('Note')), '')->class = 'tformtitle';
     // add the table inside the form
     $this->form->add($table);
     // create the form fields
     $id_issue = new THidden('id_issue');
     $note = new THtmlEditor('note');
     // define the sizes
     $id_issue->setSize(100);
     $note->setSize(640, 200);
     $note->style = 'margin: 10px';
     // add a row for the field id_issue
     $row = $table->addRow();
     $row->addCell($id_issue);
     // add a row for the field note
     $row = $table->addRow();
     $row->addCell($lbl = new TLabel(_t('Notes') . ': '));
     $row = $table->addRow();
     $row->addCell($note);
     $lbl->setFontStyle('b');
     // create an action button (save)
     $save_button = new TButton('save');
     // define the button action
     $save_button->setAction(new TAction(array($this, 'onSave')), _t('Save'));
     $save_button->setImage('ico_save.png');
     // add a row for the form action
     $row = $table->addRow();
     $row->addCell($save_button);
     // define wich are the form fields
     $this->form->setFields(array($id_issue, $note, $save_button));
     $container = new TTable();
     $container->addRow()->addCell($this->form);
     // add the form to the page
     parent::add($container);
 }
コード例 #23
0
 /**
  * Class constructor
  */
 function __construct()
 {
     parent::__construct();
     // creates the form and a inner table
     $this->form = new TForm('form_pdf_report');
     $table = new TTable();
     $this->form->add($table);
     // creates an action button
     $save_button = new TButton('generate');
     $save_button->setAction(new TAction(array($this, 'onGenerate')), 'Generate');
     $save_button->setImage('ico_save.png');
     // add a row for the form action
     $table->addRowSet($save_button);
     // define wich are the form fields
     $this->form->setFields(array($save_button));
     // wrap the page content using vertical box
     $vbox = new TVBox();
     $vbox->add(new TXMLBreadCrumb('menu.xml', __CLASS__));
     $vbox->add($this->form);
     parent::add($vbox);
 }
コード例 #24
0
 /**
  * Class constructor
  * Creates the page
  */
 function __construct()
 {
     parent::__construct();
     // create the form using TQuickForm class
     $this->form = new TForm();
     $this->form->class = 'tform';
     $this->form->style = 'width:500px';
     $table = new TTable();
     $table->width = '100%';
     $this->form->add($table);
     $table->addRowSet(new TLabel('Title'), '')->class = 'tformtitle';
     // create the form fields
     $id = new TEntry('id');
     $description = new TEntry('description');
     $input = new TEntry('input');
     $subfield1 = new TEntry('subfield1');
     $subfield2 = new TEntry('subfield2');
     $expander = new TExpander('Click here to see!');
     $expander->setButtonProperty('class', 'btn btn-info btn-sm');
     $subtable = new TTable();
     $subtable->style = 'padding:5px';
     $expander->add($subtable);
     $subtable->addRowSet(new TLabel('Subfield1'), $subfield1);
     $subtable->addRowSet(new TLabel('Subfield2'), $subfield2);
     // add the fields inside the form
     $table->addRowSet(new TLabel('Id'), $id);
     $table->addRowSet(new TLabel('Description'), $description);
     $table->addRowSet(new TLabel('Another fields'), $expander);
     $table->addRowSet(new TLabel('Input'), $input);
     $button = new TButton('save');
     $button->setAction(new TAction(array($this, 'onSave')), 'Save');
     $button->setImage('ico_save.png');
     $table->addRowSet($button, '')->class = 'tformaction';
     $this->form->setFields(array($id, $description, $input, $subfield1, $subfield2, $button));
     // wrap the page content using vertical box
     $vbox = new TVBox();
     $vbox->add(new TXMLBreadCrumb('menu.xml', __CLASS__));
     $vbox->add($this->form);
     parent::add($vbox);
 }
コード例 #25
0
 /**
  * método construtor
  * Cria a página e o formulário de cadastro
  */
 function __construct()
 {
     parent::__construct();
     $table = new TTable();
     $table->width = '100%';
     // creates the form
     $this->form = new TForm('form_login');
     $this->form->class = 'tform';
     $this->form->style = 'margin:auto;width: 350px';
     // add the notebook inside the form
     $this->form->add($table);
     $langs = array();
     $langs['pt'] = 'Portugues';
     $langs['en'] = 'English';
     // cria os campos do formulário
     $user = new TEntry('user');
     $pass = new TPassword('password');
     $lang = new TCombo('language');
     $lang->addItems($langs);
     $lang->setValue(TSession::getValue('language'));
     // add a row for the field login
     $row = $table->addRow();
     $cell = $row->addCell(new TLabel('Login'));
     $cell->colspan = 2;
     $row->class = 'tformtitle';
     $table->addRowSet(new TLabel(_t('Login') . ': '), $user);
     $table->addRowSet(new TLabel(_t('Password') . ': '), $pass);
     $table->addRowSet(new TLabel(_t('Language') . ': '), $lang);
     // cria um botão de ação (salvar)
     $save_button = new TButton('login');
     // define a ação do botão
     $save_button->setAction(new TAction(array($this, 'onLogin')), _t('Login'));
     $save_button->setImage('ico_apply.png');
     $row = $table->addRowSet($save_button, '');
     $row->class = 'tformaction';
     // define quais são os campos do formulário
     $this->form->setFields(array($user, $pass, $lang, $save_button));
     // add the form to the page
     parent::add($this->form);
 }
コード例 #26
0
 /**
  * Constructor method
  */
 public function __construct()
 {
     parent::__construct('serach_box');
     $this->form = new TForm('search_box');
     $table = new TTable();
     $table->style = 'float:right';
     $row = $table->addRow();
     $input = new TMultiSearch('input');
     $input->setSize(240, 28);
     $input->addItems($this->getPrograms());
     $input->setMinLength(1);
     $input->setMaxSize(1);
     $button = new TButton('search');
     $button->style = 'margin-top:0px; height:30px;';
     $button->setImage('bs:search green');
     $button->setAction(new TAction(array($this, 'loadProgram')));
     $this->form->setFields(array($input, $button));
     $row->addCell($input);
     $row->addCell($button);
     $this->form->add($table);
     parent::add($this->form);
 }
コード例 #27
0
 /**
  * Class constructor
  * Creates the page, the form and the listing
  */
 public function __construct()
 {
     parent::__construct();
     // creates the form
     $this->form = new TForm('form_search_Product');
     // creates a DataGrid
     $this->datagrid = new TDataGrid();
     $this->datagrid->setHeight(320);
     $table = new TTable();
     $table->addRow()->addCell($this->datagrid);
     // define the button action
     $this->saveAction = new TAction(array($this, 'onSave'));
     // add the save button
     $save_button = new TButton('save');
     $save_button->setAction($this->saveAction, _t('Save'));
     $save_button->setImage('ico_save.png');
     $this->form->addField($save_button);
     $table->addRow()->addCell($save_button);
     // add the table inside the form
     $this->form->add($table);
     // add the columns to the DataGrid
     $this->datagrid->addColumn(new TDataGridColumn('id', 'ID', 'left', 40));
     $this->datagrid->addColumn(new TDataGridColumn('description', 'Description', 'left', 250));
     $this->datagrid->addColumn(new TDataGridColumn('unity', 'Unity', 'center', 50));
     $this->datagrid->addColumn(new TDataGridColumn('stock', 'Stock', 'right', 50));
     $this->datagrid->addColumn(new TDataGridColumn('sale_price_edit', 'Sale price', 'right', 140));
     // 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());
     // wrap the page content using vertical box
     $vbox = new TVBox();
     $vbox->add(new TXMLBreadCrumb('menu.xml', __CLASS__));
     $vbox->add($this->form);
     $vbox->add($this->pageNavigation);
     parent::add($vbox);
 }
コード例 #28
0
 /**
  * Class constructor
  * Creates the page, the form and the listing
  */
 public function __construct()
 {
     parent::__construct();
     // security check
     if (TSession::getValue('logged') !== TRUE) {
         throw new Exception(_t('Not logged'));
     }
     // security check
     TTransaction::open('library');
     if (User::newFromLogin(TSession::getValue('login'))->role->mnemonic !== 'LIBRARIAN') {
         throw new Exception(_t('Permission denied'));
     }
     TTransaction::close();
     // defines the database
     parent::setDatabase('library');
     // defines the active record
     parent::setActiveRecord('Publisher');
     // defines the filter field
     parent::setFilterField('name');
     // creates the form
     $this->form = new TForm('form_search_Publisher');
     $this->form->class = 'tform';
     $this->form->style = 'width: 600px';
     $table = new TTable();
     $table->width = '100%';
     $this->form->add($table);
     $table->addRowSet(new TLabel(_t('Publishers')), '')->class = 'tformtitle';
     // create the form fields
     $filter = new TEntry('name');
     $filter->setValue(TSession::getValue('Publisher_name'));
     // add a row for the filter field
     $row = $table->addRow();
     $row->addCell(new TLabel(_t('Name') . ': '));
     $row->addCell($filter);
     // create two action buttons to the form
     $find_button = new TButton('find');
     $new_button = new TButton('new');
     // define the button actions
     $find_button->setAction(new TAction(array($this, 'onSearch')), _t('Find'));
     $find_button->setImage('ico_find.png');
     $new_button->setAction(new TAction(array('PublisherForm', 'onEdit')), _t('New'));
     $new_button->setImage('ico_new.png');
     $buttons = new THBox();
     $buttons->add($find_button);
     $buttons->add($new_button);
     $row = $table->addRow();
     $row->class = 'tformaction';
     $cell = $row->addCell($buttons);
     $cell->colspan = 2;
     // define wich are the form fields
     $this->form->setFields(array($filter, $find_button, $new_button));
     // creates a DataGrid
     $this->datagrid = new TQuickGrid();
     $this->datagrid->setHeight(320);
     // creates the datagrid columns
     $this->datagrid->addQuickColumn('id', 'id', 'right', 100, new TAction(array($this, 'onReload')), array('order', 'id'));
     $this->datagrid->addQuickColumn('name', 'name', 'left', 440, new TAction(array($this, 'onReload')), array('order', 'name'));
     // add the actions to the datagrid
     $this->datagrid->addQuickAction(_t('Edit'), new TDataGridAction(array('PublisherForm', 'onEdit')), 'id', 'ico_edit.png');
     $this->datagrid->addQuickAction(_t('Delete'), new TDataGridAction(array($this, 'onDelete')), 'id', 'ico_delete.png');
     // 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());
     // creates the page structure using a vbox
     $container = new TVBox();
     $container->add($this->form);
     $container->add($this->datagrid);
     $container->add($this->pageNavigation);
     // add the vbox inside the page
     parent::add($container);
 }
コード例 #29
0
ファイル: ItemSeek.class.php プロジェクト: jhonleandres/crmbf
 /**
  * constructor method
  */
 public function __construct()
 {
     parent::__construct();
     // creates the form
     $this->form = new TForm('form_item_Seek');
     // creates the table
     $table = new TTable();
     // add the table inside the form
     $this->form->add($table);
     // create the form fields
     $barcode = new TEntry('barcode');
     // keep the session value
     $barcode->setValue(TSession::getValue('test_item_barcode'));
     // add the field inside the table
     $row = $table->addRow();
     $row->addCell(new TLabel(_t('Barcode')));
     $row->addCell($barcode);
     // create a find button
     $find_button = new TButton('search');
     // define the button action
     $find_button->setAction(new TAction(array($this, 'onSearch')), 'Search');
     $find_button->setImage('ico_find.png');
     // add a row for the find button
     $row = $table->addRow();
     $row->addCell($find_button);
     // define wich are the form fields
     $this->form->setFields(array($barcode, $find_button));
     // create the datagrid
     $this->datagrid = new TDataGrid();
     // create the datagrid columns
     $id = new TDataGridColumn('id', _t('Code'), 'right', 70);
     $barcode = new TDataGridColumn('barcode', _t('Barcode'), 'left', 100);
     $title = new TDataGridColumn('title', _t('Title'), 'left', 200);
     $order1 = new TAction(array($this, 'onReload'));
     $order2 = new TAction(array($this, 'onReload'));
     $order1->setParameter('order', 'id');
     $order2->setParameter('order', 'barcode');
     // define the column actions
     $id->setAction($order1);
     $barcode->setAction($order2);
     // add the columns inside the datagrid
     $this->datagrid->addColumn($id);
     $this->datagrid->addColumn($barcode);
     $this->datagrid->addColumn($title);
     // create one datagrid action
     $action1 = new TDataGridAction(array($this, 'onSelect'));
     $action1->setLabel('Selecionar');
     $action1->setImage('ico_apply.png');
     $action1->setField('barcode');
     // add the action to the datagrid
     $this->datagrid->addAction($action1);
     // create the datagrid model
     $this->datagrid->createModel();
     // create the page navigator
     $this->pageNavigation = new TPageNavigation();
     $this->pageNavigation->setAction(new TAction(array($this, 'onReload')));
     $this->pageNavigation->setWidth($this->datagrid->getWidth());
     // create a table for layout
     $table = new TTable();
     // create a row for the form
     $row = $table->addRow();
     $row->addCell($this->form);
     // create a row for the datagrid
     $row = $table->addRow();
     $row->addCell($this->datagrid);
     // create a row for the page navigator
     $row = $table->addRow();
     $row->addCell($this->pageNavigation);
     // add the table inside the page
     parent::add($table);
 }
コード例 #30
-1
 /**
  * Class constructor
  * Creates the page, the form and the listing
  */
 public function __construct()
 {
     parent::__construct();
     // defines the database
     parent::setDatabase('samples');
     // defines the active record
     parent::setActiveRecord('Project');
     // defines the filter field
     parent::setFilterField('name');
     // creates the form
     $this->form = new TForm('form_search_Project');
     // creates a table
     $table = new TTable();
     // add the table inside the form
     $this->form->add($table);
     // create the form fields
     $filter = new TEntry('name');
     $filter->setValue(TSession::getValue('Project_name'));
     // add a row for the filter field
     $table->addRowSet(new TLabel('name:'), $filter);
     // create two action buttons to the form
     $find_button = new TButton('find');
     $new_button = new TButton('new');
     $find_button->setAction(new TAction(array($this, 'onSearch')), _t('Find'));
     $find_button->setImage('ico_find.png');
     $new_button->setAction(new TAction(array('ProjectFormView', 'onEdit')), _t('New'));
     $new_button->setImage('ico_new.png');
     // add a row for the form actions
     $table->addRowSet($find_button, $new_button);
     // define wich are the form fields
     $this->form->setFields(array($filter, $find_button, $new_button));
     // creates a DataGrid
     $this->datagrid = new TQuickGrid();
     $this->datagrid->setHeight(320);
     // creates the datagrid columns
     $id = $this->datagrid->addQuickColumn('ID', 'id', 'left', 50);
     $name = $this->datagrid->addQuickColumn('Name', 'name', 'left', 190);
     $start = $this->datagrid->addQuickColumn('Start', 'start_date', 'left', 80);
     $end = $this->datagrid->addQuickColumn('End', 'end_date', 'left', 80);
     $customer = $this->datagrid->addQuickColumn('customer', 'customer', 'left', 100);
     // add the actions to the datagrid
     $this->datagrid->addQuickAction(_t('Edit'), new TDataGridAction(array('ProjectFormView', 'onEdit')), 'id', 'ico_edit.png');
     $this->datagrid->addQuickAction(_t('Delete'), new TDataGridAction(array($this, 'onDelete')), 'id', 'ico_delete.png');
     $this->datagrid->addQuickAction(_t('Detail'), new TDataGridAction(array('BacklogFormView', 'onSetProject')), 'id');
     // 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());
     // pack the elements using a vertical box
     $vbox = new TVBox();
     $vbox->add(new TXMLBreadCrumb('menu.xml', __CLASS__));
     $vbox->add($this->form);
     $vbox->add($this->datagrid);
     $vbox->add($this->pageNavigation);
     // add the box inside the page
     parent::add($vbox);
 }