Ejemplo n.º 1
0
 /**
  * 
  */
 public function makeTLabel($properties)
 {
     $widget = new TLabel((string) $properties->{'name'});
     $widget->setValue((string) $properties->{'value'});
     $widget->setFontColor((string) $properties->{'color'});
     $widget->setFontSize((string) $properties->{'size'});
     $widget->setFontStyle((string) $properties->{'style'});
     $this->fieldsByName[(string) $properties->{'name'}] = $widget;
     return $widget;
 }
 function onStep3()
 {
     $this->onStep2();
     try {
         $data = $this->form->getData();
         $this->form->validate();
         $page2 = new TTable();
         $this->notebook->appendPage($data->field4, $page2);
         $field5 = new TLabel('field5');
         $field5->setValue(str_replace('"field', '<br>"field ', json_encode($this->form->getData())));
         // add a row for one field
         $row = $page2->addRow();
         $row->addCell(new TLabel('Form data:'));
         $cell = $row->addCell($field5);
         $this->notebook->setCurrentPage(2);
         $this->form->setData($data);
     } catch (Exception $e) {
         new TMessage('error', $e->getMessage());
     }
 }
 /**
  * Class constructor
  * Creates the page
  */
 function __construct()
 {
     parent::__construct();
     // creates a panel
     $panel = new TPanel(480, 260);
     if (PHP_SAPI !== 'cli') {
         $panel->style = "background-image: url(app/images/background.png);";
     }
     // creates a label with the title
     $titulo = new TLabel('Panel Layout');
     $titulo->setFontSize(18);
     $titulo->setFontFace('Arial');
     $titulo->setFontColor('red');
     // put the title label in the panel
     $panel->put($titulo, 120, 4);
     $imagem = new TImage('app/images/mouse.png');
     // put the image in the panel
     $panel->put($imagem, 260, 140);
     // create the input widgets
     $id = new TEntry('id');
     $name = new TEntry('name');
     $address = new TEntry('address');
     $telephone = new TEntry('telephone');
     $city = new TCombo('city');
     $items = array();
     $items['1'] = 'Porto Alegre';
     $items['2'] = 'Lajeado';
     // add the options to the combo
     $city->addItems($items);
     // adjust the size of the fields
     $id->setSize(70);
     $name->setSize(140);
     $address->setSize(140);
     $telephone->setSize(140);
     $city->setSize(140);
     // create the labels
     $label1 = new TLabel('Code');
     $label2 = new TLabel('Name');
     $label3 = new TLabel('City');
     $label4 = new TLabel('Address');
     $label5 = new TLabel('Telephone');
     // put the widgets in the panel
     $panel->put($label1, 10, 40);
     $panel->put($id, 10, 60);
     $panel->put($label2, 30, 90);
     $panel->put($name, 40, 110);
     $panel->put($label3, 100, 140);
     $panel->put($city, 100, 160);
     $panel->put($label4, 230, 40);
     $panel->put($address, 230, 60);
     $panel->put($label5, 200, 90);
     $panel->put($telephone, 200, 110);
     if (PHP_SAPI !== 'cli') {
         $label6 = new TLabel('Obs');
         $label6->setFontStyle('b');
         $label6->setValue('PS: The panel background is just for understanding purposes.');
         $panel->put($label6, 2, 237);
     }
     // wrap the page content using vertical box
     $vbox = new TVBox();
     $vbox->add(new TXMLBreadCrumb('menu.xml', __CLASS__));
     $vbox->add($panel);
     parent::add($vbox);
 }
 /**
  * Class constructor
  * Creates the page
  */
 function __construct()
 {
     parent::__construct();
     // creates a table
     $table = new TTable();
     // creates a label with the title
     $title = new TLabel('Table Layout');
     $title->setFontSize(18);
     $title->setFontFace('Arial');
     $title->setFontColor('red');
     // adds a row to the table
     $row = $table->addRow();
     $title = $row->addCell($title);
     $title->colspan = 2;
     // creates two sub-tables
     $table1 = new TTable();
     $table2 = new TTable();
     $table->border = '1';
     $table->cellpadding = '4';
     $table->style = 'border-collapse:collapse;';
     $table1->border = '1';
     $table1->cellpadding = '2';
     $table1->style = 'border-collapse:collapse; border-color: red';
     $table2->border = '1';
     $table2->cellpadding = '2';
     $table2->style = 'border-collapse:collapse; border-color: blue';
     // creates a series of input widgets
     $id = new TEntry('id');
     $name = new TEntry('name');
     $address = new TEntry('address');
     $telephone = new TEntry('telephone');
     $city = new TCombo('city');
     $text = new TText('text');
     $items = array();
     $items['1'] = 'Porto Alegre';
     $items['2'] = 'Lajeado';
     $city->addItems($items);
     // adjust the size of the fields
     $id->setSize(70);
     $name->setSize(140);
     $address->setSize(140);
     $telephone->setSize(140);
     $city->setSize(140);
     $text->setSize(400, 100);
     // creates a series of labels
     $label1 = new TLabel('Code');
     $label2 = new TLabel('Name');
     $label3 = new TLabel('City');
     $label4 = new TLabel('Address');
     $label5 = new TLabel('Telephone');
     // adds a row for the code field
     $row = $table1->addRow();
     $row->addCell($label1);
     $row->addCell($id);
     // adds a row for the name field
     $row = $table1->addRow();
     $row->addCell($label2);
     $row->addCell($name);
     // adds a row for the city field
     $row = $table1->addRow();
     $row->addCell($label3);
     $row->addCell($city);
     // adds a row for the address field
     $row = $table2->addRow();
     $row->addCell($label4);
     $row->addCell($address);
     // adds a row for the phone field
     $row = $table2->addRow();
     $row->addCell($label5);
     $row->addCell($telephone);
     // adds the tables side by side
     $row = $table->addRow();
     $row->addCell($table1);
     $row->addCell($table2);
     $row = $table->addRow();
     $cell = $row->addCell($text);
     $cell->colspan = 2;
     $label6 = new TLabel('Obs');
     $label6->setFontStyle('b');
     $label6->setValue('PS: The table borders are just for understanding purposes.');
     $row = $table->addRow();
     $cell = $row->addCell($label6);
     $cell->colspan = 2;
     // wrap the page content using vertical box
     $vbox = new TVBox();
     $vbox->add(new TXMLBreadCrumb('menu.xml', __CLASS__));
     $vbox->add($table);
     parent::add($vbox);
 }