static function render($viewName)
 {
     $viewName = str_replace('\\', DIRECTORY_SEPARATOR, $viewName);
     if (!self::exists($viewName)) {
         throw new ViewNotFoundException('View not found: ' . $viewName);
     }
     // Add some useful vars to the response
     $config = \ManiaLib\Application\Config::getInstance();
     $session = \ManiaLib\Application\Session::getInstance();
     $response = \ManiaLib\Application\Response::getInstance();
     $tracking = \ManiaLib\Application\Tracking\Config::getInstance();
     $response->login = $session->login;
     $response->mediaURL = $config->getMediaURL();
     $response->appURL = $config->getLinkCreationURL();
     $response->baseURL = $config->URL;
     $response->trackingAccount = $tracking->account;
     $vars = \ManiaLib\Application\Response::getInstance()->getAll();
     extract($vars);
     error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED);
     if (file_exists(MANIALIB_APP_PATH . 'resources/' . $viewName . '.php')) {
         require MANIALIB_APP_PATH . 'resources/' . $viewName . '.php';
     } else {
         require MANIALIB_APP_PATH . 'ressources/' . $viewName . '.php';
     }
     error_reporting(E_ALL & ~E_STRICT & ~E_DEPRECATED);
 }
Exemple #2
0
 function postFilter()
 {
     $response = \ManiaLib\Application\Response::getInstance();
     if ($this->account) {
         $trackingURL = $response->get('trackingURL');
         if ($trackingURL) {
             $trackingURL[] = $this->tracker->getTrackingURL();
             $response->trackingURL = $trackingURL;
         } else {
             $response->trackingURL = array($this->tracker->getTrackingURL());
         }
     }
     $response->registerView('\\ManiaLib\\Application\\Tracking\\View');
 }
 /**
  * Call the parent constructor when you override it in your filters!
  */
 function __construct()
 {
     $this->request = \ManiaLib\Application\Request::getInstance();
     $this->response = \ManiaLib\Application\Response::getInstance();
     $this->session = \ManiaLib\Application\Session::getInstance();
 }
Exemple #4
0
 /**
  * Creates a Manialink redirection to the previously registered referer, or
  * the index if no referer was previously registered
  */
 function redirectToReferer()
 {
     Response::getInstance()->redirect($this->getReferer());
 }
Exemple #5
0
 /**
  * If you want to do stuff at instanciation, override self::onConstruct()
  */
 protected function __construct($controllerName)
 {
     $this->controllerName = $controllerName;
     if (!$this->defaultAction) {
         $this->defaultAction = Config::getInstance()->defaultAction;
     }
     $this->request = \ManiaLib\Application\Request::getInstance();
     $this->response = \ManiaLib\Application\Response::getInstance();
     $this->session = \ManiaLib\Application\Session::getInstance();
     $this->onConstruct();
 }