/**
  * Smarty {staticFunction} function plugin
  *
  * Type:     function<br>
  * Name:     staticFunction<br>
  * Purpose:  show the static content associed with the code
  * @param Smarty
  * @return string|null
  */
 function staticContentFunction($params, $smarty)
 {
     $code = $params['code'];
     if ($code == '') {
         throw new \Exception("<b>Form: Attribut 'code' obligatoire pour le plugin {staticFunction}</b>");
     }
     if (array_key_exists('class', $params)) {
         $class = $params['class'];
     } else {
         $class = "staticContent";
     }
     if (array_key_exists('titleClass', $params)) {
         $titleClass = $params['titleClass'];
     } else {
         $titleClass = "staticContentTitle";
     }
     $service = \org\equinox\ioc\ContainerFactory::getExported('staticContentService');
     $userService = \org\equinox\ioc\ContainerFactory::getExported('userService');
     $request = \org\equinox\ioc\ContainerFactory::getBean('request');
     $sc = $service->get($code);
     $html = '<div class="' . $class . '">';
     if ($userService->checkRight('CONTENT_EDIT')) {
         $index = $_SERVER["SCRIPT_NAME"];
         $base = $request->base;
         $html .= '<div class="adminTopRight"><a href="' . $index . '/staticContent/sc/edit/id/' . $code . '" id="link"><img src="' . $base . '/images/document_edit.png" title="Editer" border="0"></a></div>';
     }
     if ($sc == null) {
         $html .= 'Static content not found in database';
     } else {
         $html .= $sc->body;
     }
     $html .= '</div>';
     return $html;
 }
 /**
  *
  * @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;
 }