/** * Responsible for displaying the event page. **/ function viewevent() { $mainframe = JFactory::getApplication(); $document = JFactory::getDocument(); $config = CFactory::getConfig(); $my = CFactory::getUser(); CFactory::load('libraries', 'tooltip'); CFactory::load('libraries', 'wall'); CFactory::load('libraries', 'window'); CWindow::load(); $eventid = JRequest::getInt('eventid', 0); $eventModel =& CFactory::getModel('events'); $event =& JTable::getInstance('Event', 'CTable'); CFactory::load('helpers', 'event'); $handler = CEventHelper::getHandler($event); $event->load($eventid); if (!$handler->exists()) { $mainframe->enqueueMessage(JText::_('CC EVENTS NOT AVAILABLE'), 'error'); return; } if (!$handler->browsable()) { echo JText::_('CC NOT ALLOWED TO ACCESS SECTION'); return; } // @rule: Test if the group is unpublished, don't display it at all. if (!$event->published) { echo JText::_('CC EVENTS UNDER MODERATION'); return; } $this->showSubmenu(); $event->hit(); // Basic page presentation if ($event->type == 'group') { $groupId = $event->contentid; $group =& JTable::getInstance('Group', 'CTable'); $group->load($groupId); // Set pathway for group videos // Community > Groups > Group Name > Events $this->addPathway(JText::_('CC GROUPS'), CRoute::_('index.php?option=com_community&view=groups')); $this->addPathway($group->name, CRoute::_('index.php?option=com_community&view=groups&task=viewgroup&groupid=' . $groupId)); } $this->addPathway(JText::_('CC EVENTS'), CRoute::_('index.php?option=com_community&view=events')); $this->addPathway(JText::sprintf('CC VIEW EVENTS TITLE', $event->title), ''); // Permissions and privacies CFactory::load('helpers', 'owner'); $isEventGuest = $event->isMember($my->id); $isMine = $my->id == $event->creator; $isAdmin = $event->isAdmin($my->id); $isCommunityAdmin = COwnerHelper::isCommunityAdmin(); // Get Event Admins $eventAdmins = $event->getAdmins(12, CC_RANDOMIZE); $eventAdminsCount = $event->getAdminsCount(); // Attach avatar of the admin for ($i = 0; $i < count($eventAdmins); $i++) { $row =& $eventAdmins[$i]; $eventAdmins[$i] = CFactory::getUser($row->id); } // Get Attending Event Guests $eventMembers = $event->getMembers(COMMUNITY_EVENT_STATUS_ATTEND, 12, CC_RANDOMIZE); $eventMembersCount = $event->getMembersCount(COMMUNITY_EVENT_STATUS_ATTEND); // Get pending event guests $pendingMembers = $event->getMembers(COMMUNITY_EVENT_STATUS_INVITED, 12, CC_RANDOMIZE); $pendingMembersCount = $event->getMembersCount(COMMUNITY_EVENT_STATUS_INVITED); // Get blocked Event Guests $blockedMembers = $event->getMembers(COMMUNITY_EVENT_STATUS_BLOCKED, 12, CC_RANDOMIZE); $blockedMembersCount = $event->getMembersCount(COMMUNITY_EVENT_STATUS_BLOCKED); // Attach avatar of the admin // Pre-load multiple users at once $userids = array(); foreach ($eventMembers as $uid) { $userids[] = $uid->id; } CFactory::loadUsers($userids); for ($i = 0; $i < count($eventMembers); $i++) { $row =& $eventMembers[$i]; $eventMembers[$i] = CFactory::getUser($row->id); } // Pre-load multiple users at once $userids = array(); foreach ($pendingMembers as $uid) { $userids[] = $uid->id; } CFactory::loadUsers($userids); for ($i = 0; $i < count($pendingMembers); $i++) { $row =& $pendingMembers[$i]; $pendingMembers[$i] = CFactory::getUser($row->id); } // Pre-load multiple users at once $userids = array(); foreach ($blockedMembers as $uid) { $userids[] = $uid->id; } CFactory::loadUsers($userids); for ($i = 0; $i < count($blockedMembers); $i++) { $row =& $blockedMembers[$i]; $blockedMembers[$i] = CFactory::getUser($row->id); } $waitingApproval = $event->isPendingApproval($my->id); $waitingRespond = false; $myStatus = $event->getUserStatus($my->id); $hasResponded = $myStatus == COMMUNITY_EVENT_STATUS_ATTEND || $myStatus == COMMUNITY_EVENT_STATUS_WONTATTEND || $myStatus == COMMUNITY_EVENT_STATUS_MAYBE; // Get Bookmark HTML CFactory::load('libraries', 'bookmarks'); $bookmarks = new CBookmarks(CRoute::getExternalURL('index.php?option=com_community&view=events&task=viewevent&eventid=' . $event->id)); $bookmarksHTML = $bookmarks->getHTML(); // Get Reporting HTML CFactory::load('libraries', 'reporting'); $report = new CReportingLibrary(); $reportHTML = $report->getReportingHTML(JText::_('CC REPORT EVENT'), 'events,reportEvent', array($event->id)); // Get the Wall CFactory::load('libraries', 'wall'); $wallContent = CWallLibrary::getWallContents('events', $event->id, $isAdmin, 10, 0, 'wall.content', 'events,events'); $wallCount = CWallLibrary::getWallCount('events', $event->id); $viewAllLink = false; if (JRequest::getVar('task', '', 'REQUEST') != 'app') { $viewAllLink = CRoute::_('index.php?option=com_community&view=events&task=app&eventid=' . $event->id . '&app=walls'); } $wallContent .= CWallLibrary::getViewAllLinkHTML($viewAllLink, $wallCount); $wallForm = ''; if (!$config->get('lockeventwalls') || $config->get('lockeventwalls') && $isEventGuest && !$waitingApproval && $hasResponded || $isCommunityAdmin) { $wallForm = CWallLibrary::getWallInputForm($event->id, 'events,ajaxSaveWall', 'events,ajaxRemoveWall'); } // Construct the RVSP radio list $arr = array(JHTML::_('select.option', COMMUNITY_EVENT_STATUS_ATTEND, JText::_('CC EVENT ACTION ATTEND')), JHTML::_('select.option', COMMUNITY_EVENT_STATUS_WONTATTEND, JText::_('CC EVENT ACTION DECLINE')), JHTML::_('select.option', COMMUNITY_EVENT_STATUS_MAYBE, JText::_('CC EVENT ACTION UNSURE'))); $status = $event->getMemberStatus($my->id); $radioList = JHTML::_('select.radiolist', $arr, 'status', '', 'value', 'text', $status, false); $unapprovedCount = $event->inviteRequestCount(); //... $editEvent = JRequest::getVar('edit', false, 'GET'); $editEvent = $editEvent == 1 ? true : false; // Am I invited in this event? $isInvited = false; $join = ''; $friendsCount = 0; $isInvited = $eventModel->isInvitedMe(0, $my->id, $event->id); // If I was invited, I want to know my invitation informations if ($isInvited) { $invitor = CFactory::getUser($isInvited[0]->invited_by); $join = '<a href="' . CUrlHelper::userLink($invitor->id) . '">' . $invitor->getDisplayName() . '</a>'; // Get users friends in this group $friendsCount = $eventModel->getFriendsCount($my->id, $event->id); } $friendsModel = CFactory::getModel('Friends'); $tmpFriends = $friendsModel->getFriends($my->id, 'name', false); $friends = array(); for ($i = 0; $i < count($tmpFriends); $i++) { $friend =& $tmpFriends[$i]; if (!$event->isMember($friend->id)) { $friends[] = $friend; } } unset($tmpFriends); // Get like CFactory::load('libraries', 'like'); $likes = new CLike(); $likesHTML = $likes->getHTML('events', $event->id, $my->id); // Is this event is a past event? $now = new JDate(); $isPastEvent = $event->getEndDate(false)->toMySQL() < $now->toMySQL(true) ? true : false; // Output to template $tmpl = new CTemplate(); CFactory::load('libraries', 'invitation'); $inviteHTML = CInvitation::getHTML($friends, 'events,inviteUsers', $event->id, CInvitation::SHOW_FRIENDS, CInvitation::HIDE_EMAIL); $tmpl->setMetaTags('event', $event); $tmpl->set('timezone', CTimeHelper::getTimezone($event->offset)); $tmpl->set('handler', $handler); $tmpl->set('likesHTML', $likesHTML); $tmpl->set('inviteHTML', $inviteHTML); $tmpl->set('guestStatus', $event->getUserStatus($my->id)); $tmpl->set('event', $event); $tmpl->set('radioList', $radioList); $tmpl->set('bookmarksHTML', $bookmarksHTML); $tmpl->set('reportHTML', $reportHTML); $tmpl->set('isEventGuest', $isEventGuest); $tmpl->set('isMine', $isMine); $tmpl->set('isAdmin', $isAdmin); $tmpl->set('isCommunityAdmin', $isCommunityAdmin); $tmpl->set('unapproved', $unapprovedCount); $tmpl->set('waitingApproval', $waitingApproval); $tmpl->set('wallForm', $wallForm); $tmpl->set('wallContent', $wallContent); $tmpl->set('eventAdmins', $eventAdmins); $tmpl->set('eventAdminsCount', $eventAdminsCount); $tmpl->set('eventMembers', $eventMembers); $tmpl->set('eventMembersCount', $eventMembersCount); $tmpl->set('blockedMembers', $blockedMembers); $tmpl->set('blockedMembersCount', $blockedMembersCount); $tmpl->set('pendingMembers', $pendingMembers); $tmpl->set('pendingMembersCount', $pendingMembersCount); $tmpl->set('editEvent', $editEvent); $tmpl->set('my', $my); $tmpl->set('memberStatus', $myStatus); $tmpl->set('waitingRespond', $waitingRespond); $tmpl->set('isInvited', $isInvited); $tmpl->set('join', $join); $tmpl->set('friendsCount', $friendsCount); $tmpl->set('isPastEvent', $isPastEvent); echo $tmpl->fetch('events.viewevent'); }
* @copyright (C) 2008 by Slashes & Dots Sdn Bhd - All rights reserved! * @license GNU/GPL, see LICENSE.php * * @params isMine boolean is this group belong to me * @params categories Array An array of categories object * @params members Array An array of members object * @params event Event A group object that has the property of a group * @params wallForm string A html data that will output the walls form. * @params wallContent string A html data that will output the walls data. **/ defined('_JEXEC') or die; $accessAllowed = ($memberStatus == COMMUNITY_EVENT_STATUS_INVITED || $memberStatus == COMMUNITY_EVENT_STATUS_ATTEND || $memberStatus == COMMUNITY_EVENT_STATUS_WONTATTEND || $memberStatus == COMMUNITY_EVENT_STATUS_MAYBE || !$event->permission) && $memberStatus != COMMUNITY_EVENT_STATUS_BLOCKED || $isCommunityAdmin; $hasResponded = $memberStatus == COMMUNITY_EVENT_STATUS_ATTEND || $memberStatus == COMMUNITY_EVENT_STATUS_WONTATTEND || $memberStatus == COMMUNITY_EVENT_STATUS_MAYBE; $creator = CFactory::getUser($event->creator); $creatorUtcOffset = $creator->getUtcOffset(); $creatorUtcOffsetStr = CTimeHelper::getTimezone($creator->getTimezone()); ?> <div class="event"> <div class="page-actions"> <?php echo $reportHTML; ?> <?php echo $bookmarksHTML; ?> </div> <!-- begin: .cLayout --> <div class="cLayout clrfix">
/** * Deprecated since 1.8 * Use CTimeHelper::getTimezone instead. */ function cTimezoneIdentifier($offset) { return CTimeHelper::getTimezone($offset); }
/** * Responsible for displaying the event page. * */ public function viewevent() { $mainframe = JFactory::getApplication(); $jinput = $mainframe->input; $document = JFactory::getDocument(); $config = CFactory::getConfig(); $my = CFactory::getUser(); CWindow::load(); $eventLib = new CEvents(); $eventid = JRequest::getInt('eventid', 0); $eventModel = CFactory::getModel('events'); $event = JTable::getInstance('Event', 'CTable'); $handler = CEventHelper::getHandler($event); $event->load($eventid); if (empty($event->id)) { return JError::raiseWarning(404, JText::_('COM_COMMUNITY_EVENTS_NOT_AVAILABLE_ERROR')); } if ($event->unlisted && !$event->isMember($my->id) && !$event->getUserStatus($my->id) == 0) { $text = JText::_('COM_COMMUNITY_EVENTS_UNLISTED_ERROR'); $text .= ' <a href="javascript:" onclick="joms.api.eventJoin(\'' . $event->id . '\');">Request Invitation</a>'; return JError::raiseWarning(403, $text); } if (!$handler->exists()) { $mainframe->enqueueMessage(JText::_('COM_COMMUNITY_EVENTS_NOT_AVAILABLE_ERROR'), 'error'); return; } if (!$handler->browsable()) { echo JText::_('COM_COMMUNITY_NOT_ALLOWED_TO_ACCESS_SECTION'); return; } // @rule: Test if the group is unpublished, don't display it at all. if (!$event->isPublished()) { echo JText::_('COM_COMMUNITY_EVENTS_UNDER_MODERATION'); return; } //$this->showSubmenu(); $event->hit(); $isGroupAdmin = false; // Basic page presentation if ($event->type == 'group') { $groupId = $event->contentid; $group = JTable::getInstance('Group', 'CTable'); $group->load($groupId); // Set pathway for group videos // Community > Groups > Group Name > Events $this->addPathway(JText::_('COM_COMMUNITY_GROUPS'), CRoute::_('index.php?option=com_community&view=groups')); $this->addPathway($group->name, CRoute::_('index.php?option=com_community&view=groups&task=viewgroup&groupid=' . $groupId)); $groupEventDetails = new stdClass(); $groupEventDetails->creator = CFactory::getUser($event->creator); $groupEventDetails->groupName = $group->name; $groupEventDetails->groupLink = CRoute::_('index.php?option=com_community&view=groups&task=viewgroup&groupid=' . $group->id); $isGroupAdmin = $group->isAdmin($my->id); } $this->addPathway(JText::_('COM_COMMUNITY_EVENTS'), CRoute::_('index.php?option=com_community&view=events')); $this->addPathway($event->title); /** * Opengraph */ CHeadHelper::setType('website', JText::sprintf('COM_COMMUNITY_EVENT_PAGE_TITLE', $event->title), null, array($event->getCover())); // Permissions and privacies $isEventGuest = $event->isMember($my->id); $isMine = $my->id == $event->creator; $isAdmin = $event->isAdmin($my->id) || $isGroupAdmin; $isCommunityAdmin = COwnerHelper::isCommunityAdmin(); // Get Event Admins $eventAdmins = $event->getAdmins(12, CC_RANDOMIZE); $adminsInArray = array(); // Attach avatar of the admin for ($i = 0; $i < count($eventAdmins); $i++) { $row = $eventAdmins[$i]; $admin = CFactory::getUser($row->id); array_push($adminsInArray, '<a href="' . CUrlHelper::userLink($admin->id) . '">' . $admin->getDisplayName() . '</a>'); } $adminsList = ltrim(implode(', ', $adminsInArray), ','); // Get Attending Event Guests $eventMembers = $event->getMembers(COMMUNITY_EVENT_STATUS_ATTEND, CFactory::getConfig()->get('event_sidebar_members_show_total', 12), CC_RANDOMIZE); $eventMembersCount = $event->getMembersCount(COMMUNITY_EVENT_STATUS_ATTEND); // Attach avatar of the admin // Pre-load multiple users at once $userids = array(); foreach ($eventMembers as $uid) { $userids[] = $uid->id; } CFactory::loadUsers($userids); for ($i = 0; $i < count($eventMembers); $i++) { $row = $eventMembers[$i]; $eventMembers[$i] = CFactory::getUser($row->id); } // Pre-load multiple users at once $waitingApproval = $event->isPendingApproval($my->id); $waitingRespond = false; $myStatus = $event->getUserStatus($my->id); $hasResponded = $myStatus == COMMUNITY_EVENT_STATUS_ATTEND || $myStatus == COMMUNITY_EVENT_STATUS_WONTATTEND || $myStatus == COMMUNITY_EVENT_STATUS_MAYBE; // Get Bookmark HTML $bookmarks = new CBookmarks(CRoute::getExternalURL('index.php?option=com_community&view=events&task=viewevent&eventid=' . $event->id)); $bookmarksHTML = $bookmarks->getHTML(); // Get the Wall $wallContent = CWallLibrary::getWallContents('events', $event->id, $isAdmin, $config->get('stream_default_comments'), 0, 'wall/content', 'events,events'); $wallCount = CWallLibrary::getWallCount('events', $event->id); $viewAllLink = false; if ($jinput->request->get('task', '', 'STRING') != 'app') { $viewAllLink = CRoute::_('index.php?option=com_community&view=events&task=app&eventid=' . $event->id . '&app=walls'); } $wallContent .= CWallLibrary::getViewAllLinkHTML($viewAllLink, $wallCount); $wallForm = ''; // Construct the RVSP radio list $arr = array(JHTML::_('select.option', COMMUNITY_EVENT_STATUS_ATTEND, JText::_('COM_COMMUNITY_EVENTS_YES')), JHTML::_('select.option', COMMUNITY_EVENT_STATUS_WONTATTEND, JText::_('COM_COMMUNITY_EVENTS_NO')), JHTML::_('select.option', COMMUNITY_EVENT_STATUS_MAYBE, JText::_('COM_COMMUNITY_EVENTS_MAYBE'))); $status = $event->getMemberStatus($my->id); $radioList = JHTML::_('select.radiolist', $arr, 'status', '', 'value', 'text', $status, false); $unapprovedCount = $event->inviteRequestCount(); //... $editEvent = $jinput->get->get('edit', false, 'NONE'); $editEvent = $editEvent == 1 ? true : false; // Am I invited in this event? $isInvited = false; $join = ''; $friendsCount = 0; $isInvited = $eventModel->isInvitedMe(0, $my->id, $event->id); // If I was invited, I want to know my invitation informations if ($isInvited) { $invitor = CFactory::getUser($isInvited[0]->invited_by); $join = '<a href="' . CUrlHelper::userLink($invitor->id) . '">' . $invitor->getDisplayName() . '</a>'; // Get users friends in this group $friendsCount = $eventModel->getFriendsCount($my->id, $event->id); } // Get like $likes = new CLike(); $isUserLiked = false; if ($isLikeEnabled = $likes->enabled('events')) { $isUserLiked = $likes->userLiked('events', $event->id, $my->id); } $totalLikes = $likes->getLikeCount('events', $event->id); // Is this event is a past event? $now = new JDate(); $isPastEvent = $event->getEndDate(false)->toSql() < $now->toSql(true) ? true : false; // Get the formated date & time $format = $config->get('eventshowampm') ? JText::_('COM_COMMUNITY_EVENTS_TIME_FORMAT_12HR') : JText::_('COM_COMMUNITY_EVENTS_TIME_FORMAT_24HR'); $startDate = $event->getStartDate(false); $endDate = $event->getEndDate(false); $allday = false; if ($startDate->format('%Y-%m-%d') == $endDate->format('%Y-%m-%d') && $startDate->format('%H:%M:%S') == '00:00:00' && $endDate->format('%H:%M:%S') == '23:59:59') { $format = JText::_('COM_COMMUNITY_EVENT_TIME_FORMAT_LC1'); $allday = true; } $event->startdateHTML = CTimeHelper::getFormattedTime($event->startdate, $format); $event->enddateHTML = CTimeHelper::getFormattedTime($event->enddate, $format); if (!isset($event->params)) { $event->params = ''; } $params = new CParameter($event->params); $event->defaultCover = $event->isDefaultCover(); // Cover position. $event->coverPostion = $params->get('coverPosition', ''); if (strpos($event->coverPostion, '%') === false) { $event->coverPostion = 0; } // Find cover album and photo. $event->coverAlbum = false; $event->coverPhoto = false; $album = JTable::getInstance('Album', 'CTable'); $albumId = $album->isCoverExist('event', $event->id); if ($albumId) { $album->load($albumId); $event->coverAlbum = $albumId; $event->coverPhoto = $album->photoid; } $inviteHTML = CInvitation::getHTML(null, 'events,inviteUsers', $event->id, CInvitation::SHOW_FRIENDS, CInvitation::SHOW_EMAIL); $status = new CUserStatus($event->id, 'events'); $tmpl = new CTemplate(); $creator = new CUserStatusCreator('message'); $creator->title = $isMine ? JText::_('COM_COMMUNITY_STATUS') : JText::_('COM_COMMUNITY_MESSAGE'); $creator->html = $tmpl->fetch('status.message'); $status->addCreator($creator); // Upgrade wall to stream @since 2.5 $event->upgradeWallToStream(); // Add custom stream $streamHTML = $eventLib->getStreamHTML($event); if ($event->getMemberStatus($my->id) == COMMUNITY_EVENT_STATUS_ATTEND) { $RSVPmessage = JText::_('COM_COMMUNITY_EVENTS_ATTENDING_EVENT_MESSAGE'); } else { if ($event->getMemberStatus($my->id) == COMMUNITY_EVENT_STATUS_WONTATTEND) { $RSVPmessage = JText::_('COM_COMMUNITY_EVENTS_NOT_ATTENDING_EVENT_MESSAGE'); } else { $RSVPmessage = JText::_('COM_COMMUNITY_EVENTS_NOT_RESPOND_RSVP_MESSAGE'); } } // Get recurring event series $eventSeries = null; $seriesCount = 0; if ($event->isRecurring()) { $advance = array('expired' => false, 'return' => 'object', 'limit' => COMMUNITY_EVENT_SERIES_LIMIT, 'exclude' => $event->id, 'published' => 1); $tempseries = $eventModel->getEventChilds($event->parent, $advance); foreach ($tempseries as $series) { $table = JTable::getInstance('Event', 'CTable'); $table->bind($series); $eventSeries[] = $table; } $seriesCount = $eventModel->getEventChildsCount($event->parent); } //pending request invitation guest $pendingRequestGuests = $event->getMembers(COMMUNITY_EVENT_STATUS_REQUESTINVITE, 0, false, false); // Pre-load multiple users at once $tempUserInfo = array(); foreach ($pendingRequestGuests as $uid) { $tempUserInfo[] = CFactory::getUser($uid->id); } $pendingRequestGuests = $tempUserInfo; $featured = new CFeatured(FEATURED_EVENTS); $featuredList = $featured->getItemIds(); // Get Attending Event Guests $maybeList = $event->getMembers(COMMUNITY_EVENT_STATUS_MAYBE, 12, CC_RANDOMIZE); $maybeCount = $event->getMembersCount(COMMUNITY_EVENT_STATUS_MAYBE); $tempUserInfo = array(); foreach ($maybeList as $uid) { $tempUserInfo[] = CFactory::getUser($uid->id); } $maybeList = $tempUserInfo; $wontAttendList = $event->getMembers(COMMUNITY_EVENT_STATUS_WONTATTEND, 12, CC_RANDOMIZE); $wontAttendCount = $event->getMembersCount(COMMUNITY_EVENT_STATUS_WONTATTEND); $tempUserInfo = array(); foreach ($wontAttendList as $uid) { $tempUserInfo[] = CFactory::getUser($uid->id); } $wontAttendList = $tempUserInfo; //gets all the albums related to this photo $photosModel = CFactory::getModel('photos'); $albums = $photosModel->getEventAlbums($event->id); $totalPhotos = 0; foreach ($albums as $album) { $albumParams = new CParameter($album->params); $totalPhotos = $totalPhotos + $albumParams->get('count'); } //get total videos $videosModel = CFactory::getModel('videos'); $videos = $videosModel->getEventVideos($eventid); $totalVideos = count($videosModel->getEventVideos($eventid)); // Output to template echo $tmpl->setMetaTags('event', $event)->set('status', $status)->set('albums', $albums)->set('videos', $videos)->set('pendingRequestGuests', $pendingRequestGuests)->set('streamHTML', $streamHTML)->set('timezone', CTimeHelper::getTimezone($event->offset))->set('handler', $handler)->set('isUserLiked', $isUserLiked)->set('totalLikes', $totalLikes)->set('inviteHTML', $inviteHTML)->set('guestStatus', $event->getUserStatus($my->id))->set('event', $event)->set('radioList', $radioList)->set('bookmarksHTML', $bookmarksHTML)->set('isLikeEnabled', $isLikeEnabled)->set('isEventGuest', $isEventGuest)->set('isMine', $isMine)->set('isAdmin', $isAdmin)->set('isCommunityAdmin', $isCommunityAdmin)->set('unapproved', $unapprovedCount)->set('waitingApproval', $waitingApproval)->set('wallContent', $wallContent)->set('eventMembers', $eventMembers)->set('eventMembersCount', $eventMembersCount)->set('editEvent', $editEvent)->set('my', $my)->set('creator', CFactory::getUser($event->creator))->set('memberStatus', $myStatus)->set('waitingRespond', $waitingRespond)->set('isInvited', $isInvited)->set('join', $join)->set('friendsCount', $friendsCount)->set('isPastEvent', $isPastEvent)->set('adminsList', $adminsList)->set('RSVPmessage', $RSVPmessage)->set('allday', $allday)->set('eventSeries', $eventSeries)->set('seriesCount', $seriesCount)->set('groupEventDetails', isset($groupEventDetails) ? $groupEventDetails : null)->set('featuredList', $featuredList)->set('photoPermission', $params->get('photopermission'))->set('videoPermission', $params->get('videopermission'))->set('showPhotos', $params->get('photopermission') != -1 && $config->get('enablephotos') && $config->get('eventphotos'))->set('showVideos', $params->get('videopermission') != -1 && $config->get('enablevideos') && $config->get('eventvideos'))->set('totalPhotos', $totalPhotos)->set('totalVideos', $totalVideos)->set('maybeList', $maybeList)->set('maybeCount', $maybeCount)->set('wontAttendList', $wontAttendList)->set('wontAttendCount', $wontAttendCount)->fetch('events/single'); }
?> </a> </h3> <div class="eventLocation"><?php echo $this->escape($event->location); ?> </div> <div class="eventTime"><?php echo JText::sprintf('CC EVENT TIME', JHTML::_('date', $event->startdate, JText::_('DATE_FORMAT_LC2')), JHTML::_('date', $event->enddate, JText::_('DATE_FORMAT_LC2'))); ?> </div> <?php if ($config->get('eventshowtimezone')) { ?> <div class="eventTimezone small"><?php echo CTimeHelper::getTimezone($event->getCreator()->getTimezone()); ?> </div> <?php } ?> <div class="eventActions"> <span class="icon-group" style="margin-right: 5px;"> <a href="<?php echo CRoute::_('index.php?option=com_community&view=events&task=viewguest&eventid=' . $event->id . '&type=' . COMMUNITY_EVENT_STATUS_ATTEND); ?> "><?php echo JText::sprintf(cIsPlural($event->confirmedcount) ? 'CC GUESTS COUNT MANY' : 'CC GUESTS COUNT', $event->confirmedcount); ?> </a> </span>
/** * Responsible for displaying the event page. **/ public function viewevent() { $mainframe = JFactory::getApplication(); $document = JFactory::getDocument(); $config = CFactory::getConfig(); $my = CFactory::getUser(); CFactory::load('libraries', 'tooltip'); CFactory::load('libraries', 'wall'); CFactory::load('libraries', 'window'); CFactory::load('libraries', 'activities'); CFactory::load('libraries', 'events'); CWindow::load(); $eventLib = new CEvents(); $eventid = JRequest::getInt('eventid', 0); $eventModel =& CFactory::getModel('events'); $event =& JTable::getInstance('Event', 'CTable'); CFactory::load('helpers', 'event'); $handler = CEventHelper::getHandler($event); $event->load($eventid); if (!$handler->exists()) { $mainframe->enqueueMessage(JText::_('COM_COMMUNITY_EVENTS_NOT_AVAILABLE_ERROR'), 'error'); return; } if (!$handler->browsable()) { echo JText::_('COM_COMMUNITY_NOT_ALLOWED_TO_ACCESS_SECTION'); return; } // @rule: Test if the group is unpublished, don't display it at all. if (!$event->published) { echo JText::_('COM_COMMUNITY_EVENTS_UNDER_MODERATION'); return; } $this->showSubmenu(); $event->hit(); // Basic page presentation if ($event->type == 'group') { $groupId = $event->contentid; $group =& JTable::getInstance('Group', 'CTable'); $group->load($groupId); // Set pathway for group videos // Community > Groups > Group Name > Events $this->addPathway(JText::_('COM_COMMUNITY_GROUPS'), CRoute::_('index.php?option=com_community&view=groups')); $this->addPathway($group->name, CRoute::_('index.php?option=com_community&view=groups&task=viewgroup&groupid=' . $groupId)); } $this->addPathway(JText::_('COM_COMMUNITY_EVENTS'), CRoute::_('index.php?option=com_community&view=events')); $this->addPathway($event->title); // Permissions and privacies CFactory::load('helpers', 'owner'); $isEventGuest = $event->isMember($my->id); $isMine = $my->id == $event->creator; $isAdmin = $event->isAdmin($my->id); $isCommunityAdmin = COwnerHelper::isCommunityAdmin(); // Get Event Admins $eventAdmins = $event->getAdmins(12, CC_RANDOMIZE); $adminsInArray = array(); // Attach avatar of the admin for ($i = 0; $i < count($eventAdmins); $i++) { $row =& $eventAdmins[$i]; $admin = CFactory::getUser($row->id); array_push($adminsInArray, '<a href="' . CUrlHelper::userLink($admin->id) . '">' . $admin->getDisplayName() . '</a>'); } $adminsList = ltrim(implode(', ', $adminsInArray), ','); // Get Attending Event Guests $eventMembers = $event->getMembers(COMMUNITY_EVENT_STATUS_ATTEND, 12, CC_RANDOMIZE); $eventMembersCount = $event->getMembersCount(COMMUNITY_EVENT_STATUS_ATTEND); // Attach avatar of the admin // Pre-load multiple users at once $userids = array(); foreach ($eventMembers as $uid) { $userids[] = $uid->id; } CFactory::loadUsers($userids); for ($i = 0; $i < count($eventMembers); $i++) { $row =& $eventMembers[$i]; $eventMembers[$i] = CFactory::getUser($row->id); } // Pre-load multiple users at once $waitingApproval = $event->isPendingApproval($my->id); $waitingRespond = false; $myStatus = $event->getUserStatus($my->id); $hasResponded = $myStatus == COMMUNITY_EVENT_STATUS_ATTEND || $myStatus == COMMUNITY_EVENT_STATUS_WONTATTEND || $myStatus == COMMUNITY_EVENT_STATUS_MAYBE; // Get Bookmark HTML CFactory::load('libraries', 'bookmarks'); $bookmarks = new CBookmarks(CRoute::getExternalURL('index.php?option=com_community&view=events&task=viewevent&eventid=' . $event->id)); $bookmarksHTML = $bookmarks->getHTML(); // Get Reporting HTML CFactory::load('libraries', 'reporting'); $report = new CReportingLibrary(); $reportHTML = $report->getReportingHTML(JText::_('COM_COMMUNITY_EVENTS_REPORT'), 'events,reportEvent', array($event->id)); // Get the Wall CFactory::load('libraries', 'wall'); $wallContent = CWallLibrary::getWallContents('events', $event->id, $isAdmin, 10, 0, 'wall.content', 'events,events'); $wallCount = CWallLibrary::getWallCount('events', $event->id); $viewAllLink = false; if (JRequest::getVar('task', '', 'REQUEST') != 'app') { $viewAllLink = CRoute::_('index.php?option=com_community&view=events&task=app&eventid=' . $event->id . '&app=walls'); } $wallContent .= CWallLibrary::getViewAllLinkHTML($viewAllLink, $wallCount); $wallForm = ''; /*if( !$config->get('lockeventwalls') || ($config->get('lockeventwalls') && ($isEventGuest) && !($waitingApproval) && $hasResponded) || $isCommunityAdmin ) { $wallForm = CWallLibrary::getWallInputForm( $event->id , 'events,ajaxSaveWall', 'events,ajaxRemoveWall' ); }*/ // Construct the RVSP radio list $arr = array(JHTML::_('select.option', COMMUNITY_EVENT_STATUS_ATTEND, JText::_('COM_COMMUNITY_EVENTS_YES')), JHTML::_('select.option', COMMUNITY_EVENT_STATUS_WONTATTEND, JText::_('COM_COMMUNITY_EVENTS_NO')), JHTML::_('select.option', COMMUNITY_EVENT_STATUS_MAYBE, JText::_('COM_COMMUNITY_EVENTS_MAYBE'))); $status = $event->getMemberStatus($my->id); $radioList = JHTML::_('select.radiolist', $arr, 'status', '', 'value', 'text', $status, false); $unapprovedCount = $event->inviteRequestCount(); //... $editEvent = JRequest::getVar('edit', false, 'GET'); $editEvent = $editEvent == 1 ? true : false; // Am I invited in this event? $isInvited = false; $join = ''; $friendsCount = 0; $isInvited = $eventModel->isInvitedMe(0, $my->id, $event->id); // If I was invited, I want to know my invitation informations if ($isInvited) { $invitor = CFactory::getUser($isInvited[0]->invited_by); $join = '<a href="' . CUrlHelper::userLink($invitor->id) . '">' . $invitor->getDisplayName() . '</a>'; // Get users friends in this group $friendsCount = $eventModel->getFriendsCount($my->id, $event->id); } // Get like CFactory::load('libraries', 'like'); $likes = new CLike(); $likesHTML = $likes->getHTML('events', $event->id, $my->id); // Is this event is a past event? $now = new JDate(); $isPastEvent = $event->getEndDate(false)->toMySQL() < $now->toMySQL(true) ? true : false; // Get the formated date & time $format = $config->get('eventshowampm') ? JText::_('COM_COMMUNITY_EVENTS_TIME_FORMAT_12HR') : JText::_('COM_COMMUNITY_EVENTS_TIME_FORMAT_24HR'); $startDate = $event->getStartDate(false); $endDate = $event->getEndDate(false); $allday = false; if ($startDate->toFormat('%Y-%m-%d') == $endDate->toFormat('%Y-%m-%d') && $startDate->toFormat('%H:%M:%S') == '00:00:00' && $endDate->toFormat('%H:%M:%S') == '23:59:59') { $format = JText::_('COM_COMMUNITY_EVENT_TIME_FORMAT_LC1'); $allday = true; } $event->startdateHTML = CTimeHelper::getFormattedTime($event->startdate, $format); $event->enddateHTML = CTimeHelper::getFormattedTime($event->enddate, $format); CFactory::load('libraries', 'invitation'); $inviteHTML = CInvitation::getHTML(null, 'events,inviteUsers', $event->id, CInvitation::SHOW_FRIENDS, CInvitation::SHOW_EMAIL); CFactory::load('libraries', 'userstatus'); $status = new CUserStatus($event->id, 'events'); $tmpl = new CTemplate(); $creator = new CUserStatusCreator('message'); $creator->title = $isMine ? JText::_('COM_COMMUNITY_STATUS') : JText::_('COM_COMMUNITY_MESSAGE'); $creator->html = $tmpl->fetch('status.message'); $status->addCreator($creator); // Upgrade wall to stream @since 2.5 $event->upgradeWallToStream(); // Add custom stream $streamHTML = $eventLib->getStreamHTML($event); if ($event->getMemberStatus($my->id) == COMMUNITY_EVENT_STATUS_ATTEND) { $RSVPmessage = JText::_('COM_COMMUNITY_EVENTS_ATTENDING_EVENT_MESSAGE'); } else { if ($event->getMemberStatus($my->id) == COMMUNITY_EVENT_STATUS_WONTATTEND) { $RSVPmessage = JText::_('COM_COMMUNITY_EVENTS_NOT_ATTENDING_EVENT_MESSAGE'); } else { $RSVPmessage = JText::_('COM_COMMUNITY_EVENTS_NOT_RESPOND_RSVP_MESSAGE'); } } // Output to template echo $tmpl->setMetaTags('event', $event)->set('status', $status)->set('streamHTML', $streamHTML)->set('timezone', CTimeHelper::getTimezone($event->offset))->set('handler', $handler)->set('likesHTML', $likesHTML)->set('inviteHTML', $inviteHTML)->set('guestStatus', $event->getUserStatus($my->id))->set('event', $event)->set('radioList', $radioList)->set('bookmarksHTML', $bookmarksHTML)->set('reportHTML', $reportHTML)->set('isEventGuest', $isEventGuest)->set('isMine', $isMine)->set('isAdmin', $isAdmin)->set('isCommunityAdmin', $isCommunityAdmin)->set('unapproved', $unapprovedCount)->set('waitingApproval', $waitingApproval)->set('wallContent', $wallContent)->set('eventMembers', $eventMembers)->set('eventMembersCount', $eventMembersCount)->set('editEvent', $editEvent)->set('my', $my)->set('memberStatus', $myStatus)->set('waitingRespond', $waitingRespond)->set('isInvited', $isInvited)->set('join', $join)->set('friendsCount', $friendsCount)->set('isPastEvent', $isPastEvent)->set('adminsList', $adminsList)->set('RSVPmessage', $RSVPmessage)->set('allday', $allday)->fetch('events.viewevent'); }