Esempio n. 1
0
 public static function getSettingList()
 {
     $eventConfigs = EVENT_BOL_EventService::getInstance()->getConfigs();
     $settingList = array();
     $settingList['events_count'] = array('presentation' => self::PRESENTATION_SELECT, 'label' => OW::getLanguage()->text('event', 'cmp_widget_events_count'), 'optionList' => $eventConfigs[EVENT_BOL_EventService::CONF_WIDGET_EVENTS_COUNT_OPTION_LIST], 'value' => $eventConfigs[EVENT_BOL_EventService::CONF_WIDGET_EVENTS_COUNT]);
     return $settingList;
 }
Esempio n. 2
0
 public function clearInvitations()
 {
     $list = EVENT_BOL_EventService::getInstance()->findCronExpiredEvents(0, 1500);
     if (!empty($list)) {
         /* @var $event EVENT_BOL_Event */
         foreach ($list as $event) {
             EVENT_BOL_EventService::getInstance()->clearEventInvitations($event->id);
         }
     }
 }
 public function onDelete(OW_Event $event)
 {
     $params = $event->getParams();
     if ($params["entityType"] != self::ENTITY_TYPE) {
         return;
     }
     foreach ($params["entityIds"] as $eventId) {
         $this->service->deleteEvent($eventId);
     }
 }
Esempio n. 4
0
 /**
  * @return Constructor.
  */
 public function __construct($eventId)
 {
     parent::__construct();
     $this->eventService = EVENT_BOL_EventService::getInstance();
     $event = $this->eventService->findEvent($eventId);
     if ($event === null) {
         $this->setVisible(false);
     }
     // event users info
     $this->addUserList($event, EVENT_BOL_EventService::USER_STATUS_YES);
     $this->addUserList($event, EVENT_BOL_EventService::USER_STATUS_MAYBE);
     $this->addUserList($event, EVENT_BOL_EventService::USER_STATUS_NO);
     $this->assign('userLists', $this->userLists);
     $this->addComponent('userListMenu', new BASE_CMP_WidgetMenu($this->userListMenu));
 }
Esempio n. 5
0
 public function __construct($eventId)
 {
     $count = 100;
     $friendList = null;
     if (OW::getEventManager()->call('plugin.friends')) {
         $count = 1000;
         $friendList = OW::getEventManager()->call('plugin.friends.get_friend_list', array('userId' => OW::getUser()->getId()));
         if (empty($friendList) || !is_array($friendList)) {
             $count = 100;
             $friendList = array();
         }
     }
     $idList = EVENT_BOL_EventService::getInstance()->findUserListForInvite((int) $eventId, 0, $count, $friendList);
     $this->setTemplate(OW::getPluginManager()->getPlugin('base')->getCmpViewDir() . 'avatar_user_list_select.html');
     parent::__construct($idList);
 }
Esempio n. 6
0
 public function getEventListCmp($eventIdList)
 {
     $configs = EVENT_BOL_EventService::getInstance()->getConfigs();
     $page = !empty($_GET['page']) && intval($_GET['page']) > 0 ? $_GET['page'] : 1;
     $events = EVENT_BOL_EventService::getInstance()->findByIdList($eventIdList);
     $cmp = new GOOGLELOCATION_CMP_Component();
     $cmp->setTemplate(OW::getPluginManager()->getPlugin('googlelocation')->getCmpViewDir() . 'event_list.html');
     $cmp->addComponent('paging', new BASE_CMP_Paging($page, ceil(count($eventIdList) / $configs[EVENT_BOL_EventService::CONF_EVENTS_COUNT_ON_PAGE]), 5));
     $cmp->assign('noButton', true);
     if (empty($events)) {
         $cmp->assign('no_events', true);
     }
     $toolbarList = array();
     $cmp->assign('page', $page);
     $cmp->assign('events', EVENT_BOL_EventService::getInstance()->getListingDataWithToolbar($events, $toolbarList));
     $cmp->assign('toolbarList', $toolbarList);
     return $cmp;
 }
