Esempio n. 1
0
 /**
  * Load a module.
  * @param string $module_name The name of the module
  * @param bool $site_call true, if the loaded module should display a site (only to set by cBootstrap)
  * @return SiteController An instance of the requested module
  */
 public function loadModule($module_name, $site_call = false)
 {
     // check if requested module is active
     if (!array_key_exists($module_name, $this->active_modules)) {
         Error::addError('<strong>Ihre Anfrage konnte leider nicht bearbeitet werden</strong><br/>Interner Fehler: Modul "' . $module_name . '" ist nicht aktiv. Bitte benachrichtigen Sie den Administrator!', true);
         return false;
     }
     // check if module exists
     if (!is_dir("modules/" . $module_name)) {
         Error::addError('<strong>Ihre Anfrage konnte leider nicht bearbeitet werden</strong><br/>Interner Fehler: Modul "' . $module_name . '" nicht vorhanden. Bitte benachrichtigen Sie den Administrator!', true);
         return false;
     }
     $class = $this->params["area"] == 'frontend' ? 'frontend' : 'backend';
     require_once 'classes/site_controller.class.php';
     $action = $site_call === true ? $this->params['action'] : '';
     $controller = SiteController::factory($class, $module_name, $action);
     return $controller;
 }