예제 #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;
 }
예제 #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);
         }
     }
 }
예제 #3
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));
 }
예제 #4
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);
 }
예제 #5
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;
 }
예제 #6
0
파일: core.php 프로젝트: vazahat/dudex
 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();
     }
 }
예제 #7
0
 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);
 }
예제 #8
0
파일: service.php 프로젝트: vazahat/dudex
 public function countUpcomingEvents()
 {
     return EVENT_BOL_EventService::getInstance()->findPublicEventsCount();
 }
예제 #9
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);
 }
예제 #10
0
 public function onUpdateInfo(OW_Event $event)
 {
     $params = $event->getParams();
     $data = $event->getData();
     if ($params["entityType"] != self::ENTITY_TYPE) {
         return;
     }
     foreach ($data as $eventId => $info) {
         $status = 0;
         switch ($info['status']) {
             case BOL_ContentService::STATUS_ACTIVE:
                 $status = EVENT_BOL_EventService::MODERATION_STATUS_ACTIVE;
                 break;
             case BOL_ContentService::STATUS_APPROVAL:
                 $status = EVENT_BOL_EventService::MODERATION_STATUS_APPROVAL;
                 break;
             case BOL_ContentService::STATUS_SUSPENDED:
                 $status = EVENT_BOL_EventService::MODERATION_STATUS_SUSPANDED;
                 break;
         }
         $eventDto = EVENT_BOL_EventService::getInstance()->findEvent($eventId);
         if (!empty($eventDto)) {
             $eventDto->status = $status;
             EVENT_BOL_EventService::getInstance()->saveEvent($eventDto);
         }
     }
 }
