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); $eventManager = new EventNotificationManager(); $from = 0; $to = 1000; $result = $eventManager->getAllQuestionEvents($from, $to); $result = self::toArray($result); $context->getArgs()->offsetSet(1, $result); }
/** * Return all non endend Events for this user * * @param <Integer> $params => array ( * from: Integer, * to: Integer * ) * @return array(array( * 'eventInformation' => ( * 'id' => id, * {...other eventInformation attributes...} * ) * )) */ public static function retrieveAllQuestionEvents($params) { $eventManager = new EventNotificationManager(); $from = 0; $to = 1000; if ($params !== null) { if (!isset($params['from']) || !is_int($params['from'])) { throw new EyeInvalidArgumentException('Invalid or Missing $params[\'from\']'); } else { $from = $params['from']; } if (!isset($params['to']) || !is_int($params['to'])) { throw new EyeInvalidArgumentException('Invalid or Missing $params[\'to\']'); } else { $to = $params['to']; } } $result = $eventManager->getAllQuestionEvents($from, $to); return self::toArray($result); }