Esempio n. 7
0
 /**
  * Responder for event invite form
  */
 public function inviteResponder()
 {
     $respondArray = array();
     if (empty($_POST['eventId']) || empty($_POST['userIdList']) || !OW::getUser()->isAuthenticated()) {
         $respondArray['messageType'] = 'error';
         $respondArray['message'] = '_ERROR_';
         echo json_encode($respondArray);
         exit;
     }
     $idList = json_decode($_POST['userIdList']);
     if (empty($_POST['eventId']) || empty($idList)) {
         $respondArray['messageType'] = 'error';
         $respondArray['message'] = '_EMPTY_EVENT_ID_';
         echo json_encode($respondArray);
         exit;
     }
     $event = $this->eventService->findEvent($_POST['eventId']);
     if ($event->getEndTimeStamp() < time()) {
         throw new Redirect404Exception();
     }
     if ($event === null) {
         $respondArray['messageType'] = 'error';
         $respondArray['message'] = '_EMPTY_EVENT_';
         echo json_encode($respondArray);
         exit;
     }
     if ((int) $event->getUserId() === OW::getUser()->getId() || (int) $event->getWhoCanInvite() === EVENT_BOL_EventService::CAN_INVITE_PARTICIPANT) {
         $count = 0;
         $userList = BOL_UserService::getInstance()->findUserListByIdList($idList);
         foreach ($userList as $user) {
             $userId = $user->id;
             $eventInvite = $this->eventService->findEventInvite($event->getId(), $userId);
             if ($eventInvite === null) {
                 $eventInvite = $this->eventService->inviteUser($event->getId(), $userId, OW::getUser()->getId());
                 $eventObj = new OW_Event('event.invite_user', array('userId' => $userId, 'inviterId' => OW::getUser()->getId(), 'eventId' => $event->getId(), 'imageId' => $event->getImage(), 'eventTitle' => $event->getTitle(), 'eventDesc' => $event->getDescription(), 'displayInvitation' => $eventInvite->displayInvitation));
                 OW::getEventManager()->trigger($eventObj);
                 $count++;
             }
         }
     }
     $respondArray['messageType'] = 'info';
     $respondArray['message'] = OW::getLanguage()->text('event', 'users_invite_success_message', array('count' => $count));
     exit(json_encode($respondArray));
 }
Esempio n. 8
0
 public function getService($pluginKey)
 {
     switch ($pluginKey) {
         case 'newsfeed':
             return NEWSFEED_BOL_Service::getInstance();
         case 'blogs':
             return PostService::getInstance();
         case 'groups':
             return GROUPS_BOL_Service::getInstance();
         case 'event':
             return EVENT_BOL_EventService::getInstance();
         case 'links':
             return LinkService::getInstance();
         case 'video':
             return VIDEO_BOL_ClipService::getInstance();
         case 'forum':
             return FORUM_BOL_ForumService::getInstance();
         case 'photo':
             return PHOTO_BOL_PhotoService::getInstance();
     }
 }
 public function collectSnippets(BASE_CLASS_EventCollector $event)
 {
     $language = OW::getLanguage();
     $params = $event->getParams();
     if ($params["entityType"] != SNIPPETS_CLASS_EventHandler::ENTITY_TYPE_USER) {
         return;
     }
     $userId = $params["entityId"];
     $preview = $params["preview"];
     $service = EVENT_BOL_EventService::getInstance();
     $snippet = new SNIPPETS_CMP_Snippet(self::SNIPPET_NAME, $userId);
     if ($preview) {
         $snippet->setLabel($language->text("snippets", "snippet_events_preview"));
         $snippet->setIconClass("ow_ic_calendar");
         $event->add($snippet);
         return;
     }
     // Privacy check
     $eventParams = array('action' => 'event_view_attend_events', 'ownerId' => $userId, 'viewerId' => OW::getUser()->getId());
     try {
         OW::getEventManager()->getInstance()->call('privacy_check_permission', $eventParams);
     } catch (RedirectException $exception) {
         return;
     }
     $list = $service->findUserParticipatedPublicEvents($userId, 1, 3);
     $total = $service->findUserParticipatedPublicEventsCount($userId);
     if (empty($list)) {
         return;
     }
     $images = array();
     foreach ($list as $eventItem) {
         $images[] = $eventItem->getImage() ? $service->generateImageUrl($eventItem->getImage(), true) : $service->generateDefaultImageUrl();
     }
     $url = OW::getRouter()->urlForRoute("event.view_event_list", array("list" => "user-participated-events"));
     $url = OW::getRequest()->buildUrlQueryString($url, array("userId" => $userId));
     $snippet->setImages($images);
     $snippet->setLabel($language->text("snippets", "snippet_events", array("count" => '<span class="ow_txt_value">' . $total . '</span>')));
     $snippet->setUrl($url);
     $event->add($snippet);
 }
Esempio n. 10
0
 public function countUpcomingEvents()
 {
     return EVENT_BOL_EventService::getInstance()->findPublicEventsCount();
 }
