Prado\Web\UI\WebControls\TTabPanel::getActiveView PHP Method

getActiveView() public method

This method will examin the ActiveViewID, ActiveViewIndex and Views collection to determine which view is currently active. It will update ActiveViewID and ActiveViewIndex accordingly.
public getActiveView ( ) : TTabView
return TTabView the currently active view, null if no active view
    public function getActiveView()
    {
        $activeView = null;
        $views = $this->getViews();
        if (($id = $this->getActiveViewID()) !== '') {
            if (($index = $views->findIndexByID($id)) >= 0) {
                $activeView = $views->itemAt($index);
            } else {
                throw new TInvalidDataValueException('tabpanel_activeviewid_invalid', $id);
            }
        } else {
            if (($index = $this->getActiveViewIndex()) >= 0) {
                if ($index < $views->getCount()) {
                    $activeView = $views->itemAt($index);
                } else {
                    throw new TInvalidDataValueException('tabpanel_activeviewindex_invalid', $index);
                }
            } else {
                foreach ($views as $index => $view) {
                    if ($view->getActive()) {
                        $activeView = $view;
                        break;
                    }
                }
            }
        }
        if ($activeView !== null) {
            $this->activateView($activeView);
        }
        return $activeView;
    }