/** * Fill the properties of the event * * @param <AbstractEventNotification> $event */ public function autoFill(AbstractEventNotification $event) { if ($event->getEventData() === null) { throw new EyeInvalidArgumentException('You must specify the eventData property'); } $eventData = $event->getEventData(); if (!isset($eventData['userId']) || !is_string($eventData['userId'])) { throw new EyeInvalidArgumentException('Missing or invalid $eventData[\'userId\']'); } if (!isset($eventData['groupId']) || !is_string($eventData['groupId'])) { throw new EyeInvalidArgumentException('Missing or invalid $eventData[\'groupId\']'); } $userId = $eventData['userId']; $username = GroupsEventHandler::retrieveContactName($userId); $wGroupId = $eventData['groupId']; $wGroupName = GroupsEventHandler::retrieveWorkgroupName($wGroupId); //Event sent to the owner of the group if ($event->getReceiver() !== $userId) { $event->setMessageInformation(array('User %s was banned from %s group.', array($username, $wGroupName))); } else { //Event sent to the banned user $event->setMessageInformation(array('You were banned from %s group.', array($wGroupName))); } $event->setIsQuestion(false); }
/** * Fill the properties of the event * * @param <AbstractEventNotification> $event */ public function autoFill(AbstractEventNotification $event) { if ($event->getEventData() === null) { throw new EyeInvalidArgumentException('You must specify the eventData property'); } $eventData = $event->getEventData(); if (!isset($eventData['usersId']) || !is_string($eventData['usersId']) && !is_int($eventData['usersId'])) { throw new EyeInvalidArgumentException('Missing or invalid $eventData[\'usersId\']'); } if (!isset($eventData['groupId']) || !is_string($eventData['groupId'])) { throw new EyeInvalidArgumentException('Missing or invalid $eventData[\'groupId\']'); } $userIds = $eventData['usersId']; $wGroupId = $eventData['groupId']; $wGroupName = GroupsEventHandler::retrieveWorkgroupName($wGroupId); if (!is_array($userIds)) { $username = GroupsEventHandler::retrieveContactName($userIds); $event->setMessageInformation(array('User %s was invited in %s group.', array($username, $wGroupName))); } else { $usernames = array(); foreach ($userIds as $userId) { $usernames[] = GroupsEventHandler::retrieveContactName($userId); } $usernamesString = implode(', ', $usernames); $event->setMessageInformation(array('Users %s were invited in %s group', array($usernamesString, $wGroupName))); } $event->setIsQuestion(false); }
/** * Fill the properties of the event * * @param <AbstractEventNotification> $event */ public function autoFill(AbstractEventNotification $event) { if ($event->getEventData() === null || !is_string($event->getEventData())) { throw new EyeInvalidArgumentException('Missing or invalid eventData property'); } $wGroupId = $event->getEventData(); $wGroupName = GroupsEventHandler::retrieveWorkgroupName($wGroupId); $username = GroupsEventHandler::retrieveContactName($event->getReceiver()); $event->setMessageInformation(array('You request the membership for the group %s.', array($wGroupName))); $event->setIsQuestion(false); }
/** * Fill the properties of the event * * @param <AbstractEventNotification> $event */ public function autoFill(AbstractEventNotification $event) { if ($event->getEventData() === null || !is_string($event->getEventData())) { throw new EyeInvalidArgumentException('Missing or invalid $eventData'); } $wGroupId = $event->getEventData(); $wGroupName = GroupsEventHandler::retrieveWorkgroupName($wGroupId); //Event sent to the owner of the group $event->setMessageInformation(array('You were accepted in the group %s.', array($wGroupName))); $event->setIsQuestion(false); }
public function workgroupBeforeDeletion(UMEvent $e) { if ($e->getSource() instanceof AbstractEyeosWorkgroup) { $workgroupId = $e->getSource()->getId(); $filter = UMManager::getInstance()->getNewUserWorkgroupAssignationInstance(); $filter->setWorkgroupId($workgroupId); //We need to save the members of a wgroup before we remove it (for send notification Event later) $members = UMManager::getInstance()->getAllUserWorkgroupAssignations($filter); $membersId = array(); foreach ($members as $member) { $membersId[] = $member->getUserId(); } self::$workgroupMembers[$workgroupId] = array('members' => $membersId, 'name' => GroupsEventHandler::retrieveWorkgroupName($workgroupId)); } }
/** * Fill the properties of the event * * @param <AbstractEventNotification> $event */ public function autoFill(AbstractEventNotification $event) { if ($event->getEventData() === null) { throw new EyeInvalidArgumentException('You must specify the eventData property'); } $eventData = $event->getEventData(); if (!isset($eventData['groupId']) || !is_string($eventData['groupId'])) { throw new EyeInvalidArgumentException('Missing or invalid $eventData[\'groupId\']'); } $wGroupId = $eventData['groupId']; $wGroupName = GroupsEventHandler::retrieveWorkgroupName($wGroupId); $username = GroupsEventHandler::retrieveContactName($event->getSender()); $event->setMessageInformation(array('User %s invited you in %s group.', array($username, $wGroupName))); $event->setIsQuestion(true); $event->setQuestion('Do you want to confirm?'); $event->setAvailableAnswers('Confirm#Cancel'); }
/** * Fill the properties of the event * * @param <AbstractEventNotification> $event */ public function autoFill(AbstractEventNotification $event) { if ($event->getEventData() === null) { throw new EyeInvalidArgumentException('You must specify the eventData property'); } $eventData = $event->getEventData(); if (!isset($eventData['userId']) || !is_string($eventData['userId'])) { throw new EyeInvalidArgumentException('Missing or invalid $eventData[\'userId\']'); } if (!isset($eventData['groupId']) || !is_string($eventData['groupId'])) { throw new EyeInvalidArgumentException('Missing or invalid $eventData[\'groupId\']'); } $userId = $eventData['userId']; $wGroupId = $eventData['groupId']; $wGroupName = GroupsEventHandler::retrieveWorkgroupName($wGroupId); if ($userId == $event->getReceiver()) { $event->setMessageInformation(array('You now are a memberof the group %s.', array($wGroupName))); } else { $userName = GroupsEventHandler::retrieveContactName($userId); $event->setMessageInformation(array('User %s is now member of your group %s.', array($userName, $wGroupName))); } $event->setIsQuestion(false); }