Example #1
0
 /**
  * Loads the page.
  */
 public function loadPage()
 {
     $this->translator->load(APPLICATION_PATH . '/modules/' . $this->request->getModuleName() . '/translations');
     if ($this->request->isAdmin()) {
         $this->translator->load(APPLICATION_PATH . '/modules/admin/translations');
     }
     $controller = $this->loadController();
     $controllerName = $this->request->getControllerName();
     $findSub = strpos($controllerName, '_');
     $dir = '';
     if ($findSub !== false) {
         $controllerParts = explode('_', $this->request->getControllerName());
         $controllerName = $controllerParts[1];
         $dir = ucfirst($controllerParts[0]) . '\\';
     }
     $this->plugin->addPluginData('controller', $controller);
     $this->plugin->execute('AfterControllerLoad');
     if ($this->request->isAdmin()) {
         $viewOutput = $this->view->loadScript(APPLICATION_PATH . '/modules/' . $this->request->getModuleName() . '/views/admin/' . $dir . $controllerName . '/' . $this->request->getActionName() . '.php');
     } else {
         $viewPath = APPLICATION_PATH . '/' . dirname($controller->getLayout()->getFile()) . '/views/modules/' . $this->request->getModuleName() . '/' . $dir . $controllerName . '/' . $this->request->getActionName() . '.php';
         if (!file_exists($viewPath)) {
             $viewPath = APPLICATION_PATH . '/modules/' . $this->request->getModuleName() . '/views/' . $dir . $controllerName . '/' . $this->request->getActionName() . '.php';
         }
         $viewOutput = $this->view->loadScript($viewPath);
     }
     if (!empty($viewOutput)) {
         $controller->getLayout()->setContent($viewOutput);
     }
     if ($this->request->isAjax()) {
         echo $viewOutput;
     } elseif ($controller->getLayout()->getDisabled() === false) {
         if ($controller->getLayout()->getFile() != '') {
             $this->layout->loadScript(APPLICATION_PATH . '/' . $controller->getLayout()->getFile() . '.php');
         }
     }
 }