/** * Class constructor. * * @param Page $page Current page object. */ public function __construct($page) { $this->page = $page; $this->blocks = array(); $this->context = Context::instance('\\Innomedia\\Context'); // Check if a local template file exists. $tpl = $this->context->getGridsHome() . $this->page->getTheme() . '.local.tpl.php'; if (!file_exists($tpl)) { // Check if a predefined template file exists. $tpl = $this->context->getGridsHome() . $this->page->getTheme() . '.tpl.php'; if (!file_exists($tpl)) { // Check if a local default template file exists. $tpl = $this->context->getGridsHome() . 'default.local.tpl.php'; if (!file_exists($tpl)) { // Check if a default template file exists. $tpl = $this->context->getGridsHome() . 'default.tpl.php'; if (!file_exists($tpl)) { // No template file found, send error. $this->context->getResponse()->sendError(WebAppResponse::SC_INTERNAL_SERVER_ERROR, 'No theme grid found'); } } } } // Call the template constructor with the found template file. parent::__construct($tpl); // Set the blocks list in the template blocks variable. $this->setArray('blocks', $this->blocks); }