Esempio n. 11
0
 public function onCommand(OW_Event $event)
 {
     if (!OW::getUser()->isAuthenticated()) {
         return;
     }
     $params = $event->getParams();
     if (!in_array($params['command'], array('events.accept', 'events.ignore'))) {
         return;
     }
     $eventId = $params['data'];
     $eventDto = EVENT_BOL_EventService::getInstance()->findEvent($eventId);
     $userId = OW::getUser()->getId();
     $eventService = EVENT_BOL_EventService::getInstance();
     if (empty($eventDto)) {
         BOL_InvitationService::getInstance()->deleteInvitation(EVENT_CLASS_InvitationHandler::INVITATION_JOIN, $eventId, $userId);
         return;
     }
     $lang = OW::getLanguage();
     $result = array('result' => false);
     if ($params['command'] == 'events.accept') {
         $exit = false;
         $attendedStatus = 1;
         if ($eventService->canUserView($eventId, $userId)) {
             $eventDto = $eventService->findEvent($eventId);
             if ($eventDto->getEndTimeStamp() < time()) {
                 $eventService->deleteUserEventInvites((int) $eventId, $userId);
                 $result['msg'] = $lang->text('event', 'user_status_updated');
                 $event->setData($result);
                 return;
             }
             $eventUser = $eventService->findEventUser($eventId, $userId);
             if ($eventUser !== null && (int) $eventUser->getStatus() === (int) $attendedStatus) {
                 $result['msg'] = $lang->text('event', 'user_status_not_changed_error');
                 $exit = true;
             }
             if ($eventDto->getUserId() == OW::getUser()->getId() && (int) $attendedStatus == EVENT_BOL_EventService::USER_STATUS_NO) {
                 $result['msg'] = $lang->text('event', 'user_status_author_cant_leave_error');
                 $exit = true;
             }
             if (!$exit) {
                 $eventUserDto = EVENT_BOL_EventService::getInstance()->addEventUser($userId, $eventId, $attendedStatus);
                 if (!empty($eventUserDto)) {
                     $e = new OW_Event(EVENT_BOL_EventService::EVENT_ON_CHANGE_USER_STATUS, array('eventId' => $eventDto->id, 'userId' => $eventUserDto->userId));
                     OW::getEventManager()->trigger($e);
                     $result = array('result' => true, 'msg' => $lang->text('event', 'user_status_updated'));
                     BOL_InvitationService::getInstance()->deleteInvitation(EVENT_CLASS_InvitationHandler::INVITATION_JOIN, $eventId, $userId);
                 } else {
                     $result['msg'] = $lang->text('event', 'user_status_update_error');
                 }
             }
         } else {
             $result['msg'] = $lang->text('event', 'user_status_update_error');
         }
     } else {
         if ($params['command'] == 'events.ignore') {
             $eventService->deleteUserEventInvites((int) $eventId, $userId);
             $result = array('result' => true, 'msg' => $lang->text('event', 'user_status_updated'));
             BOL_InvitationService::getInstance()->deleteInvitation(EVENT_CLASS_InvitationHandler::INVITATION_JOIN, $eventId, $userId);
         }
     }
     $event->setData($result);
 }
Esempio n. 12
0
 /**
  * Returns an instance of class (singleton pattern implementation).
  *
  * @return EVENT_BOL_EventService
  */
 public static function getInstance()
 {
     if (self::$classInstance === null) {
         self::$classInstance = new self();
     }
     return self::$classInstance;
 }
Esempio n. 13
0
 public function onCommand(OW_Event $event)
 {
     if (!OW::getUser()->isAuthenticated()) {
         return 'auth faild';
     }
     $params = $event->getParams();
     if (!in_array($params['command'], array('events.accept', 'events.ignore'))) {
         return 'wrong command';
     }
     $eventId = $params['data'];
     $eventDto = EVENT_BOL_EventService::getInstance()->findEvent($eventId);
     $userId = OW::getUser()->getId();
     $jsResponse = UTIL_JsGenerator::newInstance();
     $eventService = EVENT_BOL_EventService::getInstance();
     if (empty($eventDto)) {
         BOL_InvitationService::getInstance()->deleteInvitation(self::INVITATION_JOIN, $eventId, $userId);
         return 'empty Event Id';
     }
     if ($params['command'] == 'events.accept') {
         $feedback = array('messageType' => 'error');
         $exit = false;
         $attendedStatus = 1;
         if ($eventService->canUserView($eventId, $userId)) {
             $eventDto = $eventService->findEvent($eventId);
             if ($eventDto->getEndTimeStamp() < time()) {
                 $eventService->deleteUserEventInvites((int) $eventId, $userId);
                 $jsResponse->callFunction(array('OW', 'error'), array(OW::getLanguage()->text('event', 'user_status_updated')));
                 $event->setData($jsResponse);
                 return;
             }
             $eventUser = $eventService->findEventUser($eventId, $userId);
             if ($eventUser !== null && (int) $eventUser->getStatus() === (int) $attendedStatus) {
                 $jsResponse->callFunction(array('OW', 'error'), array(OW::getLanguage()->text('event', 'user_status_not_changed_error')));
                 $exit = true;
             }
             if ($eventDto->getUserId() == OW::getUser()->getId() && (int) $attendedStatus == EVENT_BOL_EventService::USER_STATUS_NO) {
                 $jsResponse->callFunction(array('OW', 'error'), array(OW::getLanguage()->text('event', 'user_status_author_cant_leave_error')));
                 $exit = true;
             }
             if (!$exit) {
                 $eventUserDto = EVENT_BOL_EventService::getInstance()->addEventUser($userId, $eventId, $attendedStatus);
                 if (!empty($eventUserDto)) {
                     $e = new OW_Event(EVENT_BOL_EventService::EVENT_ON_CHANGE_USER_STATUS, array('eventId' => $eventDto->id, 'userId' => $eventUserDto->userId));
                     OW::getEventManager()->trigger($e);
                     $jsResponse->callFunction(array('OW', 'info'), array(OW::getLanguage()->text('event', 'user_status_updated')));
                     BOL_InvitationService::getInstance()->deleteInvitation(self::INVITATION_JOIN, $eventId, $userId);
                 } else {
                     $jsResponse->callFunction(array('OW', 'error'), array(OW::getLanguage()->text('event', 'user_status_update_error')));
                 }
             }
         } else {
             $jsResponse->callFunction(array('OW', 'error'), array(OW::getLanguage()->text('event', 'user_status_update_error')));
         }
     } else {
         if ($params['command'] == 'events.ignore') {
             $eventService->deleteUserEventInvites((int) $eventId, $userId);
             $jsResponse->callFunction(array('OW', 'info'), array(OW::getLanguage()->text('event', 'user_status_updated')));
             BOL_InvitationService::getInstance()->deleteInvitation(self::INVITATION_JOIN, $eventId, $userId);
         }
     }
     $event->setData($jsResponse);
 }