예제 #11
0
 /**
  * Events list controller
  * 
  * @param array $params 
  */
 public function eventsList($params)
 {
     if (empty($params['list'])) {
         throw new Redirect404Exception();
     }
     if (!OW::getUser()->isAuthorized('event', 'view_event')) {
         $status = BOL_AuthorizationService::getInstance()->getActionStatus('event', 'view_event');
         throw new AuthorizationException($status['msg']);
     }
     $configs = $this->eventService->getConfigs();
     $page = empty($_GET['page']) || (int) $_GET['page'] < 0 ? 1 : (int) $_GET['page'];
     $language = OW::getLanguage();
     $toolbarList = array();
     switch (trim($params['list'])) {
         case 'created':
             if (!OW::getUser()->isAuthenticated()) {
                 throw new Redirect403Exception();
             }
             $this->setPageHeading($language->text('event', 'event_created_by_me_page_heading'));
             $this->setPageTitle($language->text('event', 'event_created_by_me_page_title'));
             $this->setPageHeadingIconClass('ow_ic_calendar');
             $events = $this->eventService->findUserEvents(OW::getUser()->getId(), $page, null, true);
             $eventsCount = $this->eventService->findLatestEventsCount();
             break;
         case 'joined':
             if (!OW::getUser()->isAuthenticated()) {
                 throw new Redirect403Exception();
             }
             $contentMenu = EVENT_BOL_EventService::getInstance()->getContentMenu();
             $this->addComponent('contentMenu', $contentMenu);
             $this->setPageHeading($language->text('event', 'event_joined_by_me_page_heading'));
             $this->setPageTitle($language->text('event', 'event_joined_by_me_page_title'));
             $this->setPageHeadingIconClass('ow_ic_calendar');
             $events = $this->eventService->findUserParticipatedEvents(OW::getUser()->getId(), $page, null, true);
             $eventsCount = $this->eventService->findUserParticipatedEventsCount(OW::getUser()->getId(), true);
             break;
         case 'latest':
             $contentMenu = EVENT_BOL_EventService::getInstance()->getContentMenu();
             $contentMenu->getElement('latest')->setActive(true);
             $this->addComponent('contentMenu', $contentMenu);
             $this->setPageHeading($language->text('event', 'latest_events_page_heading'));
             $this->setPageTitle($language->text('event', 'latest_events_page_title'));
             $this->setPageHeadingIconClass('ow_ic_calendar');
             OW::getDocument()->setDescription($language->text('event', 'latest_events_page_desc'));
             $events = $this->eventService->findPublicEvents($page);
             $eventsCount = $this->eventService->findPublicEventsCount();
             break;
         case 'user-participated-events':
             if (empty($_GET['userId'])) {
                 throw new Redirect404Exception();
             }
             $user = BOL_UserService::getInstance()->findUserById($_GET['userId']);
             if ($user === null) {
                 throw new Redirect404Exception();
             }
             $eventParams = array('action' => 'event_view_attend_events', 'ownerId' => $user->getId(), 'viewerId' => OW::getUser()->getId());
             OW::getEventManager()->getInstance()->call('privacy_check_permission', $eventParams);
             $displayName = BOL_UserService::getInstance()->getDisplayName($user->getId());
             $this->setPageHeading($language->text('event', 'user_participated_events_page_heading', array('display_name' => $displayName)));
             $this->setPageTitle($language->text('event', 'user_participated_events_page_title', array('display_name' => $displayName)));
             OW::getDocument()->setDescription($language->text('event', 'user_participated_events_page_desc', array('display_name' => $displayName)));
             $this->setPageHeadingIconClass('ow_ic_calendar');
             $events = $this->eventService->findUserParticipatedPublicEvents($user->getId(), $page);
             $eventsCount = $this->eventService->findUserParticipatedPublicEventsCount($user->getId());
             break;
         case 'past':
             $contentMenu = EVENT_BOL_EventService::getInstance()->getContentMenu();
             $this->addComponent('contentMenu', $contentMenu);
             $this->setPageHeading($language->text('event', 'past_events_page_heading'));
             $this->setPageTitle($language->text('event', 'past_events_page_title'));
             $this->setPageHeadingIconClass('ow_ic_calendar');
             OW::getDocument()->setDescription($language->text('event', 'past_events_page_desc'));
             $events = $this->eventService->findPublicEvents($page, null, true);
             $eventsCount = $this->eventService->findPublicEventsCount(true);
             break;
         case 'invited':
             if (!OW::getUser()->isAuthenticated()) {
                 throw new Redirect403Exception();
             }
             $this->eventService->hideInvitationByUserId(OW::getUser()->getId());
             $contentMenu = EVENT_BOL_EventService::getInstance()->getContentMenu();
             $this->addComponent('contentMenu', $contentMenu);
             $this->setPageHeading($language->text('event', 'invited_events_page_heading'));
             $this->setPageTitle($language->text('event', 'invited_events_page_title'));
             $this->setPageHeadingIconClass('ow_ic_calendar');
             $events = $this->eventService->findUserInvitedEvents(OW::getUser()->getId(), $page);
             $eventsCount = $this->eventService->findUserInvitedEventsCount(OW::getUser()->getId());
             foreach ($events as $event) {
                 $toolbarList[$event->getId()] = array();
                 $paramsList = array('eventId' => $event->getId(), 'page' => $page, 'list' => trim($params['list']));
                 $acceptUrl = OW::getRequest()->buildUrlQueryString(OW::getRouter()->urlForRoute('event.invite_accept', $paramsList), array('page' => $page));
                 $ignoreUrl = OW::getRequest()->buildUrlQueryString(OW::getRouter()->urlForRoute('event.invite_decline', $paramsList), array('page' => $page));
                 $toolbarList[$event->getId()][] = array('label' => $language->text('event', 'accept_request'), 'href' => $acceptUrl);
                 $toolbarList[$event->getId()][] = array('label' => $language->text('event', 'ignore_request'), 'href' => $ignoreUrl);
             }
             break;
         default:
             throw new Redirect404Exception();
     }
     $this->addComponent('paging', new BASE_CMP_Paging($page, ceil($eventsCount / $configs[EVENT_BOL_EventService::CONF_EVENTS_COUNT_ON_PAGE]), 5));
     $addUrl = OW::getRouter()->urlForRoute('event.add');
     $script = '$("input.add_event_button").click(function() {
             window.location=' . json_encode($addUrl) . ';
         });';
     if (!OW::getUser()->isAuthorized('event', 'add_event')) {
         $status = BOL_AuthorizationService::getInstance()->getActionStatus('event', 'add_event');
         if ($status['status'] == BOL_AuthorizationService::STATUS_PROMOTED) {
             $script = '$("input.add_event_button").click(function() {
                     OW.authorizationLimitedFloatbox(' . json_encode($status['msg']) . ');
                 });';
         } else {
             if ($status['status'] == BOL_AuthorizationService::STATUS_DISABLED) {
                 $this->assign('noButton', true);
             }
         }
     }
     OW::getDocument()->addOnloadScript($script);
     if (empty($events)) {
         $this->assign('no_events', true);
     }
     $this->assign('listType', trim($params['list']));
     $this->assign('page', $page);
     $this->assign('events', $this->eventService->getListingDataWithToolbar($events, $toolbarList));
     $this->assign('toolbarList', $toolbarList);
     $this->assign('add_new_url', OW::getRouter()->urlForRoute('event.add'));
     OW::getNavigation()->activateMenuItem(OW_Navigation::MAIN, 'event', 'main_menu_item');
 }
예제 #12
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);
 }
예제 #13
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);
     }
 }
예제 #14
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);
 }
예제 #15
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'));
 }