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 BootstrapNotebookWrapper.php

Documentation is available at BootstrapNotebookWrapper.php

  1. <?php
  2. namespace Adianti\Wrapper;
  3. use Adianti\Widget\Container\TNotebook;
  4. use Adianti\Widget\Base\TElement;
  5.  
  6. /**
  7.  * Bootstrap datagrid decorator for Adianti Framework
  8.  *
  9.  * @version    7.4
  10.  * @package    wrapper
  11.  * @author     Pablo Dall'Oglio
  12.  * @copyright  Copyright (c) 2006 Adianti Solutions Ltd. (http://www.adianti.com.br)
  13.  * @license    http://www.adianti.com.br/framework-license
  14.  * @wrapper    TNotebook
  15.  */
  16. {
  17.     private $decorated;
  18.     private $properties;
  19.     private $direction;
  20.     private $divisions;
  21.     
  22.     /**
  23.      * Constructor method
  24.      */
  25.     public function __construct(TNotebook $notebook)
  26.     {
  27.         $this->decorated $notebook;
  28.         $this->properties array();
  29.         $this->direction '';
  30.         $this->divisions array(2,10);
  31.     }
  32.     
  33.     /**
  34.      * Redirect calls to decorated object
  35.      */
  36.     public function __call($method$parameters)
  37.     {
  38.         return call_user_func_array(array($this->decorated$method),$parameters);
  39.     }
  40.     
  41.     /**
  42.      * Redirect assigns to decorated object
  43.      */
  44.     public function __set($property$value)
  45.     {
  46.         $this->properties[$property$value;
  47.     }
  48.     
  49.     /**
  50.      * Set tabs direction
  51.      * @param $direction Tabs direction (left right)
  52.      */
  53.     public function setTabsDirection($direction$divisions null)
  54.     {
  55.         if ($direction)
  56.         {
  57.             $this->direction 'tabs-'.$direction;
  58.             if ($divisions)
  59.             {
  60.                 $this->divisions $divisions;
  61.             }
  62.         
  63.     }
  64.     
  65.     /**
  66.      * Shows the decorated datagrid
  67.      */
  68.     public function show()
  69.     {
  70.         $rendered $this->decorated->render();
  71.         $rendered->{'role''tabpanel';
  72.         unset($rendered->{'class'});
  73.         $rendered->{'class''tabwrapper';
  74.         
  75.         foreach ($this->properties as $property => $value)
  76.         {
  77.             $rendered->$property $value;
  78.         }
  79.         
  80.         $sessions $rendered->getChildren();
  81.         if ($sessions)
  82.         {
  83.             foreach ($sessions as $section)
  84.             {
  85.                 if ($section->{'class'== 'nav nav-tabs')
  86.                 {
  87.                     $section->{'class'"nav nav-tabs " $this->direction;
  88.                     if ($this->direction)
  89.                     {
  90.                         $section->{'class'.= " flex-column";
  91.  
  92.                     }
  93.                     $section->{'role'}  "tablist";
  94.                     $tabs $section;
  95.                 }
  96.                 if ($section->{'class'== 'spacer')
  97.                 {
  98.                     $section->{'style'"display:none";
  99.                 }
  100.                 if ($section->{'class'}  == 'frame tab-content')
  101.                 {
  102.                     $section->{'class''tab-content';
  103.                     $panel $section;
  104.                 }
  105.             }
  106.         }
  107.         
  108.         if ($this->direction == 'tabs-left')
  109.         {
  110.             $rendered->clearChildren();
  111.             $left_pack TElement::tag('div'''array('class'=> 'left-pack col-'.$this->divisions[0]'style' => 'padding:0'));
  112.             $right_pack TElement::tag('div'''array('class'=> 'right-pack col-'.$this->divisions[1]'style' => 'padding-right:0; margin-right:0'));
  113.             $rendered->add($left_pack);
  114.             $rendered->add($right_pack);
  115.             $left_pack->add($tabs);
  116.             $right_pack->add($panel);
  117.         }
  118.         else if ($this->direction == 'tabs-right')
  119.         {
  120.             $rendered->clearChildren();
  121.             $left_pack TElement::tag('div'''array('class'=> 'left-pack col-'.$this->divisions[1]));
  122.             $right_pack TElement::tag('div'''array('class'=> 'right-pack col-'.$this->divisions[0]));
  123.             $rendered->add($left_pack);
  124.             $rendered->add($right_pack);
  125.             $left_pack->add($panel);
  126.             $right_pack->add($tabs);
  127.         }
  128.         
  129.         if (!empty($this->direction))
  130.         {
  131.             $rendered->{'style'.= ';display: flex';
  132.         }
  133.  
  134.         $rendered->show();
  135.     }
  136. }