WidgetTabs.php 815 Bytes
<?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();
    }

}