/** * 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 the app. * * @return App the app */ public function getApp() { return $this->controller->getApp(); }