/**
  * Method onHelp
  * Shows the source code for this sample, along with an explanation
  */
 function onHelp($param)
 {
     if (isset($param['classname']) and $param['classname']) {
         $folder = 'app/control';
         $classname = $param['classname'];
         foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($folder), RecursiveIteratorIterator::SELF_FIRST) as $entry) {
             if (is_dir($entry)) {
                 if (file_exists("{$entry}/{$classname}.class.php")) {
                     $resource = str_replace('app/control', 'app/resources', "{$entry}/{$classname}.txt");
                     if (file_exists($resource)) {
                         $this->label->setValue(file_get_contents($resource));
                     } else {
                         $this->label->setValue('This is the source-code for this sample.');
                     }
                     $this->source->loadFile("{$entry}/{$classname}.class.php");
                     parent::setTitle("{$entry}/{$classname}.class.php");
                     return;
                 }
             }
         }
     } else {
         $this->source->loadFile('index.web.php');
         parent::setTitle('index.web.php');
     }
 }
 /**
  * Class constructor
  * Creates the page
  */
 function __construct()
 {
     parent::__construct();
     parent::setTitle('New Window');
     parent::setSize(800, 400);
     parent::add(new TLabel('Another Window'));
 }
 /**
  * Class constructor
  * Creates the page
  */
 function __construct()
 {
     parent::__construct();
     parent::setTitle('New Window');
     parent::setSize(600, 370);
     parent::setPosition(100, 100);
     // create the form using TQuickForm class
     $this->form = new TQuickForm();
     // create the notebook
     $notebook = new TNotebook(530, 260);
     // adds the notebook page
     $notebook->appendPage('Quick form component', $this->form);
     // create the form fields
     $id = new TEntry('id');
     $description = new TEntry('description');
     $date = new TDate('date');
     $text = new TText('text');
     // add the fields inside the form
     $this->form->addQuickField('Id', $id, 40);
     $this->form->addQuickField('Description', $description, 200);
     $this->form->addQuickField('Date', $date, 100);
     $this->form->addQuickField('Text', $text, 120);
     // define the form action
     $this->form->addQuickAction('Save', new TAction(array($this, 'onSave')), 'ico_save.png');
     // add the form inside the page
     parent::add($notebook);
 }
 /**
  * Class constructor
  * Creates the page
  */
 function __construct()
 {
     parent::__construct();
     parent::setTitle('Detail Window');
     parent::setSize(400, 300);
     $this->label = new TLabel('');
     $this->label->setFontColor('#FF0000');
     $this->label->setFontSize(12);
     // add the form inside the page
     parent::add($this->label);
 }
