_currentTab !== null) { throw new CException('Close current tab before open new one.'); } if (!isset($id)) $id = '_yw_tab_' . self::$_counter++; $this->_currentTab = array( 'id' => $id, 'label' => $label, ); ob_start(); } public function endTab() { if ($this->_currentTab === null) { throw new CException('Before close tab you must open it.'); } $this->_currentTab['content'] = ob_get_clean(); if ($this->_dropDown !== null) { $this->_dropDown['items'][] = $this->_currentTab; } else { $this->_currentTab['type'] = 'tab'; $this->_output[] = $this->_currentTab; } $this->_currentTab = null; } protected $_dropDown = null; public function beginDropDown($label) { if ($this->_dropDown !== null) { throw new CException('Close current DropDown before open new one.'); } $this->_dropDown = array( 'type' => 'dropDown', 'label' => $label, 'items' => array(), ); } public function endDropDown() { if ($this->_dropDown === null) { throw new CException('Before close DropDown you need to open it.'); } $this->_output[] = $this->_dropDown; $this->_dropDown = null; } public function run() { parent::run(); // render tabs echo '
'; //render content echo '