Пример #1
0
 public static function checkPresencesByUsersId($params)
 {
     if (!isset($params) || !is_array($params)) {
         throw new EyeInvalidArgumentException('Missing or invalid $params');
     }
     if (!isset($params['usersId']) || !is_array($params['usersId'])) {
         throw new EyeInvalidArgumentException('Missing or invalid $params[\'usersId\']');
     }
     if (isset($params['timeInterval']) && !is_int($params['timeInterval'])) {
         throw new EyeInvalidArgumentException('Invalid $params[\'timeInterval\']');
     }
     if (isset($params['timeInterval'])) {
         $timeInterval = $params['timeInterval'];
         $presenceManager = new PresenceManager();
         return $presenceManager->checkPresencesByUsersId($params['usersId'], $timeInterval);
     } else {
         $presenceManager = new PresenceManager();
         return $presenceManager->checkPresencesByUsersId($params['usersId']);
     }
 }
Пример #2
0
 /**
  * Request a Membership of a user
  *
  * @param <String> $params The id of the contact to request the relationship
  */
 public static function requestRelationship($params)
 {
     $peopleController = PeopleController::getInstance();
     $myProcManager = ProcManager::getInstance();
     $currentUserId = $myProcManager->getCurrentProcess()->getLoginContext()->getEyeosUser()->getId();
     $newContact = $peopleController->addNewContact($currentUserId, $params);
     $contactId = $newContact->getRelation()->getTargetId();
     $lists = array();
     $listsName = array();
     $otherUser = UMManager::getInstance()->getUserById($contactId);
     $metaObject = MetaManager::getInstance()->retrieveMeta($otherUser);
     if ($metaObject == null) {
         $meta = array();
     } else {
         $meta = $metaObject->getAll();
     }
     $presenceManager = new PresenceManager();
     $connected = $presenceManager->checkPresenceByUserId($params);
     $results = array('id' => $params, 'nickname' => $otherUser->getName(), 'state' => 'pending', 'lists' => $lists, 'listsName' => $listsName, 'meta' => $meta, 'relationDate' => $newContact->getRelation()->getLastModification(), 'connected' => $connected);
     return $results;
 }