Ejemplo n.º 1
0
 /**
  * @static
  * @param DefaultController|null $pController
  * @param null $pAction
  * @param string $pTemplate
  * @return void
  */
 public static function execute($pController = null, $pAction = null, $pTemplate = "")
 {
     if ($pController != "statique") {
         $pController->setTemplate(self::$controller, self::$action, $pTemplate);
     }
     if ($pAction != null) {
         $pController->{$pAction}();
     }
     if (!Core::$request_async) {
         Header::content_type("text/html");
         $pController->render();
         if (Core::debug()) {
             Debugger::render();
         }
     } else {
         $return = $pController->getGlobalVars();
         $return = array_merge($return, Debugger::getGlobalVars());
         if (isset($_POST) && isset($_POST["render"]) && $_POST["render"] != "false") {
             $return["html"] = $pController->render(false);
         }
         $response = SimpleJSON::encode($return);
         $type = "json";
         self::performResponse($response, $type);
     }
 }
 /**
  * @param bool $pDisplay
  * @return string
  */
 public function render($pDisplay = true)
 {
     $this->addContent("actions", $this->actions->toArray());
     $this->addContent('menu_items', $this->menu->retrieveItems());
     return parent::render($pDisplay);
 }