Beispiel #1
0
 /**
  * @param void $params
  */
 public static function getApplicationsList($params)
 {
     $return = array();
     $appManager = new EyeosApplicationsManager();
     $apps = $appManager->getAllApplications();
     foreach ($apps as $app) {
         $meta = $app->getMeta();
         $sysParams = $meta->get('eyeos.application.systemParameters');
         if ($sysParams['listable'] === 'true') {
             $return[] = $app->getName();
         }
     }
     sort($return);
     return $return;
 }
 public static function getInstance()
 {
     if (self::$Instance === null) {
         $thisClass = __CLASS__;
         self::$Instance = new $thisClass();
     }
     return self::$Instance;
 }
Beispiel #3
0
 public static function __run(AppExecutionContext $context, MMapResponse $response)
 {
     $currentUser = $context->getProcess()->getLoginContext()->getEyeosUser();
     $groups = UMManager::getInstance()->getAllGroupsByPrincipal($currentUser);
     $isAdmin = 0;
     if ($currentUser->getPrimaryGroupId() == 'eyeID_EyeosGroup_root' || $currentUser->getPrimaryGroupId() == 'eyeID_EyeosGroup_admin') {
         $isAdmin = 1;
     } else {
         foreach ($groups as $group) {
             if ($group->getId() == 'eyeID_EyeosGroup_admin') {
                 $isAdmin = 1;
             }
         }
     }
     $context->getArgs()->offsetSet(0, $isAdmin);
     //get the applications
     $myApplicationsManager = new EyeosApplicationsManager();
     $applications = $myApplicationsManager->getAllApplications();
     $return = array();
     foreach ($applications as $appDesc) {
         $appMeta = $appDesc->getMeta();
         $systemParameters = $appMeta->get('eyeos.application.systemParameters');
         $currentApplicationGroup = 'eyeID_EyeosGroup_' . $systemParameters['group'];
         $currentUserGroup = ProcManager::getInstance()->getCurrentProcess()->getLoginContext()->getEyeosUser()->getPrimaryGroupId();
         if ($currentUserGroup == 'eyeID_EyeosGroup_users' && $currentApplicationGroup == 'eyeID_EyeosGroup_users' || $currentUserGroup != 'eyeID_EyeosGroup_users') {
             $sysParams = $appMeta->get('eyeos.application.systemParameters');
             $imagePath = $appMeta->get('eyeos.application.iconUrl');
             $imageIsValid = true;
             $imagePath = str_replace('48x48', '22x22', $imagePath);
             $imagePath = str_replace('64x64', '22x22', $imagePath);
             try {
                 $file = FSI::getFile($imagePath);
             } catch (Exception $e) {
                 $imageIsValid = false;
             }
             if ($imageIsValid && !$file->isReadable()) {
                 $imageIsValid = false;
             }
             if (!$imageIsValid) {
                 $imagePath = 'sys:///extern/images/22x22/apps/preferences-desktop-default-applications.png';
             }
             $return[] = array('name' => $appDesc->getName(), 'displayName' => $appMeta->get('eyeos.application.name') !== null ? $appMeta->get('eyeos.application.name') : $appDesc->getName(), 'app' => $appDesc->getName(), 'shortDescription' => $appMeta->get('eyeos.application.description'), 'image' => FSI::toExternalUrl($imagePath), 'favorite' => $myApplicationsManager->isApplicationFavorite($appDesc) ? 1 : 0, 'lists' => $appMeta->get('eyeos.application.category'), 'listable' => $sysParams['listable'] == 'true' ? 1 : 0);
         }
     }
     $context->getArgs()->offsetSet(1, $return);
 }
 /**
  * 
  * @return [
  * 		{
  * 			name: ...,
  * 			javascriptOnly: "true"/"false",
  * 			meta: {Map}
  * 		},
  * 		...
  * ]
  */
 public static function getAllInstalledApplications()
 {
     $myApplicationsManager = new EyeosApplicationsManager();
     $applications = $myApplicationsManager->getAllInstalledApplications();
     $return = array();
     foreach ($applications as $appDesc) {
         $jsonAppDesc = self::toArray($appDesc);
         // Translate icon URL to enable caching
         if (isset($jsonAppDesc['meta']['eyeos.application.iconUrl'])) {
             $extUrl = FSI::toExternalUrl($jsonAppDesc['meta']['eyeos.application.iconUrl']);
             if ($extUrl) {
                 $jsonAppDesc['meta']['eyeos.application.iconUrl'] = $extUrl;
             }
         }
         $sysParams = $jsonAppDesc['meta']['eyeos.application.systemParameters'];
         if ($sysParams['listable'] == 'true') {
             $return[] = $jsonAppDesc;
         }
     }
     return $return;
 }
Beispiel #5
0
 public static function addInstalled($params)
 {
     $myApplicationsManager = new EyeosApplicationsManager();
     $myApplicationsManager->setInstalledApplication(new EyeosApplicationDescriptor($params), true);
 }