Example #1
0
 public function callCommand($commandName, $namespaceName, $params)
 {
     $extension = ExtensionMaster::getInstance()->getExtensionForNamespace($namespaceName);
     $ajaxRequestObject = new AjaxRequestObject();
     $ajaxRequestObject->setNamespace($namespaceName);
     $ajaxRequestObject->setCommand($commandName);
     $ajaxRequestObject->setElementId("");
     $ajaxRequestObject->setRequestType("internal");
     $ajaxRequestObject->setParams($params);
     $command = $extension->getCommand($ajaxRequestObject->getCommand());
     $command->validateData($ajaxRequestObject);
     $command->processData($ajaxRequestObject);
     return $command;
 }
Example #2
0
 public function handleRequest($path)
 {
     //***********AJAX Handling*************
     // Is current request is an AJAX-Request, don't generate template code
     if (self::isAjaxRequest()) {
         $app = lms_portal::get_instance();
         $app->initialize(GUEST_NOT_ALLOWED);
         $frontController = new FrontController();
         //$request = new HttpRequest();
         //$response = new HttpResponse();
         $ajaxRequestObject = new AjaxRequestObject();
         if (isset($_REQUEST["namespace"]) && $_REQUEST["namespace"] != "") {
             $ajaxRequestObject->setNamespace($_REQUEST["namespace"]);
         } else {
             $ajaxRequestObject->setNamespace($path[0]);
         }
         $ajaxRequestObject->setCommand(isset($_REQUEST["command"]) ? $_REQUEST["command"] : "");
         $ajaxRequestObject->setElementId(isset($_REQUEST["elementId"]) ? $_REQUEST["elementId"] : "");
         $ajaxRequestObject->setRequestType(isset($_REQUEST["requestType"]) ? $_REQUEST["requestType"] : "");
         $params = $_REQUEST;
         unset($params["command"]);
         unset($params["elementId"]);
         unset($params["requestType"]);
         $ajaxRequestObject->setParams($params);
         $ajaxResponseObject = new AjaxResponseObject();
         // Handle request by calling command with frontcontroller
         $result = $frontController->handleRequest($ajaxRequestObject, $ajaxResponseObject);
         exit;
     }
     //**************************************
 }