Blame view

protected/modules/admin/components/widgets/WidgetTabs.php 815 Bytes
a1684257   Administrator   first commit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
  <?php
  /**
   * Widget to render nested widgets in tabs
   */
  class WidgetTabs extends CWidget
  {
  
      /**
       * Each element in configuration for corresponding tab, it should be an dictionary with following keys
       * label - tab label
       * className - widget class for tab
       * properties - widget configuration
       * @var array
       */
      public $tabs = array();
  
      public function init()
      {
      }
  
      public function run()
      {
          /**
           * @var BTabs $tabs
           */
          $tabs = $this->getController()->beginWidget('BTabs');
          foreach ($this->tabs as $tab) {
              $tabs->beginTab($tab['label']);
              $this->getController()->widget($tab['className'], $tab['properties']);
              $tabs->endTab();
          }
          $this->getController()->endWidget();
      }
  
  }