Esempio n. 14
0
 public function sosialSharingGetEventInfo(OW_Event $event)
 {
     $params = $event->getParams();
     $data = $event->getData();
     $data['display'] = false;
     if (empty($params['entityId'])) {
         return;
     }
     if ($params['entityType'] == 'event') {
         if (!BOL_AuthorizationService::getInstance()->isActionAuthorizedForGuest('event', 'view_event')) {
             $event->setData($data);
             return;
         }
         $eventDto = EVENT_BOL_EventService::getInstance()->findEvent($params['entityId']);
         if (!empty($eventDto)) {
             $data['display'] = $eventDto->getWhoCanView() == EVENT_BOL_EventService::CAN_VIEW_ANYBODY;
         }
         $event->setData($data);
     }
 }
Esempio n. 15
0
 public function onEventContent(BASE_CLASS_EventCollector $event)
 {
     $dispatchAttrs = OW::getRequestHandler()->getDispatchAttributes();
     $params = $dispatchAttrs["params"];
     $eventId = $params['eventId'];
     $eventDto = EVENT_BOL_EventService::getInstance()->findEvent($eventId);
     if (empty($eventDto) || $eventDto->userId != OW::getUser()->getId()) {
         return;
     }
     $uniqId = uniqid("mcompose-");
     $recipients = array(self::ID_PREFIX . "_" . $eventId);
     $button = array("label" => OW::getLanguage()->text("mcompose", "events_send_message"), "class" => "ow_ic_mail", "id" => $uniqId);
     $event->add('<div class="ow_smallmargin ow_center">' . OW::getThemeManager()->processDecorator("button", $button) . '</div>');
     $js = UTIL_JsGenerator::newInstance();
     $js->jQueryEvent("#" . $uniqId, "click", 'OW.ajaxFloatBox(e.data.class, e.data.params); return false;', array("e"), array("class" => "MCOMPOSE_CMP_SendMessage", "params" => array($recipients, MCOMPOSE_BOL_Service::CONTEXT_EVENT)));
     OW::getDocument()->addOnloadScript($js);
 }
Esempio n. 16
0
 public function map()
 {
     $event = new OW_Event('event.is_plugin_active');
     OW::getEventManager()->trigger($event);
     $data = $event->getData();
     if (!$data) {
         throw new Redirect404Exception();
     }
     $event = new OW_Event('event.get_content_menu');
     OW::getEventManager()->trigger($event);
     $menu = $event->getData();
     $menu = EVENT_BOL_EventService::getInstance()->getContentMenu();
     $menu->getElement('events_map')->setActive(true);
     $this->addComponent('menu', $menu);
     $language = OW::getLanguage();
     $this->setPageHeading($language->text('googlelocation', 'map_page_heading'));
     $this->setPageHeadingIconClass('ow_ic_bookmark');
     $this->addComponent("map", $this->getEventMapCmp(OW::getRouter()->getUri()));
     OW::getEventManager()->trigger(new OW_Event('googlelocation.add_js_lib'));
 }