コード例 #1
0
 public function prepareView(\Nethgui\View\ViewInterface $view)
 {
     parent::prepareView($view);
     foreach ($this->getChildren() as $child) {
         $innerView = $view->spawnView($child, TRUE);
         $child->prepareView($innerView);
     }
 }
コード例 #2
0
 /**
  * Display all actions in a disabled state if current action is not defined,
  * otherwise display the current action only.
  * 
  * @param \Nethgui\View\ViewInterface $view
  */
 public function prepareView(\Nethgui\View\ViewInterface $view)
 {
     parent::prepareView($view);
     if (is_null($this->currentAction)) {
         // Prepare an unobstrusive view of each child. The first one is
         // shown to the user.
         $view->setTemplate(array($this, 'renderIndex'));
         foreach ($this->getChildren() as $childModule) {
             $innerView = $view->spawnView($childModule, TRUE);
             $childModule->prepareView($innerView);
         }
     } elseif ($this->currentAction instanceof \Nethgui\View\ViewableInterface) {
         $view->setTemplate(array($this, 'renderCurrentAction'));
         // Spawn and prepare the view for the current action:
         $innerView = $view->spawnView($this->currentAction, TRUE);
         $this->currentAction->prepareView($innerView);
         // Optimize next view for valid requests:
         if ($this->getRequest()->isValidated()) {
             $this->prepareNextViewOptimized($view);
         }
     }
 }