public function processRequest(MMapRequest $request, MMapResponse $response)
 {
     ob_start('mb_output_handler');
     MMapManager::startSession();
     //check if the session has expired
     MMapManager::checkSessionExpiration();
     $return = null;
     $dataManager = DataManager::getInstance();
     // restore current process using checknum
     $myProcManager = ProcManager::getInstance();
     $myProcess = $myProcManager->getProcessByChecknum($request->getGET('checknum'));
     $myProcManager->setCurrentProcess($myProcess);
     $appDesc = new EyeMobileApplicationDescriptor($myProcess->getName());
     $POST = $request->getPOST();
     $params = array();
     if (isset($POST['params'])) {
         $params = $dataManager->doInput($POST['params']);
     } else {
         if ($request->issetGET('params')) {
             $params = $request->getGET('params');
         }
     }
     $methodName = $request->getGET('message');
     // calling an ExecModule
     if (strpos($methodName, '__') === 0) {
         $moduleName = explode('_', substr($methodName, 2));
         $methodName = $moduleName[1];
         //ex: "FileChooser"
         $moduleName = $moduleName[0];
         //ex: "browsePath"
         $return = call_user_func_array(array($appDesc->getApplicationClassName(), '__callModule'), array($moduleName, $methodName, $params));
     } else {
         if ($appDesc->isJavascriptOnlyApplication()) {
             $return = call_user_func(array('EyeosJavascriptApplicationExecutable', $methodName), $params);
         } else {
             if (method_exists($appDesc->getApplicationClassName(), $methodName)) {
                 $return = call_user_func(array($appDesc->getApplicationClassName(), $methodName), $params);
             } else {
                 //If no function is present, call the NOT mobile function
                 MMapMsg::getInstance()->processRequest($request, $response);
                 return;
             }
             //				try {
             //					$return = call_user_func(array($appDesc->getApplicationClassName(), $methodName), $params);
             //				} catch (Exception $e) {
             //					//If no function is present, call the NOT mobile function
             //					MMapMsg::getInstance()->processRequest($request, $response);
             //					return;
             //				}
         }
     }
     if ($response->getBodyRenderer() === null && $response->getBody() == '') {
         $response->setBodyRenderer(new DataManagerBodyRenderer($return));
     }
 }
Exemple #2
0
 function getAllMobileApplications()
 {
     $directory = new DirectoryIterator(EYE_ROOT . '/' . APPS_DIR);
     $applications = array();
     foreach ($directory as $fileInfo) {
         $fileInfoName = $fileInfo->getFilename();
         $mobilePath = EYE_ROOT . '/' . APPS_DIR . '/' . $fileInfo->getFilename() . '/mobile';
         if ($fileInfo->isDir() && $fileInfoName[0] != '.' && is_dir($mobilePath)) {
             $appDesc = new EyeMobileApplicationDescriptor($fileInfoName);
             $appMeta = $appDesc->getMeta();
             $sysParams = $appMeta->get('eyeos.application.systemParameters');
             if ($sysParams['listable'] == 'true') {
                 $applications[] = array('name' => $appDesc->getName(), 'displayName' => $appMeta->get('eyeos.application.name') !== null ? $appMeta->get('eyeos.application.name') : $appDesc->getName(), 'description' => $appMeta->get('eyeos.application.description'), 'image' => FSI::toExternalUrl($appMeta->get('eyeos.application.iconUrl')));
             }
         }
     }
     return $applications;
 }