/** * Fill the properties of the event * * @param <AbstractEventNotification> $event */ public function autoFill(AbstractEventNotification $event) { if (($event->getEventData() === null || !is_string($event->getEventData())) && ($event->getReceiver() === null || !is_string($event->getReceiver()))) { throw new EyeInvalidArgumentException('Missing or invalid eventData property'); } if ($event->getEventData() === null) { $event->setEventData($event->getSender()); } $event->setMessageInformation(array('User %s shared a file with you.', array(PeopleEventHandler::retrieveContactName($event->getSender())))); $event->setIsQuestion(false); }
/** * Handle the answer provided by the user and execute the relative action * * @param AbstractEventNotification $event */ public function handleAnswer(AbstractEventNotification $event) { if ($event->getAnswer() === null || !is_string($event->getAnswer())) { throw new EyeInvalidArgumentException('Missing or invalid answer property'); } switch ($event->getAnswer()) { case 'Confirm': try { $eventData = $event->getEventData(); $assignation = UMManager::getInstance()->getNewUserWorkgroupAssignationInstance(); $assignation->setUserId($eventData['userId']); $assignation->setWorkgroupId($eventData['groupId']); $assignation->setRole(WorkgroupConstants::ROLE_VIEWER); $assignation->setStatus(WorkgroupConstants::STATUS_MEMBER); UMManager::getInstance()->updateUserWorkgroupAssignation($assignation); } catch (Exception $e) { //FIXME Need real control of error } break; case 'Cancel': try { $eventData = $event->getEventData(); $assignation = UMManager::getInstance()->getNewUserWorkgroupAssignationInstance(); $assignation->setUserId($eventData['userId']); $assignation->setWorkgroupId($eventData['groupId']); UMManager::getInstance()->unregisterUserWorkgroupAssignation($assignation); } catch (Exception $e) { //FIXME Need real control of error } break; default: throw new EyeInvalidArgumentException('The answer to this events is not correct'); } }
public function updateEventNotification(AbstractEventNotification $event) { try { $event->setEventData(serialize($event->getEventData())); $this->dao->update($event->getEventInformation()); } catch (Exception $e) { throw new EyeDAOException('Unable to update the event information', 0, $e); } }
/** * Fill the properties of the event * * @param <AbstractEventNotification> $event */ public function autoFill(AbstractEventNotification $event) { $eventData = $event->getEventData(); if (!isset($eventData) || !is_string($eventData)) { throw new EyeInvalidArgumentException('Missing or invalid $eventData[\'listId\']'); } $wGroupName = $eventData; $event->setMessageInformation(array('The Group %s was deleted.', array($wGroupName))); $event->setIsQuestion(false); }
/** * Execute the action relative an event with the answer provided by the user * * @param map $params => array { * 'id' => String * 'answer' => String * } */ public function handleAnswer(AbstractEventNotification $event) { if ($event->getType() === null) { throw new EyeInvalidArgumentException('Missing or invalid type property'); } if ($event->getAnswer() === null) { throw new EyeInvalidArgumentException('Missing or invalid answer property'); } list($category, $type) = explode('_', $event->getType(), 2); $eventHanlderClass = $type . 'Event'; $eventHandler = new $eventHanlderClass(); $eventHandler->handleAnswer($event); }
/** * 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['listId']) || !is_int($eventData['listId'])) { throw new EyeInvalidArgumentException('Missing or invalid $eventData[\'listId\']'); } if (!isset($eventData['listName']) || !is_string($eventData['listName'])) { throw new EyeInvalidArgumentException('Missing or invalid $eventData[\'listName\']'); } $listName = $eventData['listName']; $event->setMessageInformation(array('The list %s was deleted from People', array($listName))); $event->setIsQuestion(false); }
/** * Fill the properties of the event * * @param <AbstractEventNotification> $event */ public function autoFill(AbstractEventNotification $event) { if ($event->getEventData() === null) { throw new EyeInvalidArgumentException('Missing or invalid eventData property'); } $eventData = $event->getEventData(); if (!isset($eventData['oldListName']) || !is_string($eventData['oldListName'])) { throw new EyeInvalidArgumentException('Missing or invalid $eventData[\'oldListName\']'); } if (!isset($eventData['newListName']) || !is_string($eventData['newListName'])) { throw new EyeInvalidArgumentException('Missing or invalid $eventData[\'newListName\']'); } $oldName = $eventData['oldListName']; $newName = $eventData['newListName']; $event->setMessageInformation(array('New name for %s list is %s.', array($oldName, $newName))); $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['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 || !is_string($event->getEventData())) { // If the event was fired by the user itself, set the eventData field if ($event->getReceiver() == ProcManager::getInstance()->getCurrentProcess()->getLoginContext()->getEyeosUser()->getId()) { $event->setEventData($event->getReceiver()); } else { throw new EyeInvalidArgumentException('Missing or invalid $eventData'); } } $userId = $event->getEventData(); if ($userId == ProcManager::getInstance()->getCurrentProcess()->getLoginContext()->getEyeosUser()->getId()) { $event->setMessageInformation('Your profile was updated'); } else { $username = PeopleEventHandler::retrieveContactName($userId); $event->setMessageInformation(array('User %s update his/her profile', array($username))); } $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'])) { throw new EyeInvalidArgumentException('Missing or invalid $eventData[\'usersId\']'); } if (!isset($eventData['listId']) || !is_int($eventData['listId'])) { throw new EyeInvalidArgumentException('Missing or invalid $eventData[\'listId\']'); } $userIds = $eventData['usersId']; $listName = PeopleEventHandler::getListName($eventData['listId']); if (!is_array($userIds)) { $username = PeopleEventHandler::retrieveContactName($userIds); $event->setMessageInformation(array('User %s was added in %s list.', array($username, $listName))); } else { $usernames = array(); foreach ($userIds as $userId) { $usernames[] = PeopleEventHandler::retrieveContactName($userId); } $usernamesString = implode(', ', $usernames); $event->setMessageInformation(array('Users %s were added in %s list.', array($usernamesString, $listName))); } $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); }
/** * Handle the answer provided by the user and execute the relative action * * @param AbstractEventNotification $event */ public function handleAnswer(AbstractEventNotification $event) { if ($event->getAnswer() === null || !is_string($event->getAnswer())) { throw new EyeInvalidArgumentException('Missing or invalid answer property'); } $peopleController = PeopleController::getInstance(); switch ($event->getAnswer()) { case 'Confirm': try { //Action for add the contact $myProcManager = ProcManager::getInstance(); $currentUser = $myProcManager->getCurrentProcess()->getLoginContext()->getEyeosUser(); $peopleController = PeopleController::getInstance(); $peopleController->confirmContact($currentUser, $user = UMManager::getInstance()->getUserById($event->getSender())); //Send message to the BUS $message = new ClientBusMessage('events', 'confirmContact', $event->getSender()); ClientMessageBusController::getInstance()->queueMessage($message); } catch (Exception $e) { //FIXME There should be real control on exception } break; case 'Cancel': try { //Action for delete the contact $contact = $peopleController->getContact($event->getReceiver(), $event->getSender()); $peopleController->removeContact($contact); //Send message to the bus $message = new ClientBusMessage('events', 'deleteContact', $event->getSender()); ClientMessageBusController::getInstance()->queueMessage($message); } catch (Exception $e) { //FIXME There should be real control on exception } break; default: throw new EyeInvalidArgumentException('The answer to this events is not correct'); } }
/** * 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'); } $username = PeopleEventHandler::retrieveContactName($event->getEventData()); $event->setMessageInformation(array('%s has been added to your eyeOS Network. He/she must confirm you', array($username))); $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'); } $username = PeopleEventHandler::retrieveContactName($event->getEventData()); $event->setMessageInformation(array('The request for friendship for user %s was canceled by you.', array($username))); $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'); } $username = PeopleEventHandler::retrieveContactName($event->getEventData()); $event->setMessageInformation(array('User %s was deleted from your People', array($username))); $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'); } $wGroupName = $event->getEventData(); $event->setMessageInformation(array('The Group %s was created.', array($wGroupName))); $event->setIsQuestion(false); }
/** * Fill the properties of the event * * @param <AbstractEventNotification> $event */ public function autoFill(AbstractEventNotification $event) { if ($event->getEventData() === null || !is_int($event->getEventData())) { throw new EyeInvalidArgumentException('Missing or invalid eventData property'); } $listId = $event->getEventData(); $listName = PeopleEventHandler::getListName($listId); $event->setMessageInformation(array('The list %s was created in People', array($listName))); $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); }
/** * 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); }
public function __construct() { parent::__construct(); }
/** * Fill the properties of the event * * @param <AbstractEventNotification> $event */ public function autoFill(AbstractEventNotification $event) { if (($event->getEventData() === null || !is_string($event->getEventData())) && ($event->getReceiver() === null || !is_string($event->getReceiver()))) { throw new EyeInvalidArgumentException('Missing or invalid eventData property'); } if ($event->getEventData() === null) { $event->setEventData($event->getSender()); } $username = PeopleEventHandler::retrieveContactName($event->getEventData()); $event->setMessageInformation(array('%s accepted you and is now in your eyeOS Network', array($username))); $event->setIsQuestion(false); }