Lançado Adianti Framework 7.6!
Clique aqui para saber mais
menu

Adianti Solutions

API

Adianti, Framework, PHP, MVC, Active record, Front controller, IDE, RAD, Web, multiplataforma, geração de código, desenvolvimento rápido, relatórios, formulários, listagens, datagrids, gráficos, banco de dados, padrões de projeto, design patterns API do Adianti Framework.
API Docs
code
Selecione a classe

Source for file TQuickNotebookForm.php

Documentation is available at TQuickNotebookForm.php

  1. <?php
  2. namespace Adianti\Widget\Wrapper;
  3.  
  4. use Adianti\Widget\Wrapper\TQuickForm;
  5. use Adianti\Widget\Container\TTable;
  6. use Adianti\Widget\Container\TNotebook;
  7. use Adianti\Widget\Container\TVBox;
  8. use Adianti\Widget\Base\TElement;
  9. use Adianti\Control\TAction;
  10.  
  11. /**
  12.  * Create quick forms with a notebook wrapper
  13.  *
  14.  * @version    7.4
  15.  * @package    widget
  16.  * @subpackage wrapper
  17.  * @author     Pablo Dall'Oglio
  18.  * @copyright  Copyright (c) 2006 Adianti Solutions Ltd. (http://www.adianti.com.br)
  19.  * @license    http://www.adianti.com.br/framework-license
  20.  */
  21. {
  22.     protected $notebook;
  23.     protected $table;
  24.     protected $vertical_box;
  25.     
  26.     /**
  27.      * Class Constructor
  28.      * @param $name Form Name
  29.      */
  30.     public function __construct($name 'my_form')
  31.     {
  32.         parent::__construct($name);
  33.         
  34.         $this->vertical_box = new TVBox;
  35.         $this->vertical_box->{'style''width: 100%';
  36.         $this->notebook = new TNotebook;
  37.         $this->hasAction = FALSE;
  38.         
  39.         $this->fieldsByRow = 1;
  40.     }
  41.     
  42.     /**
  43.      * Set the notebook wrapper
  44.      * @param $notebook Notebook wrapper
  45.      */
  46.     public function setNotebookWrapper($notebook)
  47.     {
  48.         $this->notebook $notebook;
  49.     }
  50.     
  51.     /**
  52.      * Add a form title
  53.      * @param $title     Form title
  54.      */
  55.     public function setFormTitle($title)
  56.     {
  57.         parent::setFormTitle($title);
  58.         $this->vertical_box->add($this->table);
  59.     }
  60.     
  61.     /**
  62.      * Append a notebook page
  63.      * @param $title     Page title
  64.      * @param $cotnainer Page container
  65.      */
  66.     public function appendPage($title$container NULL)
  67.     {
  68.         if (empty($container))
  69.         {
  70.             $container new TTable;
  71.             $container->{'width''100%';
  72.         }
  73.         
  74.         if ($this->notebook->getPageCount(== 0)
  75.         {
  76.             $this->vertical_box->add($this->notebook);
  77.         }
  78.         
  79.         $this->table $container;
  80.         $this->notebook->appendPage($title$this->table);
  81.         $this->fieldPositions 0;
  82.     }
  83.     
  84.     /**
  85.      * Add a form action
  86.      * @param $label  Action Label
  87.      * @param $action TAction Object
  88.      * @param $icon   Action Icon
  89.      */
  90.     public function addQuickAction($labelTAction $action$icon 'fa:save')
  91.     {
  92.         $this->table new TTable;
  93.         $this->table->{'width''100%';
  94.         $this->vertical_box->add($this->table);
  95.         
  96.         parent::addQuickAction($label$action$icon);
  97.     }
  98.     
  99.     /**
  100.      * Show the component
  101.      */
  102.     public function show()
  103.     {
  104.         $this->notebook->{'style''margin:10px';
  105.         
  106.         // add the table to the form
  107.         parent::pack($this->vertical_box);
  108.         parent::show();
  109.     }
  110. }