/** * Returns whether this is the main view. * * The main view is the view directly returned to the Application controller. It is important to * know if a <code>View</code> is a main view so it knows whether it should for example * implement pagination. In order to determine the main view, we test if we have are in the main * module by comparing the module name of our controller to the module name of the app's page. * If we are inside the main module, we use the <code>Controller::getFirstLoadedView()</code> * method to return the view first loaded for this module. The main view is the first view * loaded by this controller/module. * * @return boolean whether this is the main view */ protected function isMain() { if ($this->controller->getApp()->getPage()->getModule() === $this->module) { $main = $this->controller->getFirstLoadedView(); if ($main[0] === $this->format && $main[1] === $this->name) { return true; } } return false; }
/** * Returns a view for the format of this task. * * @param string $name the name of the view * @return View the view * @throws ClassNotFoundException if the view could not be loaded */ public function getView($name) { return $this->controller->getView($this->format, $name); }
/** * Returns another model from the same module by name. * * This method calls the controller to load the model. * * @param string $name the name of the model * @return Model the loaded model */ protected function getModel($name) { return $this->controller->getModel($name); }