/**
  * get the instance, or null if no debug!
  * @return DebugBar
  */
 static function getInstance()
 {
     $ip = getenv("REMOTE_ADDR");
     //TraceDebugFactory::addDump($ip,'ip');
     // on n'authorize le debug que sur certaine IP, dans tous les cas !
     /*if ( (strpos($ip, '192.168.0') === 0 || $ip=='127.0.0.1' )){*/
     if (!DEBUG_ON) {
         return;
     }
     return \org\equinox\ioc\ContainerFactory::getBean('debugBar');
 }
 /**
  *
  * @param RequestDto $request
  * @return ResponseDto
  */
 public function handleRequest(RequestDto $request)
 {
     $serviceName = $request->serviceName;
     $methodName = $request->methodName;
     $service = \org\equinox\ioc\ContainerFactory::getExported($serviceName);
     if (!method_exists($service, $methodName)) {
         throw new Exception("Cannot find methode {$methodName} in service {$serviceName}");
     }
     $list = call_user_func_array(array($service, $methodName), $request->params);
     $response = new ResponseDto();
     $response->result = $list;
     return $response;
 }
 public function analyseAskedRequest()
 {
     \org\equinox\utils\debug\DebugBarFactory::add($this, 'Request', 'current');
     $this->processPost($_POST);
     if (array_key_exists('PATH_INFO', $_SERVER)) {
         $ar = @explode('/', $_SERVER["PATH_INFO"]);
     } else {
         $ar = array();
         // Then calling the root of the site eg : http://www.mysite.com, PATH_INFO is not defined
     }
     $size = sizeof($ar);
     if ($size > 0) {
         array_shift($ar);
         // first value is alway empty
         // \org\equinox\utils\debug\DebugBarFactory::add($ar, 'debug', 'params');
         $aliasRoute = @$ar[0];
         if (array_key_exists($aliasRoute, $this->aliasRoute)) {
             array_shift($ar);
             // we remove the alias route from the liste of parameters
             $route = $this->aliasRoute[$aliasRoute];
             $this->module = $route['module'];
             $this->controller = $route['controller'];
             $this->action = $route['action'];
             $this->processGetParams($ar);
         } elseif (sizeof($ar) >= 3) {
             $param1 = $ar[0];
             $param2 = $ar[1];
             $potentialControllerName = $param1 . '_' . $param2 . 'Controller';
             if (\org\equinox\ioc\ContainerFactory::hasBean($potentialControllerName)) {
                 $this->module = array_shift($ar);
                 $this->controller = array_shift($ar);
                 $this->action = array_shift($ar);
             } else {
                 \org\equinox\utils\debug\DebugBarFactory::add("Cannot find the controller '{$potentialControllerName}'", 'debug', 'Notice');
             }
             $this->processGetParams($ar);
         } else {
             $this->processGetParams($ar);
         }
     }
     // else we use the default value defined in the configurations files
     $this->index = $_SERVER["SCRIPT_NAME"];
     $this->base = trim(dirname($_SERVER["SCRIPT_NAME"]));
     if ($this->base == '/') {
         $this->base = '';
     }
     if ($this->base == '\\') {
         $this->base = '';
     }
 }
 public function storeForm($form)
 {
     $manager = \org\equinox\ioc\ContainerFactory::getBean('formManager');
     $manager->storeForm($form);
 }
 /**
  * Smarty {form} function plugin
  *
  * Type:     function<br>
  * Name:     form<br>
  * Purpose:  genere a form
  * @param Smarty
  * @return string|null
  */
 function formFunction($params, $smarty)
 {
     $definition = $params['definition'];
     if ($definition == '') {
         throw new \Exception("<b>Form: Attribut 'definition' obligatoire pour le plugin {form}</b>");
     }
     $generator = \org\equinox\ioc\ContainerFactory::getBean('formGenerator');
     return $generator->getHtml($definition);
 }