public function helloPage()
 {
     var_dump($this->request->getParams());
     $env = Nomad_Environment::getEnvironment();
     $this->view->os = $env->getOS();
     $this->view->browser = $env->getBrowser();
     Nomad_Session::getInstance()->display(Nomad_Session::getInstance());
 }
示例#2
0
 /**
  * function to get the instantiated environment object or
  * create a new one (singleton pattern)
  */
 public static function getEnvironment()
 {
     if (is_null(self::$_environment)) {
         $c = __CLASS__;
         self::$_environment = new $c();
     }
     return self::$_environment;
 }
示例#3
0
 /**
  * Sets up the application, contoller and view.
  * Passes the view object to the controller constructor.
  */
 private function __construct()
 {
     error_reporting(E_ALL);
     /**
      * Autoload: Register in SPL
      * if not found, continues to next loaders
      **/
     spl_autoload_register(function ($className) {
         $paths = array();
         if (stripos($className, 'nomad_') !== FALSE) {
             $nomadClassFilename = substr($className, 6);
             $paths[] = APPLICATION_ROOT . '/libraries/nomad/' . $nomadClassFilename . '.php';
             $paths[] = APPLICATION_ROOT . '/libraries/nomad/plugins/' . $nomadClassFilename . '.php';
             $paths[] = APPLICATION_ROOT . '/libraries/nomad/specialized_containers/' . $nomadClassFilename . '.php';
             $paths[] = APPLICATION_ROOT . '/libraries/nomad/traits/' . $nomadClassFilename . '.php';
         }
         preg_match("~^Nomad_Form_(.*)_Element\$~i", $className, $baseClassName);
         if (isset($baseClassName[1])) {
             $className = $baseClassName[1];
             $paths[] = APPLICATION_ROOT . '/libraries/nomad/form_elements/' . ucfirst($className) . '.php';
         }
         preg_match("~^Nomad_(.*)_Exception\$~i", $className, $baseClassName);
         if (isset($baseClassName[1])) {
             $className = $baseClassName[1];
             $paths[] = APPLICATION_ROOT . '/libraries/nomad/exceptions/' . ucfirst($className) . '.php';
         }
         if (stripos($className, 'nomad_validator_') !== FALSE) {
             $className = substr($className, 16);
             $paths[] = APPLICATION_ROOT . '/libraries/nomad/validators/' . ucfirst($className) . '.php';
         }
         if (stripos($className, 'nomad_filter_') !== FALSE) {
             $className = substr($className, 13);
             $paths[] = APPLICATION_ROOT . '/libraries/nomad/filters/' . ucfirst($className) . '.php';
         }
         $paths = array_merge($paths, array(APPLICATION_ROOT . '/libraries/' . $className . '.php', APPLICATION_ROOT . '/application/controllers/' . $className . '.php', APPLICATION_ROOT . '/application/models/' . $className . '.php', APPLICATION_ROOT . '/application/services/' . $className . '.php', APPLICATION_ROOT . '/application/forms/' . $className . '.php', APPLICATION_ROOT . '/application/plugins/' . $className . '.php', APPLICATION_ROOT . '/application/views/_themes/' . $className . '.php'));
         foreach ($paths as $path) {
             if (file_exists($path)) {
                 require $path;
                 break;
             }
         }
     });
     /**
      * process and setup routing and environment
      */
     $this->_route = new Nomad_Route();
     $this->_environment = Nomad_Environment::getEnvironment();
     /**
      * setup for the controller
      */
     $this->_controllerName = $this->_route->getControllerMethodName();
     $this->_pageName = $this->_route->getPage();
     $this->_controllerPath = strtolower($this->_route->getController());
     $viewPath = APPLICATION_ROOT . DS . 'application' . DS . 'views' . DS . $this->_controllerPath . DS . $this->_pageName . ".phtml";
     $this->view = new Nomad_View($viewPath);
     $this->view->setTitle(ucfirst($this->_pageName));
 }