Example #5
0
 /**
  * Class constructor
  * Creates the page, the search form and the listing
  */
 public function __construct()
 {
     parent::__construct();
     parent::setSize(600, 400);
     parent::setTitle('Search record');
     new TSession();
     // creates the form
     $this->form = new TQuickForm('form_search_city');
     // create the form fields
     $name = new TEntry('name');
     $name->setValue(TSession::getValue('city_name'));
     // add the form fields
     $this->form->addQuickField('name', $name, 200);
     // define the form action
     $this->form->addQuickAction('Find', new TAction(array($this, 'onSearch')), 'ico_find.png');
     // creates a DataGrid
     $this->datagrid = new TQuickGrid();
     $this->datagrid->setHeight(230);
     // creates the datagrid columns
     $this->datagrid->addQuickColumn('Id', 'id', 'right', 40);
     $this->datagrid->addQuickColumn('Name', 'name', 'left', 340);
     // creates two datagrid actions
     $this->datagrid->addQuickAction('Select', new TDataGridAction(array($this, 'onSelect')), 'id', 'ico_apply.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 table
     $table = new TTable();
     $table->addRow()->addCell($this->form);
     $table->addRow()->addCell($this->datagrid);
     $table->addRow()->addCell($this->pageNavigation);
     // add the table inside the page
     parent::add($table);
 }
 /**
  * constructor method
  */
 public function __construct()
 {
     parent::__construct();
     parent::setSize(TSession::getValue('width'), TSession::getValue('height'));
     parent::setTitle(TSession::getValue('titulo'));
     new TSession();
     // creates the form
     $this->form = new TForm('formSeekStandart');
     // creates the table
     $table = new TTable();
     // add the table inside the form
     $this->form->add($table);
     // create the form fields
     $name = new TEntry('name');
     // keep the session value
     $name->setValue(TSession::getValue('name'));
     // add the field inside the table
     $row = $table->addRow();
     $row->addCell(new TLabel($this->getFiltro() . ' :'));
     $row->addCell($name);
     // 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($name, $find_button));
     // create the datagrid
     $this->datagrid = new TDataGrid();
     $i = 1;
     // create the datagrid columns
     if (TSession::getValue('campos')) {
         foreach (TSession::getValue('campos') as $field => $label) {
             $campos[] = new TDataGridColumn($field, $label, 'right', 200);
         }
         foreach ($campos as $campo) {
             // add the columns inside the datagrid
             $this->datagrid->addColumn($campo);
         }
     }
     // create one datagrid action
     $action1 = new TDataGridAction(array($this, 'onSelect'));
     $action1->setLabel('Selecionar');
     $action1->setImage('ico_apply.png');
     $action1->setField(TSession::getValue('key'));
     // 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);
 }
Example #7
0
 /**
  * Class constructor
  * Creates the page and the registration form
  */
 public function __construct()
 {
     parent::__construct();
     parent::setSize(640, 350);
     parent::setTitle('Event');
     // creates the form
     $this->form = new TForm('form_Event');
     $this->form->class = 'tform';
     // CSS class
     $this->form->style = 'width: 600px';
     // 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('Event'))->colspan = 2;
     $hours = array();
     $durations = array();
     for ($n = 0; $n < 24; $n++) {
         $hours[$n] = "{$n}:00";
         $durations[$n + 1] = $n + 1 . ' h';
     }
     array_pop($durations);
     // create the form fields
     $id = new TEntry('id');
     $event_date = new TDate('event_date');
     $start_hour = new TCombo('start_hour');
     $duration = new TCombo('duration');
     $title = new TEntry('title');
     $description = new TText('description');
     $start_hour->addItems($hours);
     $duration->addItems($durations);
     $id->setEditable(FALSE);
     // define the sizes
     $id->setSize(40);
     $event_date->setSize(100);
     $start_hour->setSize(100);
     $duration->setSize(100);
     $title->setSize(400);
     $description->setSize(400, 50);
     // add one row for each form field
     $table->addRowSet(new TLabel('ID:'), $id);
     $table->addRowSet(new TLabel('Event Date:'), $event_date);
     $table->addRowSet(new TLabel('Start Hour:'), $start_hour);
     $table->addRowSet(new TLabel('Duration:'), $duration);
     $table->addRowSet(new TLabel('Title:'), $title);
     $table->addRowSet(new TLabel('Description:'), $description);
     // 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('Clear'));
     $new_button->setImage('ico_new.png');
     $this->form->setFields(array($id, $event_date, $start_hour, $duration, $title, $description, $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);
 }
 /**
  * constructor method
  */
 public function __construct()
 {
     parent::__construct();
     parent::setTitle('Busca de Pessoas');
     parent::setSize(800, 600);
     new TSession();
     // creates the form
     $this->form = new TForm('form_city_Pessoa');
     // creates the table
     $table = new TTable();
     // add the table inside the form
     $this->form->add($table);
     // create the form fields
     $name = new TEntry('pessoa_nome');
     // keep the session value
     $name->setValue(TSession::getValue('test_pessoa_name'));
     // add the field inside the table
     $row = $table->addRow();
     $row->addCell(new TLabel('Nome:'));
     $row->addCell($name);
     // 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($name, $find_button));
     // create the datagrid
     $this->datagrid = new TDataGrid();
     // create the datagrid columns
     $id = new TDataGridColumn('pessoa_codigo', 'Id', 'right', 25);
     $name = new TDataGridColumn('pessoa_nome', 'Nome', 'left', 250);
     $origem = new TDataGridColumn('origem_nome', 'Origem', 'left', 330);
     $order1 = new TAction(array($this, 'onReload'));
     $order2 = new TAction(array($this, 'onReload'));
     $order1->setParameter('order', 'pessoa_codigo');
     $order2->setParameter('order', 'pessoa_nome');
     // define the column actions
     $id->setAction($order1);
     $name->setAction($order2);
     // add the columns inside the datagrid
     $this->datagrid->addColumn($id);
     $this->datagrid->addColumn($name);
     $this->datagrid->addColumn($origem);
     // create one datagrid action
     $action1 = new TDataGridAction(array($this, 'onSelect'));
     $action1->setLabel('Selecionar');
     $action1->setImage('fa:check-circle-o green');
     $action1->setField('pessoa_codigo');
     // 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);
     $table->style = 'width: 100%;max-width: 1200px;';
     $this->datagrid->style = '  width: 100%;  max-width: 1200px;';
     // add the table inside the page
     parent::add($table);
 }
 /**
  * constructor method
  */
 public function __construct()
 {
     parent::__construct();
     parent::setTitle('Search record');
     new TSession();
     // creates the form
     $this->form = new TForm('form_city_Seek');
     // creates the table
     $table = new TTable();
     // add the table inside the form
     $this->form->add($table);
     // create the form fields
     $name = new TEntry('name');
     // keep the session value
     $name->setValue(TSession::getValue('test_city_name'));
     // add the field inside the table
     $row = $table->addRow();
     $row->addCell(new TLabel('Name:'));
     $row->addCell($name);
     // 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($name, $find_button));
     // create the datagrid
     $this->datagrid = new TDataGrid();
     // create the datagrid columns
     $id = new TDataGridColumn('id', 'Id', 'right', 70);
     $name = new TDataGridColumn('name', 'Name', 'left', 220);
     $state = new TDataGridColumn('state', 'Estado', 'left', 80);
     $order1 = new TAction(array($this, 'onReload'));
     $order2 = new TAction(array($this, 'onReload'));
     $order1->setParameter('order', 'id');
     $order2->setParameter('order', 'name');
     // define the column actions
     $id->setAction($order1);
     $name->setAction($order2);
     // add the columns inside the datagrid
     $this->datagrid->addColumn($id);
     $this->datagrid->addColumn($name);
     $this->datagrid->addColumn($state);
     // create one datagrid action
     $action1 = new TDataGridAction(array($this, 'onSelect'));
     $action1->setLabel('Selecionar');
     $action1->setImage('ico_apply.png');
     $action1->setField('id');
     // 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);
 }