/** * Browse all available apps */ public function browse($data) { $this->addPathway(JText::_('COM_COMMUNITY_APPS_BROWSE')); // Load window library //CFactory::load( 'libraries' , 'window' ); // Load necessary window css / javascript headers. CWindow::load(); $mainframe = JFactory::getApplication(); $my = CFactory::getUser(); $pathway = $mainframe->getPathway(); $document = JFactory::getDocument(); $document->setTitle(JText::_('COM_COMMUNITY_APPS_BROWSE')); // Attach apps-related js $this->showSubMenu(); // Get application's favicon $addedAppCount = 0; foreach ($data->applications as $appData) { if (JFile::exists(CPluginHelper::getPluginPath('community', $appData->name) . '/' . $appData->name . '/favicon_64.png')) { $appData->appFavicon = JURI::root(true) . CPluginHelper::getPluginURI('community', $appData->name) . '/' . $appData->name . '/favicon_64.png'; } else { $appData->appFavicon = JURI::root(true) . '/components/com_community/assets/app_favicon.png'; } // Get total added applications $addedAppCount = $appData->added == 1 ? $addedAppCount + 1 : $addedAppCount; } $tmpl = new CTemplate(); echo $tmpl->set('applications', $data->applications)->set('pagination', $data->pagination)->set('addedAppCount', $addedAppCount)->fetch('applications.browse'); }
/** * Method to display video * **/ public function video() { $mainframe =& JFactory::getApplication(); $document = JFactory::getDocument(); $my = CFactory::getUser(); $videoId = JRequest::getVar('videoid', '', 'GET'); // Load window library CFactory::load('libraries', 'window'); // Load necessary window css / javascript headers. CWindow::load(); // Load the video table $video =& JTable::getInstance('Video', 'CTable'); if (!$video->load($videoId)) { $url = CRoute::_('index.php?option=com_community&view=videos', false); $mainframe->redirect($url, JText::_('COM_COMMUNITY_VIDEOS_NOT_AVAILABLE'), 'warning'); } CFactory::load('helpers', 'string'); // Set video thumbnail and description for social bookmarking sites linking $document->addHeadLink($video->getThumbnail(), 'image_src', 'rel'); $document->setDescription(CStringHelper::escape($video->getDescription())); CFactory::load('helpers', 'owner'); // Only add these links when there are photos in the album if (COwnerHelper::isCommunityAdmin() || $my->id == $video->creator && $my->id != 0) { $this->addSubmenuItem('', JText::_('COM_COMMUNITY_VIDEOS_FETCH_THUMBNAIL'), 'joms.videos.fetchThumbnail(\'' . $video->id . '\')', true); // Only add the set as profile video for video owner if ($my->id == $video->creator) { $this->addSubmenuItem('', JText::_('COM_COMMUNITY_VIDEOS_SET_AS_PROFILE'), 'joms.videos.linkConfirmProfileVideo(\'' . $video->id . '\')', true); } $this->addSubmenuItem('', JText::_('COM_COMMUNITY_DELETE'), 'joms.videos.deleteVideo(\'' . $video->id . '\')', true); } $this->_addSubmenu(); $this->showSubmenu(); if ($video->creator_type == VIDEO_GROUP_TYPE) { $this->_groupVideo(); } else { $this->_userVideo(); } }
<?php /** * @copyright (C) 2013 iJoomla, Inc. - All rights reserved. * @license GNU General Public License, version 2 (http://www.gnu.org/licenses/gpl-2.0.html) * @author iJoomla.com <*****@*****.**> * @url https://www.jomsocial.com/license-agreement * The PHP code portions are distributed under the GPL license. If not otherwise stated, all images, manuals, cascading style sheets, and included JavaScript *are NOT GPL, and are released under the IJOOMLA Proprietary Use License v1.0 * More info at https://www.jomsocial.com/license-agreement */ defined('_JEXEC') or die('Restricted access'); // Include the syndicate functions only once require_once dirname(__FILE__) . '/helper.php'; require_once JPATH_BASE . '/components/com_community/libraries/core.php'; CWindow::load(); $document = JFactory::getDocument(); $document->addStyleSheet(JURI::root(true) . '/modules/mod_hellome/style.css'); JFactory::getLanguage()->isRTL() ? CTemplate::addStylesheet('style.rtl') : CTemplate::addStylesheet('style'); $config = CFactory::getConfig(); $my = CFactory::getUser(); require JModuleHelper::getLayoutPath('mod_hellome', $params->get('layout', 'default'));
/** * 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'); }
/** * Method to display video * **/ public function video() { $mainframe =& JFactory::getApplication(); $document = JFactory::getDocument(); $config = CFactory::getConfig(); $my = CFactory::getUser(); $videoId = JRequest::getVar('videoid', '', 'GET'); $groupId = JRequest::getVar('groupid', '', 'GET'); // Get show video location map by default $videoMapsDefault = $config->get('videosmapdefault'); // Load window library CFactory::load('libraries', 'window'); // Load necessary window css / javascript headers. CWindow::load(); // Load the video table // Load string helper CFactory::load('helpers', 'string'); $video =& JTable::getInstance('Video', 'CTable'); if (empty($videoId)) { $url = CRoute::_('index.php?option=com_community&view=videos', false); $mainframe->redirect($url, JText::_('COM_COMMUNITY_VIDEOS_ID_ERROR'), 'warning'); } if (!$video->load($videoId)) { $url = CRoute::_('index.php?option=com_community&view=videos', false); $mainframe->redirect($url, JText::_('COM_COMMUNITY_VIDEOS_NOT_AVAILABLE'), 'warning'); } // Setting up the sub menu CFactory::load('helpers', 'owner'); if (COwnerHelper::isCommunityAdmin() || $my->id == $video->creator && $my->id != 0) { $this->addSubmenuItem('', JText::_('COM_COMMUNITY_VIDEOS_FETCH_THUMBNAIL'), 'joms.videos.fetchThumbnail(\'' . $video->id . '\')', true); // Only add the set as profile video for video owner if ($my->id == $video->creator) { $this->addSubmenuItem('', JText::_('COM_COMMUNITY_VIDEOS_SET_AS_PROFILE'), 'joms.videos.linkConfirmProfileVideo(\'' . $video->id . '\')', true); } $redirectUrl = CRoute::getURI(false); $this->addSubmenuItem('', JText::_('COM_COMMUNITY_EDIT'), 'joms.videos.showEditWindow(\'' . $video->id . '\',\'' . $redirectUrl . '\');', true); $this->addSubmenuItem('', JText::_('COM_COMMUNITY_DELETE'), 'joms.videos.deleteVideo(\'' . $video->id . '\')', true); } $this->_addSubmenu(); $this->showSubmenu(); // Show the mini header when viewing other's photos if ($video->creator_type == VIDEO_USER_TYPE && $my->id != $video->creator) { $this->attachMiniHeaderUser($video->creator); } // Check permission $user = CFactory::getUser($video->creator); $blocked = $user->isBlocked(); if ($blocked && !COwnerHelper::isCommunityAdmin()) { $tmpl = new CTemplate(); echo $tmpl->fetch('profile.blocked'); return; } $sorted = JRequest::getVar('sort', 'latest'); $limit = JRequest::getVar('limitstart', 6); $permissions = $my->id == 0 ? 0 : 20; $cat_id = JRequest::getVar('cat_id', ''); $model = CFactory::getModel('videos'); if ($video->creator_type == VIDEO_GROUP_TYPE) { CFactory::load('helpers', 'group'); if (!CGroupHelper::allowViewMedia($groupId)) { $document->setTitle(JText::_('COM_COMMUNITY_RESTRICTED_ACCESS')); $mainframe->enqueueMessage(JText::_('COM_COMMUNITY_RESTRICTED_ACCESS', 'notice')); echo JText::_('COM_COMMUNITY_GROUPS_VIDEO_MEMBER_PERMISSION'); return; } $group =& JTable::getInstance('Group', 'CTable'); $group->load($groupId); // Set pathway $pathway =& $mainframe->getPathway(); $pathway->addItem(JText::_('COM_COMMUNITY_GROUPS'), CRoute::_('index.php?option=com_community&view=groups')); $pathway->addItem($group->name, CRoute::_('index.php?option=com_community&view=groups&task=viewgroup&groupid=' . $groupId)); $pathway->addItem(JText::_('COM_COMMUNITY_VIDEOS'), CRoute::_('index.php?option=com_community&view=videos&groupid=' . $groupId)); $pathway->addItem($video->getTitle(), ''); $otherVideos = $model->getGroupVideos($groupId, $cat_id, $limit); } else { if (!$this->isPermitted($my->id, $video->creator, $video->permissions)) { $document->setTitle(JText::_('COM_COMMUNITY_RESTRICTED_ACCESS')); $mainframe->enqueueMessage(JText::_('COM_COMMUNITY_RESTRICTED_ACCESS', 'notice')); switch ($video->permissions) { case '40': $this->noAccess(JText::_('COM_COMMUNITY_VIDEOS_OWNER_ONLY', 'notice')); break; case '30': $owner = CFactory::getUser($video->creator); $this->noAccess(JText::sprintf('COM_COMMUNITY_VIDEOS_FRIEND_PERMISSION_MESSAGE', $owner->getDisplayName())); break; default: $this->noAccess(); break; } return; } // Set pathway $pathway =& $mainframe->getPathway(); $pathway->addItem('Video', CRoute::_('index.php?option=com_community&view=videos')); $pathway->addItem($video->getTitle(), ''); $filters = array('status' => 'ready', 'category_id' => $cat_id, 'creator' => $user->id, 'permissions' => $permissions, 'or_group_privacy' => 0, 'sorting' => $sorted, 'limit' => $limit); $otherVideos = $model->getVideos($filters); } //var_dump($otherVideos); // Set the current user's active profile CFactory::setActiveProfile($video->creator); // Hit counter + 1 $video->hit(); // Get reporting html $reportHTML = ''; CFactory::load('libraries', 'reporting'); $report = new CReportingLibrary(); $reportHTML = $report->getReportingHTML(JText::_('COM_COMMUNITY_VIDEOS_REPORT_VIDEOS'), 'videos,reportVideo', array($video->id)); // Get bookmark html CFactory::load('libraries', 'bookmarks'); $bookmarks = new CBookmarks($video->getPermalink()); $bookmarksHTML = $bookmarks->getHTML(); // Get the walls CFactory::load('libraries', 'wall'); $wallContent = CWallLibrary::getWallContents('videos', $video->id, COwnerHelper::isCommunityAdmin() || $my->id == $video->creator && $my->id != 0, 10, 0); $wallCount = CWallLibrary::getWallCount('videos', $video->id); $viewAllLink = false; if (JRequest::getVar('task', '', 'REQUEST') != 'app') { $viewAllLink = CRoute::_('index.php?option=com_community&view=videos&task=app&videoid=' . $video->id . '&app=walls'); } $wallContent .= CWallLibrary::getViewAllLinkHTML($viewAllLink, $wallCount); $wallForm = ''; if ($this->isPermitted($my->id, $video->creator, PRIVACY_FRIENDS) || !$config->get('lockvideoswalls')) { $wallForm = CWallLibrary::getWallInputForm($video->id, 'videos,ajaxSaveWall', 'videos,ajaxRemoveWall', $viewAllLink); } $redirectUrl = CRoute::getURI(false); // Get like CFactory::load('libraries', 'like'); $likes = new CLike(); $likesHTML = $likes->getHTML('videos', $video->id, $my->id); $tmpl = new CTemplate(); if ($video->creator_type == VIDEO_GROUP_TYPE) { $group =& JTable::getInstance('Group', 'CTable'); $group->load($groupId); $document = JFactory::getDocument(); $document->addHeadLink($group->getThumbAvatar(), 'image_src', 'rel'); } if ($video->location !== '' && $videoMapsDefault == 1) { CFactory::load('libraries', 'mapping'); $zoomableMap = CMapping::drawZoomableMap($video->location, 220, 150); } else { $zoomableMap = ""; } echo $tmpl->setMetaTags('video', $video)->set('user', $user)->set('zoomableMap', $zoomableMap)->set('likesHTML', $likesHTML)->set('redirectUrl', $redirectUrl)->set('wallForm', $wallForm)->set('wallContent', $wallContent)->set('bookmarksHTML', $bookmarksHTML)->set('reportHTML', $reportHTML)->set('video', $video)->set('otherVideos', $otherVideos)->fetch('videos.video'); }
/** * Displays single photo view * **/ function photo() { $mainframe =& JFactory::getApplication(); $document =& JFactory::getDocument(); // Load window library CFactory::load('libraries', 'window'); CWindow::load(); // Get the configuration object. $config = CFactory::getConfig(); $css = JURI::root() . 'components/com_community/assets/album.css'; $document->addStyleSheet($css); $css = JURI::root() . 'components/com_community/assets/photos.css'; $document->addStyleSheet($css); $js = 'assets/gallery'; $js .= $config->getBool('usepackedjavascript') ? '.pack.js' : '.js'; CAssets::attach($js, 'js'); $albumId = JRequest::getVar('albumid', '', 'GET'); if (empty($albumId)) { echo JText::_('CC NO PROPER ALBUM ID'); return; } CFactory::load('models', 'photos'); // Load the album table $album =& JTable::getInstance('Album', 'CTable'); $album->load($albumId); if ($album->type == PHOTOS_GROUP_TYPE) { $this->_groupPhoto(); } else { $this->_userPhoto(); } }
/** * Attach necessary scripts and stylesheets for the toolbar to operate correctly on 3rd party * environments. **/ private function attachHeaders() { $document =& JFactory::getDocument(); $config = CFactory::getConfig(); if ($document->getType() != 'html') { return; } $js = 'assets/window-1.0'; $js .= $config->getBool('usepackedjavascript') ? '.pack.js' : '.js'; CAssets::attach($js, 'js'); $js = 'assets/script-1.2'; $js .= $config->getBool('usepackedjavascript') ? '.pack.js' : '.js'; CAssets::attach($js, 'js'); CFactory::load('libraries', 'template'); CTemplate::addStylesheet('style'); $templateParams = CTemplate::getTemplateParams(); CTemplate::addStylesheet('style.' . $templateParams->get('colorTheme')); // Load rtl stylesheet if ($document->direction == 'rtl') { CTemplate::addStylesheet('style.rtl'); } // This need to be loaded so the popups will work correctly in notification window CFactory::load('libraries', 'window'); CWindow::load(); $template = new CTemplateHelper(); $styleIE7 = $template->getTemplateAsset('styleIE7', 'css'); $styleIE6 = $template->getTemplateAsset('styleIE6', 'css'); $css = '<!-- Jom Social --> <!--[if IE 7.0]> <link rel="stylesheet" href="' . $styleIE7->url . '" type="text/css" /> <![endif]--> <!--[if lte IE 6]> <link rel="stylesheet" href="' . $styleIE6->url . '" type="text/css" /> <![endif]-->'; $document->addCustomTag($css); $css = 'assets/autocomplete.css'; CAssets::attach($css, 'css'); // Load joms.ajax CTemplate::addScript('joms.ajax'); }
/** * Method to display video * **/ function video() { $mainframe =& JFactory::getApplication(); $document =& JFactory::getDocument(); $config = CFactory::getConfig(); $my = CFactory::getUser(); $videoId = JRequest::getVar('videoid', '', 'GET'); $groupId = JRequest::getVar('groupid', '', 'GET'); // Load window library CFactory::load('libraries', 'window'); // Load necessary window css / javascript headers. CWindow::load(); // Load the video table // Load string helper CFactory::load('helpers', 'string'); $video =& JTable::getInstance('Video', 'CTable'); if (empty($videoId)) { $url = CRoute::_('index.php?option=com_community&view=videos', false); $mainframe->redirect($url, JText::_('CC NO PROPER VIDEO ID'), 'warning'); } if (!$video->load($videoId)) { $url = CRoute::_('index.php?option=com_community&view=videos', false); $mainframe->redirect($url, JText::_('CC VIDEO NOT AVAILABLE'), 'warning'); } // Setting up the sub menu CFactory::load('helpers', 'owner'); if (COwnerHelper::isCommunityAdmin() || $my->id == $video->creator && $my->id != 0) { $this->addSubmenuItem('', JText::_('CC FETCH VIDEO THUMBNAIL'), 'joms.videos.fetchThumbnail(\'' . $video->id . '\')', true); // Only add the set as profile video for video owner if ($my->id == $video->creator) { $this->addSubmenuItem('', JText::_('CC SET AS PROFILE VIDEO'), 'joms.videos.linkConfirmProfileVideo(\'' . $video->id . '\')', true); } $redirectUrl = CRoute::getURI(false); $this->addSubmenuItem('', JText::_('CC EDIT'), 'joms.videos.showEditWindow(\'' . $video->id . '\',\'' . $redirectUrl . '\');', true); $this->addSubmenuItem('', JText::_('CC DELETE'), 'joms.videos.deleteVideo(\'' . $video->id . '\')', true); } $this->_addSubmenu(); $this->showSubmenu(); // Show the mini header when viewing other's photos if ($video->creator_type == VIDEO_USER_TYPE && $my->id != $video->creator) { $this->attachMiniHeaderUser($video->creator); } // Check permission $user = CFactory::getUser($video->creator); $blocked = $user->isBlocked(); if ($blocked && !COwnerHelper::isCommunityAdmin()) { $tmpl = new CTemplate(); echo $tmpl->fetch('profile.blocked'); return; } if ($video->creator_type == VIDEO_GROUP_TYPE) { CFactory::load('helpers', 'group'); if (!CGroupHelper::allowViewMedia($groupId)) { $document->setTitle(JText::_('CC RESTRICTED ACCESS')); $mainframe->enqueueMessage(JText::_('CC RESTRICTED ACCESS', 'notice')); echo JText::_('CC VIDEO NEED GROUP MEMBER PERMISSION'); return; } $group =& JTable::getInstance('Group', 'CTable'); $group->load($groupId); // Set pathway $pathway =& $mainframe->getPathway(); $pathway->addItem(JText::_('CC GROUPS'), CRoute::_('index.php?option=com_community&view=groups')); $pathway->addItem($group->name, CRoute::_('index.php?option=com_community&view=groups&task=viewgroup&groupid=' . $groupId)); $pathway->addItem(JText::_('CC VIDEOS'), CRoute::_('index.php?option=com_community&view=videos&groupid=' . $groupId)); $pathway->addItem($video->getTitle(), ''); } else { if (!$this->isPermitted($my->id, $video->creator, $video->permissions)) { $document->setTitle(JText::_('CC RESTRICTED ACCESS')); $mainframe->enqueueMessage(JText::_('CC RESTRICTED ACCESS', 'notice')); switch ($video->permissions) { case '40': echo JText::_('CC VIDEO OWNNER ONLY', 'notice'); break; case '30': $owner = CFactory::getUser($video->creator); echo JText::sprintf('CC VIDEO NEED FRIEND PERMISSION', $owner->getDisplayName()); break; default: echo '<p>' . JText::_('CC VIDEO NEED LOGIN', 'notice') . '</p>'; break; } return; } // Set pathway $pathway =& $mainframe->getPathway(); $pathway->addItem('Video', CRoute::_('index.php?option=com_community&view=videos')); $pathway->addItem($video->getTitle(), ''); } // Set the current user's active profile CFactory::setActiveProfile($video->creator); // Hit counter + 1 $video->hit(); // Get reporting html $reportHTML = ''; CFactory::load('libraries', 'reporting'); $report = new CReportingLibrary(); $reportHTML = $report->getReportingHTML(JText::_('CC REPORT VIDEOS'), 'videos,reportVideo', array($video->id)); // Get bookmark html CFactory::load('libraries', 'bookmarks'); $bookmarks = new CBookmarks($video->getPermalink()); $bookmarksHTML = $bookmarks->getHTML(); // Get the walls CFactory::load('libraries', 'wall'); $wallContent = CWallLibrary::getWallContents('videos', $video->id, COwnerHelper::isCommunityAdmin() || $my->id == $video->creator && $my->id != 0, 10, 0); $wallCount = CWallLibrary::getWallCount('videos', $video->id); $viewAllLink = false; if (JRequest::getVar('task', '', 'REQUEST') != 'app') { $viewAllLink = CRoute::_('index.php?option=com_community&view=videos&task=app&videoid=' . $video->id . '&app=walls'); } $wallContent .= CWallLibrary::getViewAllLinkHTML($viewAllLink, $wallCount); $wallForm = ''; $wallForm = CWallLibrary::getWallInputForm($video->id, 'videos,ajaxSaveWall', 'videos,ajaxRemoveWall', $viewAllLink); $redirectUrl = CRoute::getURI(false); // Get like CFactory::load('libraries', 'like'); $likes = new CLike(); $likesHTML = $likes->getHTML('videos', $video->id, $my->id); $tmpl = new CTemplate(); $tmpl->setMetaTags('video', $video); if ($video->creator_type == VIDEO_GROUP_TYPE) { $group =& JTable::getInstance('Group', 'CTable'); $group->load($groupId); $document =& JFactory::getDocument(); $document->addHeadLink($group->getThumbAvatar(), 'image_src', 'rel'); } $tmpl->set('likesHTML', $likesHTML); $tmpl->set('redirectUrl', $redirectUrl); $tmpl->set('wallForm', $wallForm); $tmpl->set('wallContent', $wallContent); $tmpl->set('bookmarksHTML', $bookmarksHTML); $tmpl->set('reportHTML', $reportHTML); $tmpl->set('video', $video); echo $tmpl->fetch('videos.video'); }
/** * Display a list of pending friend requests * */ public function pending($data = null) { if (!$this->accessAllowed('registered')) { return; } $mainframe = JFactory::getApplication(); $config = CFactory::getConfig(); CWindow::load(); $my = CFactory::getUser(); if ($my->id == 0) { $mainframe->enqueueMessage(JText::_('COM_COMMUNITY_PLEASE_LOGIN_WARNING'), 'error'); return; } // Set pathway $this->addPathway(JText::_('COM_COMMUNITY_FRIENDS'), CRoute::_('index.php?option=com_community&view=friends')); $this->addPathway(JText::_('COM_COMMUNITY_FRIENDS_AWAITING_AUTHORIZATION'), ''); /** * Opengraph */ CHeadHelper::setType('website', JText::_('COM_COMMUNITY_FRIENDS_AWAITING_AUTHORIZATION')); // Load submenu //$this->showSubMenu(); $rows = !empty($data->pending) ? $data->pending : array(); for ($i = 0; $i < count($rows); $i++) { $row = $rows[$i]; $row->user = CFactory::getUser($row->id); $row->user->friendsCount = $row->user->getFriendCount(); $row->user->profileLink = CUrlHelper::userLink($row->id); $row->msg = $this->escape($row->msg); } //Featured $featured = new CFeatured(FEATURED_USERS); $featuredList = $featured->getItemIds(); $tmpl = new CTemplate(); echo $tmpl->set('rows', $rows)->setRef('my', $my)->set('config', $config)->set('pagination', $data->pagination)->set('submenu', $this->showSubmenu(false))->set('featuredList', $featuredList)->fetch('friends/request-received'); }
/** * Browse all available apps */ function browse($data) { $this->addPathway(JText::_('CC BROWSE APPS')); // Load window library CFactory::load('libraries', 'window'); // Load necessary window css / javascript headers. CWindow::load(); $mainframe =& JFactory::getApplication(); $my = CFactory::getUser(); $pathway =& $mainframe->getPathway(); $document =& JFactory::getDocument(); $document->setTitle(JText::_('CC BROWSE APPS')); // Attach apps-related js $this->showSubMenu(); // Get application's favicon $addedAppCount = 0; foreach ($data->applications as $appData) { if (JFile::exists(JPATH_ROOT . DS . 'plugins' . DS . 'community' . DS . $appData->name . DS . 'favicon_64.png')) { $appData->appFavicon = rtrim(JURI::root(), '/') . '/plugins/community/' . $appData->name . '/favicon_64.png'; } else { $appData->appFavicon = rtrim(JURI::root(), '/') . '/components/com_community/assets/app_favicon.png'; } // Get total added applications $addedAppCount = $appData->added == 1 ? $addedAppCount + 1 : $addedAppCount; } $tmpl = new CTemplate(); $tmpl->set('applications', $data->applications); $tmpl->set('pagination', $data->pagination); $tmpl->set('addedAppCount', $addedAppCount); echo $tmpl->fetch('applications.browse'); }
/** * Method to display video * @return void */ public function video() { $mainframe = JFactory::getApplication(); $jinput = $mainframe->input; $document = JFactory::getDocument(); $config = CFactory::getConfig(); $my = CFactory::getUser(); $requestUser = CFactory::getRequestUser(); $videoId = $jinput->get('videoid', '', 'INT'); $task = $jinput->getCmd('task'); // Get show video location map by default $videoMapsDefault = $config->get('videosmapdefault'); // Load window library CWindow::load(); $video = JTable::getInstance('Video', 'CTable'); if (empty($videoId)) { if ($jinput->get('videoid', '', 'INT')) { $videoId = $jinput->get('videoid', '', 'INT'); } else { $url = CRoute::_('index.php?option=com_community&view=videos', false); $mainframe->redirect($url, JText::_('COM_COMMUNITY_VIDEOS_ID_ERROR'), 'warning'); } } if (!$video->load($videoId)) { $url = CRoute::_('index.php?option=com_community&view=videos', false); $mainframe->redirect($url, JText::_('COM_COMMUNITY_VIDEOS_NOT_AVAILABLE'), 'warning'); } if ($video->groupid) { JRequest::setVar('groupid', $video->groupid); } elseif ($video->eventid) { JRequest::setVar('eventid', $video->eventid); } // Setting up the sub menu if (COwnerHelper::isCommunityAdmin() || $my->id == $video->creator && $my->id != 0) { $this->addSubmenuItem('', JText::_('COM_COMMUNITY_VIDEOS_FETCH_THUMBNAIL'), "joms.api.videoFetchThumbnail('" . $video->id . "');", true); // Only add the set as profile video for video owner if ($my->id == $video->creator && $config->get('enableprofilevideo')) { $this->addSubmenuItem('', JText::_('COM_COMMUNITY_VIDEOS_SET_AS_PROFILE'), "joms.api.videoLinkToProfile('" . $video->id . "');", true); } $redirectUrl = CRoute::getURI(false); $this->addSubmenuItem('', JText::_('COM_COMMUNITY_EDIT'), "joms.api.videoEdit('" . $video->id . "');", true); $this->addSubmenuItem('', JText::_('COM_COMMUNITY_DELETE'), "joms.api.videoRemove('" . $video->id . "');", true); } $this->_addSubmenu(); // Show the mini header when viewing other's photos if ($video->creator_type == VIDEO_USER_TYPE && $my->id != $video->creator) { // $this->attachMiniHeaderUser($video->creator); } // Check permission $user = CFactory::getUser($video->creator); $blocked = $user->isBlocked(); if ($blocked && !COwnerHelper::isCommunityAdmin()) { $tmpl = new CTemplate(); echo $tmpl->fetch('profile.blocked'); return; } $sorted = $jinput->get('sort', 'latest', 'STRING'); $limit = $jinput->get('limitstart', 6, 'INT'); $permissions = $my->id == 0 ? 0 : 20; $cat_id = $jinput->get('cat_id', '', 'INT'); $model = CFactory::getModel('videos'); /* We get groupid from video table instead user input */ $groupId = $video->groupid; if ($video->creator_type == VIDEO_GROUP_TYPE) { if (!CGroupHelper::allowViewMedia($groupId)) { /** * Opengraph */ CHeadHelper::setType('website', JText::_('COM_COMMUNITY_RESTRICTED_ACCESS')); $mainframe->enqueueMessage(JText::_('COM_COMMUNITY_RESTRICTED_ACCESS', 'notice')); echo JText::_('COM_COMMUNITY_GROUPS_VIDEO_MEMBER_PERMISSION'); return; } $group = JTable::getInstance('Group', 'CTable'); $group->load($groupId); // Set pathway $pathway = $mainframe->getPathway(); $pathway->addItem(JText::_('COM_COMMUNITY_GROUPS'), CRoute::_('index.php?option=com_community&view=groups')); $pathway->addItem($group->name, CRoute::_('index.php?option=com_community&view=groups&task=viewgroup&groupid=' . $groupId)); $pathway->addItem(JText::_('COM_COMMUNITY_VIDEOS'), CRoute::_('index.php?option=com_community&view=videos&task=display&groupid=' . $groupId)); $pathway->addItem($video->getTitle(), ''); $otherVideos = $model->getGroupVideos($groupId, $cat_id, $limit); } else { if (!$this->isPermitted($my->id, $video->creator, $video->permissions)) { /** * Opengraph */ CHeadHelper::setType('website', JText::_('COM_COMMUNITY_RESTRICTED_ACCESS')); $mainframe->enqueueMessage(JText::_('COM_COMMUNITY_RESTRICTED_ACCESS', 'notice')); switch ($video->permissions) { case '40': $this->noAccess(JText::_('COM_COMMUNITY_VIDEOS_OWNER_ONLY', 'notice')); break; case '30': $owner = CFactory::getUser($video->creator); $this->noAccess(JText::sprintf('COM_COMMUNITY_VIDEOS_FRIEND_PERMISSION_MESSAGE', $owner->getDisplayName())); break; default: $this->noAccess(); break; } return; } // Set pathway $pathway = $mainframe->getPathway(); $pathway->addItem('Video', CRoute::_('index.php?option=com_community&view=videos')); $pathway->addItem($video->getTitle(), ''); $filters = array('status' => 'ready', 'category_id' => $cat_id, 'creator' => $user->id, 'permissions' => $permissions, 'or_group_privacy' => 0, 'sorting' => $sorted, 'limit' => $limit); $otherVideos = $model->getVideos($filters); } // Set the current user's active profile CFactory::setActiveProfile($video->creator); // Hit counter + 1 $video->hit(); // Get reporting html $reportHTML = ''; $report = new CReportingLibrary(); if ($user->id != $my->id) { $reportHTML = $report->getReportingHTML(JText::_('COM_COMMUNITY_VIDEOS_REPORT_VIDEOS'), 'videos,reportVideo', array($video->id)); } // Get bookmark html $bookmarks = new CBookmarks($video->getPermalink()); $bookmarksHTML = $bookmarks->getHTML(); // Get the walls $wallContent = CWallLibrary::getWallContents('videos', $video->id, COwnerHelper::isCommunityAdmin() || $my->id == $video->creator && $my->id != 0, $config->get('stream_default_comments'), 0, 'wall/content', 'videos,video'); $wallCount = CWallLibrary::getWallCount('videos', $video->id); $viewAllLink = CRoute::_('index.php?option=com_community&view=videos&task=app&videoid=' . $video->id . '&app=walls'); $wallViewAll = ''; if ($wallCount > $config->get('stream_default_comments')) { $wallViewAll = CWallLibrary::getViewAllLinkHTML($viewAllLink, $wallCount); } $wallForm = ''; if ($this->isPermitted($my->id, $video->creator, PRIVACY_FRIENDS) || !$config->get('lockvideoswalls')) { $wallForm = CWallLibrary::getWallInputForm($video->id, 'videos,ajaxSaveWall', 'videos,ajaxRemoveWall', $viewAllLink); } $redirectUrl = CRoute::getURI(false); // Get like information. $like = new CLike(); $likeCount = $like->getLikeCount('videos', $video->id); $likeLiked = $like->userLiked('videos', $video->id, $my->id) === COMMUNITY_LIKE; $tmpl = new CTemplate(); if ($video->creator_type == VIDEO_GROUP_TYPE) { $group = JTable::getInstance('Group', 'CTable'); $group->load($groupId); $document = JFactory::getDocument(); $document->addHeadLink($group->getThumbAvatar(), 'image_src', 'rel'); } if ($video->location !== '' && $videoMapsDefault) { $zoomableMap = CMapping::drawZoomableMap($video->location, 220, 150, $video->longitude, $video->latitude); } else { $zoomableMap = ""; } //friend list for video tag $tagging = new CVideoTagging(); $taggedList = $tagging->getTaggedList($video->id); for ($t = 0; $t < count($taggedList); $t++) { $tagItem = $taggedList[$t]; $tagUser = CFactory::getUser($tagItem->userid); $canRemoveTag = 0; // 1st we check the tagged user is the video owner. // If yes, canRemoveTag == true. // If no, then check on user is the tag creator or not. // If yes, canRemoveTag == true // If no, then check on user whether user is being tagged if (COwnerHelper::isMine($my->id, $video->creator) || COwnerHelper::isMine($my->id, $tagItem->created_by) || COwnerHelper::isMine($my->id, $tagItem->userid)) { $canRemoveTag = 1; } $tagItem->user = $tagUser; $tagItem->canRemoveTag = $canRemoveTag; } if ($video->type == "file") { $storage = CStorage::getStorage($video->storage); $video->path = $storage->getURI($video->path); } $config = CFactory::getConfig(); $canSearch = 1; if ($my->id == 0 && !$config->get('enableguestsearchvideos')) { $canSearch = 0; } CHeadHelper::addOpengraph('og:image', JUri::root() . $video->thumb, true); CHeadHelper::setType('website', $video->title); $video->tagged = $taggedList; echo $tmpl->setMetaTags('video', $video)->set('user', $user)->set('zoomableMap', $zoomableMap)->set('likeCount', $likeCount)->set('canSearch', $canSearch)->set('likeLiked', $likeLiked)->set('redirectUrl', $redirectUrl)->set('wallContent', $wallContent)->set('wallForm', $wallForm)->set('wallCount', $wallCount)->set('wallViewAll', $wallViewAll)->set('bookmarksHTML', $bookmarksHTML)->set('reportHTML', $reportHTML)->set('video', $video)->set('otherVideos', $otherVideos)->set('videoMapsDefault', $videoMapsDefault)->set('wallCount', $wallCount)->set('isGroup', $groupId ? true : false)->set('groupId', $groupId ? $groupId : null)->set('submenu', $this->showSubmenu(false))->fetch('videos/single'); }
public function editPage() { if (!$this->accessAllowed('registered')) { return; } $my = CFactory::getUser(); $appsModel = CFactory::getModel('apps'); //------ pre-1.8 ------// // Get coreapps $coreApps = $appsModel->getCoreApps(); for ($i = 0; $i < count($coreApps); $i++) { $appInfo = $appsModel->getAppInfo($coreApps[$i]->apps); // @rule: Try to get proper app id from #__community_users table first. $id = $appsModel->getUserApplicationId($coreApps[$i]->apps, $my->id); // @rule: If there aren't any records, we need to get it from #__plugins table. if (empty($id)) { $id = $appsModel->getPluginId($coreApps[$i]->apps, null, true); } $coreApps[$i]->id = $id; $coreApps[$i]->title = $appInfo->title; $coreApps[$i]->description = $appInfo->description; $coreApps[$i]->name = $coreApps[$i]->apps; //$coreApps[$i]->coreapp = $params->get( 'coreapp' ); //Get application favicon if (JFile::exists(CPluginHelper::getPluginPath('community', $coreApps[$i]->apps) . '/' . $coreApps[$i]->apps . '/favicon_64.png')) { $coreApps[$i]->appFavicon = JURI::root(true) . CPluginHelper::getPluginURI('community', $coreApps[$i]->apps) . '/' . $coreApps[$i]->apps . '/favicon_64.png'; } else { $coreApps[$i]->appFavicon = JURI::root(true) . '/components/com_community/assets/app_favicon.png'; } } //------ pre-1.8 ------// // Get user apps $userApps = $appsModel->getUserApps($my->id); $appItems = array(); $appItems['sidebar-top-core'] = ''; $appItems['sidebar-bottom-core'] = ''; $appItems['sidebar-top'] = ''; $appItems['sidebar-bottom'] = ''; $appItems['content'] = ''; $appItems['content-core'] = ''; $appsList = array(); for ($i = 0; $i < count($userApps); $i++) { // TODO: getUserApps should return all this value already $id = $appsModel->getPluginId($userApps[$i]->apps, null, true); $appInfo = $appsModel->getAppInfo($userApps[$i]->apps); $params = new CParameter($appsModel->getPluginParams($id, null)); $isCoreApp = $params->get('coreapp'); $corePosition = $params->get('position'); $userApps[$i]->title = isset($appInfo->title) ? $appInfo->title : ''; $userApps[$i]->description = isset($appInfo->description) ? $appInfo->description : ''; $userApps[$i]->coreapp = $isCoreApp; // Pre 1.8x $userApps[$i]->isCoreApp = $isCoreApp; $userApps[$i]->name = $userApps[$i]->apps; $userApps[$i]->hide_empty = $appInfo->hide_empty; //------ pre-1.8 ------// if (JFile::exists(CPluginHelper::getPluginPath('community', $userApps[$i]->apps) . '/favicon.png')) { $userApps[$i]->favicon['16'] = JURI::root(true) . CPluginHelper::getPluginURI('community', $userApps[$i]->apps) . '/' . $userApps[$i]->apps . '/favicon.png'; } else { $userApps[$i]->favicon['16'] = JURI::root(true) . '/components/com_community/assets/app_favicon.png'; } $position = !empty($userApps[$i]->position) ? $userApps[$i]->position : 'content' . ($isCoreApp ? '-core' : ''); // if this is core app, use the config from coreposition instead $position = $isCoreApp ? $corePosition : $position; $appsList[$position][] = $userApps[$i]; } foreach ($appsList as $position => $apps) { $tmpl = new CTemplate(); if (isset($appItems[$position])) { $appItems[$position] .= $tmpl->set('apps', $apps)->set('itemType', 'edit')->fetch('application.item'); } } // Get available apps for comparison $appsModel = CFactory::getModel('apps'); $apps = $appsModel->getAvailableApps(false); $appsname = array(); $availableApps = array(); if (!empty($apps)) { foreach ($apps as $data) { array_push($availableApps, $data->name); } } // Check if apps exist, if not delete it. $obsoleteApps = array(); $obsoleteApps = array_diff($appsname, $availableApps); if (!empty($obsoleteApps)) { foreach ($obsoleteApps as $key => $obsoleteApp) { $appRecords = $appsModel->checkObsoleteApp($obsoleteApp); if (empty($appRecords)) { if ($appRecords == NULL) { $appsModel->removeObsoleteApp($obsoleteApp); } unset($userApps[$key]); } } $userApps = array_values($userApps); } /** * Opengraph */ CHeadHelper::setType('website', JText::_('COM_COMMUNITY_APPS_MINE')); $this->addPathway(JText::_('COM_COMMUNITY_APPS_MINE')); //$this->showSubMenu(); // pre-1.8 //CFactory::load( 'libraries' , 'window' ); CWindow::load(); // CFactory::attach('assets/jquery.tablednd_0_5.js', 'js'); // pre-1.8 // CFactory::attach('assets/ui.core.js', 'js'); // CFactory::attach('assets/ui.sortable.js', 'js'); // CFactory::attach('assets/applayout.js', 'js'); $tmpl = new CTemplate(); echo $tmpl->set('coreApplications', $coreApps)->set('applications', $userApps)->set('appItems', $appItems)->set('submenu', $this->showSubmenu(false))->fetch('applications.edit'); }
public function editPage() { if (!$this->accessAllowed('registered')) { return; } $my = CFactory::getUser(); $appsModel = CFactory::getModel('apps'); //------ pre-1.8 ------// // Get coreapps $coreApps = $appsModel->getCoreApps(); for ($i = 0; $i < count($coreApps); $i++) { $appInfo = $appsModel->getAppInfo($coreApps[$i]->apps); // @rule: Try to get proper app id from #__community_users table first. $id = $appsModel->getUserApplicationId($coreApps[$i]->apps, $my->id); // @rule: If there aren't any records, we need to get it from #__plugins table. if (empty($id)) { $id = $appsModel->getPluginId($coreApps[$i]->apps, null, true); } $coreApps[$i]->id = $id; $coreApps[$i]->title = $appInfo->title; $coreApps[$i]->description = $appInfo->description; $coreApps[$i]->name = $coreApps[$i]->apps; //$coreApps[$i]->coreapp = $params->get( 'coreapp' ); //Get application favicon if (JFile::exists(CPluginHelper::getPluginPath('community', $coreApps[$i]->apps) . '/' . $coreApps[$i]->apps . '/favicon_64.png')) { $coreApps[$i]->appFavicon = JURI::root(true) . CPluginHelper::getPluginURI('community', $coreApps[$i]->apps) . '/' . $coreApps[$i]->apps . '/favicon_64.png'; } else { $coreApps[$i]->appFavicon = JURI::root(true) . '/components/com_community/assets/app_favicon.png'; } } //------ pre-1.8 ------// // Get user apps $userApps = $appsModel->getUserApps($my->id); $appsList = array(); for ($i = 0; $i < count($userApps); $i++) { // TODO: getUserApps should return all this value already $id = $appsModel->getPluginId($userApps[$i]->apps, null, true); $appInfo = $appsModel->getAppInfo($userApps[$i]->apps); $params = new CParameter($appsModel->getPluginParams($id, null)); $isCoreApp = $params->get('coreapp'); $corePosition = $params->get('position'); $userApps[$i]->title = isset($appInfo->title) ? $appInfo->title : ''; $userApps[$i]->description = isset($appInfo->description) ? $appInfo->description : ''; $userApps[$i]->coreapp = $isCoreApp; // Pre 1.8x $userApps[$i]->isCoreApp = $isCoreApp; $userApps[$i]->name = $userApps[$i]->apps; $userApps[$i]->hide_empty = isset($appInfo->hide_empty) ? $appInfo->hide_empty : 0; //------ pre-1.8 ------// if ($params->get('favicon') != '') { $userApps[$i]->favicon['64'] = JURI::root(true) . '/' . $params->get('favicon'); } elseif (JFile::exists(CPluginHelper::getPluginPath('community', $userApps[$i]->apps) . '/favicon_64.png')) { $userApps[$i]->favicon['64'] = JURI::root(true) . CPluginHelper::getPluginURI('community', $userApps[$i]->apps) . '/' . $userApps[$i]->apps . '/favicon_64.png'; } else { $userApps[$i]->favicon['64'] = JURI::root(true) . '/components/com_community/assets/app_avatar.png'; } if ($isCoreApp) { $position = $corePosition . (strpos($corePosition, '-core') === FALSE ? '-core' : ''); } else { $position = !empty($userApps[$i]->position) ? $userApps[$i]->position : 'content'; } $appsList[$position][] = $userApps[$i]; } foreach (array('sidebar-top', 'sidebar-bottom', 'sidebar-top-stacked', 'sidebar-bottom-stacked', 'content') as $position) { if (isset($appsList[$position . '-core'])) { if (!isset($appsList[$position])) { $appsList[$position] = array(); } $appsList[$position] = array_merge($appsList[$position . '-core'], $appsList[$position]); unset($appsList[$position . '-core']); } } $appTitles = array(); $appTitles['sidebar-top'] = ''; $appTitles['sidebar-top-stacked'] = ''; $appTitles['sidebar-bottom'] = ''; $appTitles['sidebar-bottom-stacked'] = ''; $appTitles['content'] = ''; $appItems = array(); $appItems['sidebar-top'] = ''; $appItems['sidebar-top-stacked'] = ''; $appItems['sidebar-bottom'] = ''; $appItems['sidebar-bottom-stacked'] = ''; $appItems['content'] = ''; foreach ($appsList as $position => $apps) { $tmpl = new CTemplate(); if (isset($appItems[$position])) { $appTitles[$position] .= $tmpl->set('apps', $apps)->set('position', $position)->fetch('application.title'); $appItems[$position] .= $tmpl->set('apps', $apps)->set('position', $position)->set('itemType', 'edit')->fetch('application.item'); } } // Get available apps for comparison $appsModel = CFactory::getModel('apps'); $apps = $appsModel->getAvailableApps(false); $appsname = array(); $availableApps = array(); if (!empty($apps)) { foreach ($apps as $data) { array_push($availableApps, $data->name); } } // Check if apps exist, if not delete it. $obsoleteApps = array(); $obsoleteApps = array_diff($appsname, $availableApps); if (!empty($obsoleteApps)) { foreach ($obsoleteApps as $key => $obsoleteApp) { $appRecords = $appsModel->checkObsoleteApp($obsoleteApp); if (empty($appRecords)) { if ($appRecords == NULL) { $appsModel->removeObsoleteApp($obsoleteApp); } unset($userApps[$key]); } } $userApps = array_values($userApps); } /** * Opengraph */ CHeadHelper::setType('website', JText::_('COM_COMMUNITY_APPS_MINE')); $this->addPathway(JText::_('COM_COMMUNITY_APPS_MINE')); //$this->showSubMenu(); // pre-1.8 //CFactory::load( 'libraries' , 'window' ); CWindow::load(); // CFactory::attach('assets/jquery.tablednd_0_5.js', 'js'); // pre-1.8 // CFactory::attach('assets/ui.core.js', 'js'); // CFactory::attach('assets/ui.sortable.js', 'js'); // CFactory::attach('assets/applayout.js', 'js'); // about me $tmpl = new CTemplate(); $lastLogin = JText::_('COM_COMMUNITY_PROFILE_NEVER_LOGGED_IN'); if ($my->lastvisitDate != '0000-00-00 00:00:00') { $myLastLogin = new JDate($my->lastvisitDate); $lastLogin = CActivityStream::_createdLapse($myLastLogin); } $profileModel = CFactory::getModel('profile'); $profileData = $profileModel->getViewableProfile($my->id, $my->getProfileType()); $multiprofile = JTable::getInstance('MultiProfile', 'CTable'); $multiprofile->load($my->getProfileType()); $aboutTitle = ucfirst(JText::_('COM_COMMUNITY_ABOUT_ME')); $aboutItem = $tmpl->set('registerDate', $my->registerDate)->set('lastLogin', $lastLogin)->set('about', $this->_getProfileHTML($profileData, true))->set('multiprofile', $multiprofile)->fetch('profile/aboutme'); $tmpl = new CTemplate(); echo $tmpl->set('coreApplications', $coreApps)->set('applications', $userApps)->set('appItems', $appItems)->set('appTitles', $appTitles)->set('aboutTitle', $aboutTitle)->set('aboutItem', $aboutItem)->set('submenu', $this->showSubmenu(false))->fetch('applications.edit'); }
/** * Display a list of pending friend requests **/ public function pending($data = null) { if (!$this->accessAllowed('registered')) { return; } $mainframe =& JFactory::getApplication(); $config = CFactory::getConfig(); // Load window library CFactory::load('libraries', 'window'); // Load necessary window css / javascript headers. CWindow::load(); $my = CFactory::getUser(); if ($my->id == 0) { $mainframe->enqueueMessage(JText::_('COM_COMMUNITY_PLEASE_LOGIN_WARNING'), 'error'); return; } // Set pathway $this->addPathway(JText::_('COM_COMMUNITY_FRIENDS'), CRoute::_('index.php?option=com_community&view=friends')); $this->addPathway(JText::_('COM_COMMUNITY_FRIENDS_AWAITING_AUTHORIZATION'), ''); // Set document title $document = JFactory::getDocument(); $document->setTitle(JText::_('COM_COMMUNITY_FRIENDS_AWAITING_AUTHORIZATION')); // Load submenu $this->showSubMenu(); $friends = CFactory::getModel('friends'); $rows = !empty($data->pending) ? $data->pending : array(); for ($i = 0; $i < count($rows); $i++) { $row =& $rows[$i]; $row->user = CFactory::getUser($row->id); $row->user->friendsCount = $row->user->getFriendCount(); $row->user->profileLink = CUrlHelper::userLink($row->id); $row->msg = $this->escape($row->msg); } $tmpl = new CTemplate(); echo $tmpl->set('rows', $rows)->setRef('my', $my)->set('config', $config)->set('pagination', $data->pagination)->fetch('friends.pending'); }
/** * View method to display specific discussion from a group * @since 2.4 * @access public * @param Object Data object passed from controller */ public function viewdiscussion() { $mainframe =& JFactory::getApplication(); $document = JFactory::getDocument(); $jconfig = JFactory::getConfig(); $config = CFactory::getConfig(); // Load window library CFactory::load('libraries', 'window'); // Load necessary window css / javascript headers. CWindow::load(); // Get necessary variables CFactory::load('models', 'groups'); CFactory::load('models', 'discussions'); $my = CFactory::getUser(); $groupId = JRequest::getInt('groupid', '', 'GET'); $topicId = JRequest::getInt('topicid', '', 'GET'); // Load necessary library and objects $groupModel = CFactory::getModel('groups'); $group =& JTable::getInstance('Group', 'CTable'); $discussion =& JTable::getInstance('Discussion', 'CTable'); $group->load($groupId); $discussion->load($topicId); $isBanned = $group->isBanned($my->id); $document->addCustomTag('<link rel="image_src" href="' . $group->getThumbAvatar() . '" />'); // @rule: Test if the group is unpublished, don't display it at all. if (!$group->published) { $this->_redirectUnpublishGroup(); return; } $feedLink = CRoute::_('index.php?option=com_community&view=groups&task=viewdiscussion&topicid=' . $topicId . '&format=feed'); $feed = '<link rel="alternate" type="application/rss+xml" title="' . JText::_('COM_COMMUNITY_GROUPS_LATEST_FEED') . '" href="' . $feedLink . '"/>'; $document->addCustomTag($feed); CFactory::load('helpers', 'owner'); if ($group->approvals == 1 && !$group->isMember($my->id) && !COwnerHelper::isCommunityAdmin()) { $this->noAccess(JText::_('COM_COMMUNITY_GROUPS_PRIVATE_NOTICE')); return; } // Execute discussion onDisplay filter $appsLib =& CAppPlugins::getInstance(); $appsLib->loadApplications(); $args = array(); $args[] =& $discussion; $appsLib->triggerEvent('onDiscussionDisplay', $args); // Get the discussion creator info $creator = CFactory::getUser($discussion->creator); // Format the date accordingly. //$discussion->created = CTimeHelper::getDate( $discussion->created ); $dayinterval = ACTIVITY_INTERVAL_DAY; $timeFormat = $config->get('activitiestimeformat'); $dayFormat = $config->get('activitiesdayformat'); if ($config->get('activitydateformat') == COMMUNITY_DATE_FIXED) { $discussion->created = CTimeHelper::getDate($discussion->created)->toFormat(JText::_('DATE_FORMAT_LC2'), true); } else { $discussion->created = CTimeHelper::timeLapse(CTimeHelper::getDate($discussion->created)); } // Set page title $document->setTitle(JText::sprintf('COM_COMMUNITY_GROUPS_DISCUSSION_TITTLE', $discussion->title)); // Add pathways $this->_addGroupInPathway($group->id); $this->addPathway(JText::_('COM_COMMUNITY_GROUPS_DISCUSSION'), CRoute::_('index.php?option=com_community&view=groups&task=viewdiscussions&groupid=' . $group->id)); $this->addPathway(JText::sprintf('COM_COMMUNITY_GROUPS_DISCUSSION_TITTLE', $discussion->title)); CFactory::load('helpers', 'owner'); $isGroupAdmin = $groupModel->isAdmin($my->id, $group->id); if ($my->id == $creator->id || $isGroupAdmin || COwnerHelper::isCommunityAdmin()) { $title = JText::_('COM_COMMUNITY_DELETE_DISCUSSION'); $titleLock = $discussion->lock ? JText::_('COM_COMMUNITY_UNLOCK_DISCUSSION') : JText::_('COM_COMMUNITY_LOCK_DISCUSSION'); $actionLock = $discussion->lock ? JText::_('COM_COMMUNITY_UNLOCK') : JText::_('COM_COMMUNITY_LOCK'); $this->addSubmenuItem('', $actionLock, "joms.groups.lockTopic('" . $titleLock . "','" . $group->id . "','" . $discussion->id . "');", SUBMENU_RIGHT); $this->addSubmenuItem('', JText::_('COM_COMMUNITY_DELETE'), "joms.groups.removeTopic('" . $title . "','" . $group->id . "','" . $discussion->id . "');", SUBMENU_RIGHT); $this->addSubmenuItem('index.php?option=com_community&view=groups&task=editdiscussion&groupid=' . $group->id . '&topicid=' . $discussion->id, JText::_('COM_COMMUNITY_EDIT'), '', SUBMENU_RIGHT); } $this->showSubmenu(); CFactory::load('libraries', 'wall'); $wallContent = CWallLibrary::getWallContents('discussions', $discussion->id, $isGroupAdmin, $jconfig->get('list_limit'), 0, 'wall.content', 'groups,discussion'); $wallCount = CWallLibrary::getWallCount('discussions', $discussion->id); $viewAllLink = CRoute::_('index.php?option=com_community&view=groups&task=discussapp&topicid=' . $discussion->id . '&app=walls'); $wallContent .= CWallLibrary::getViewAllLinkHTML($viewAllLink, $wallCount); // Test if the current browser is a member of the group $isMember = $group->isMember($my->id); $waitingApproval = false; // If I have tried to join this group, but not yet approved, display a notice if ($groupModel->isWaitingAuthorization($my->id, $group->id)) { $waitingApproval = true; } $wallForm = ''; $config = CFactory::getConfig(); // Only get the wall form if user is really allowed to see it. if (!$config->get('lockgroupwalls') || $config->get('lockgroupwalls') && $isMember && !$isBanned && !$waitingApproval || COwnerHelper::isCommunityAdmin()) { $outputLock = '<div class="warning">' . JText::_('COM_COMMUNITY_DISCUSSION_LOCKED_NOTICE') . '</div>'; $outputUnLock = CWallLibrary::getWallInputForm($discussion->id, 'groups,ajaxSaveDiscussionWall', 'groups,ajaxRemoveReply'); $wallForm = '<div class="wall-tittle">' . JText::_('COM_COMMUNITY_REPLIES') . '</div>'; $wallForm .= $discussion->lock ? $outputLock : $outputUnLock; } if (empty($wallForm)) { //user must join in order to see this page $tmpl = new CTemplate(); $wallForm = $tmpl->set('groupid', $groupId)->fetch('groups.joingroup'); $outputLock = '<div class="warning">' . JText::_('COM_COMMUNITY_DISCUSSION_LOCKED_NOTICE') . '</div>'; $outputUnLock = CWallLibrary::getWallInputForm($discussion->id, 'groups,ajaxSaveDiscussionWall', 'groups,ajaxRemoveReply'); $wallForm2 = '<div class="wall-tittle">' . JText::_('COM_COMMUNITY_REPLIES') . '</div>'; $wallForm2 .= $discussion->lock ? $outputLock : $outputUnLock; $wallForm = $wallForm . '<div style="display:none" class="reply-form">' . $wallForm2 . '</div>'; } $config = CFactory::getConfig(); // Get creator link $creatorLink = CRoute::_('index.php?option=com_community&view=profile&userid=' . $creator->id); // Get reporting html CFactory::load('libraries', 'reporting'); $report = new CReportingLibrary(); $reportHTML = $report->getReportingHTML(JText::_('COM_COMMUNITY_GROUPS_DISCUSSION_REPORT'), 'groups,reportDiscussion', array($discussion->id)); CFactory::load('libraries', 'bookmarks'); $bookmarks = new CBookmarks(CRoute::getExternalURL('index.php?option=com_community&view=groups&task=viewdiscussion&groupid=' . $group->id . '&topicid=' . $discussion->id)); $bookmarksHTML = $bookmarks->getHTML(); $tmpl = new CTemplate(); echo $tmpl->set('bookmarksHTML', $bookmarksHTML)->set('discussion', $discussion)->set('creator', $creator)->set('wallContent', $wallContent)->set('wallForm', $wallForm)->set('creatorLink', $creatorLink)->set('reportHTML', $reportHTML)->set('groupid', $groupId)->fetch('groups.viewdiscussion'); }
public function attachHeaders() { $document = JFactory::getDocument(); $config = CFactory::getConfig(); $my = CFactory::getUser(); $userid = JRequest::getVar('userid', ''); $user = CFactory::getUser($userid); if ($document->getType() != 'html') { return; } $document = JFactory::getDocument(); $js = '<script type=\'text/javascript\'>'; $js .= '/*<![CDATA[*/'; $js .= 'var js_viewerId = ' . $my->id . '; '; $js .= 'var js_profileId = ' . $user->id . ';'; $js .= '/*]]>*/'; $js .= '</script>'; $document->addCustomTag($js); // This need to be loaded so the popups will work correctly in notification window CFactory::load('libraries', 'window'); CWindow::load(); CFactory::load('libraries', 'minitip'); CMinitip::load(); CFactory::load('libraries', 'template'); CTemplate::addStylesheet('style'); $templateParams = CTemplate::getTemplateParams(); CTemplate::addStylesheet('style.' . $templateParams->get('colorTheme')); // Load rtl stylesheet if ($document->direction == 'rtl') { CTemplate::addStylesheet('style.rtl'); } $template = new CTemplateHelper(); $styleIE7 = $template->getTemplateAsset('styleIE7', 'css'); $styleIE6 = $template->getTemplateAsset('styleIE6', 'css'); $css = '<!-- Jom Social --> <!--[if IE 7.0]> <link rel="stylesheet" href="' . $styleIE7->url . '" type="text/css" /> <![endif]--> <!--[if lte IE 6]> <link rel="stylesheet" href="' . $styleIE6->url . '" type="text/css" /> <![endif]-->'; $document->addCustomTag($css); $css = 'assets/autocomplete.css'; CAssets::attach($css, 'css'); // Required, but added in default template //$css = 'assets/tipsy-0.1.7/src/stylesheets/tipsy.css'; //CAssets::attach($css, 'css'); // Load joms.ajax CTemplate::addScript('joms.ajax'); }
/** * Displays single photo view * **/ public function photo() { $mainframe = JFactory::getApplication(); $jinput = $mainframe->input; $document = JFactory::getDocument(); // Load window library //CFactory::load( 'libraries' , 'window' ); CWindow::load(); // Get the configuration object. $config = CFactory::getConfig(); $css = JURI::root(true) . '/components/com_community/assets/photos.css'; $document->addStyleSheet($css); $js = 'assets/gallery.min.js'; CFactory::attach($js, 'js'); $albumId = $jinput->get->get('albumid', '', 'INT'); //JRequest::getVar('albumid' , '' , 'GET'); if (empty($albumId)) { echo JText::_('COM_COMMUNITY_PHOTOS_NO_ALBUMID_ERROR'); return; } //CFactory::load( 'models' , 'photos' ); // Load the album table $album = JTable::getInstance('Album', 'CTable'); $album->load($albumId); if ($album->type == PHOTOS_GROUP_TYPE) { $this->_groupPhoto(); } else { $this->_userPhoto(); } }
public function getHTML($userId = '') { static $html = false; $mainframe = JFactory::getApplication(); $jinput = $mainframe->input; if (!$html) { $my = CFactory::getUser(); $view = $jinput->get('view', ''); $task = $jinput->get('task', ''); $groupId = $jinput->get('groupid', '', 'INT'); // @rule: Do not display toolbar for non logged in users. if (empty($my->id)) { if (!empty($groupId) && ($task != 'viewgroup' && $view != 'events')) { return CMiniHeader::showGroupMiniHeader($groupId); } return CMiniHeader::showMiniHeader($userId); } $format = $jinput->get->get('format', 'html', 'STRING'); // @rule: For json formatted output, we do not want to display the output as well. if ($format == 'json') { return; } // Compatibility with other pages, we need to include necessary javascripts and css libraries. $this->attachHeaders(); CWindow::load(); $config = CFactory::getConfig(); $logoutLink = base64_encode(CRoute::_('index.php?option=com_community&view=' . $config->get('redirect_logout'), false)); $tmpl = new CTemplate(); $miniheader = CMiniHeader::showMiniHeader($userId); $groupMiniHeader = ''; $targetUserId = $jinput->get('userid', '', 'INT'); // Show miniheader if ($task != 'viewgroup' && $view != 'events') { $groupMiniHeader = CMiniHeader::showGroupMiniHeader($groupId); } elseif ($task == 'myevents' && $targetUserId && $targetUserId != $my->id) { //show miniheader if this event list belongs to others $miniheader = CMiniHeader::showMiniHeader($targetUserId); } $menus = $this->getItems(); $this->addLegacyToolbars($menus); $model = CFactory::getModel('Toolbar'); $notifModel = CFactory::getModel('notification'); $newMessageCount = $this->getTotalNotifications('inbox'); $newEventInviteCount = $this->getTotalNotifications('events'); $newFriendInviteCount = $this->getTotalNotifications('friends'); $newGroupInviteCount = $this->getTotalNotifications('groups'); $myParams = $my->getParams(); $newNotificationCount = $notifModel->getNotificationCount($my->id, '0', $myParams->get('lastnotificationlist', '')); $menuParams = ''; if (isset($menus[$model->getActiveId(CToolbarLibrary::getActiveLink())])) { $menuParams = new CParameter($menus[$model->getActiveId(CToolbarLibrary::getActiveLink())]->item->params); } //add Event notification count with group notification count //$newEventInviteCount += $newGroupInviteCount; $totalNotifications = $newMessageCount + $newEventInviteCount + $newFriendInviteCount; $html = $tmpl->set('miniheader', $miniheader)->set('groupMiniHeader', $groupMiniHeader)->set('menus', $menus)->set('showToolbar', $config->get('show_toolbar'))->set('newMessageCount', $newMessageCount)->set('newFriendInviteCount', $newFriendInviteCount)->set('newEventInviteCount', $newEventInviteCount + $newGroupInviteCount + $newNotificationCount)->set('logoutLink', $logoutLink)->set('active', $model->getActiveId(CToolbarLibrary::getActiveLink()))->set('notiAlert', $newMessageCount + $newEventInviteCount + $newFriendInviteCount + $newNotificationCount)->set('menuParams', $menuParams)->set('isMessageEnable', $config->get('enablepm'))->fetch('toolbar/base'); } return $html; }
/** * 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'); }
/** * Displays single photo view * **/ public function photo() { $mainframe =& JFactory::getApplication(); $document = JFactory::getDocument(); $my = CFactory::getUser(); $config = CFactory::getConfig(); // Load window library CFactory::load('libraries', 'window'); CWindow::load(); // Get the configuration object. $config = CFactory::getConfig(); $css = JURI::root() . 'components/com_community/assets/album.css'; $document->addStyleSheet($css); $css = JURI::root() . 'components/com_community/assets/photos.css'; $document->addStyleSheet($css); $js = 'assets/gallery'; $js .= $config->getBool('usepackedjavascript') ? '.pack.js' : '.js'; CAssets::attach($js, 'js'); $albumId = JRequest::getVar('albumid', '', 'GET'); $defaultId = JRequest::getVar('photoid', '', 'GET'); $userId = JRequest::getVar('userid', '', 'GET'); $user = CFactory::getUser($userId); $handler = $this->_getHandler(); $handler->setMiniHeader(); if (empty($albumId)) { echo JText::_('COM_COMMUNITY_PHOTOS_NO_ALBUMID_ERROR'); return; } CFactory::load('models', 'photos'); CFactory::load('helpers', 'friends'); $album =& JTable::getInstance('Album', 'CTable'); $album->load($albumId); // Set pathway $pathway =& $mainframe->getPathway(); // Set pathway for group photos // Community > Groups > Group Name > Photos > Album Name $groupId = JRequest::getVar('groupid', '', 'GET'); if (!empty($groupId)) { $group =& JTable::getInstance('Group', 'CTable'); $group->load($groupId); $pathway->addItem(JText::_('COM_COMMUNITY_GROUPS'), CRoute::_('index.php?option=com_community&view=groups')); $pathway->addItem($group->name, CRoute::_('index.php?option=com_community&view=groups&task=viewgroup&groupid=' . $groupId)); $pathway->addItem(JText::_('COM_COMMUNITY_PHOTOS'), CRoute::_('index.php?option=com_community&view=photos&groupid=' . $groupId)); } else { $pathway->addItem(JText::_('COM_COMMUNITY_PHOTOS'), CRoute::_('index.php?option=com_community&view=photos')); $pathway->addItem(JText::sprintf('COM_COMMUNITY_PHOTOS_USER_PHOTOS_TITLE', $user->getDisplayName()), CRoute::_('index.php?option=com_community&view=photos&task=myphotos&userid=' . $userId)); } $pathway->addItem($album->name, ''); // Set document title CFactory::load('helpers', 'string'); $document->setTitle($album->name); if (!$handler->isAlbumBrowsable($albumId)) { return; } $model =& CFactory::getModel('photos'); $photos = $model->getPhotos($albumId, 1000); // @checks: Test if album doesnt have any default photo id. We need to get the first row // of the photos to be the default if ($album->photoid == '0') { $album->photoid = count($photos) >= 1 ? $photos[0]->id : '0'; } // Try to see if there is any photo id in the query $defaultId = !empty($defaultId) ? $defaultId : $album->photoid; // Load the default photo $photo =& JTable::getInstance('Photo', 'CTable'); $photo->load($defaultId); $document->addHeadLink($photo->getThumbURI(), 'image_src', 'rel'); // If default has an id of 0, we need to tell the template to dont process anything $default = $photo->id == 0 ? false : $photo; //friend list for photo tag CFactory::load('libraries', 'phototagging'); $tagging = new CPhotoTagging(); for ($i = 0; $i < count($photos); $i++) { $item =& JTable::getInstance('Photo', 'CTable'); $item->bind($photos[$i]); $photos[$i] = $item; $row =& $photos[$i]; $taggedList = $tagging->getTaggedList($row->id); for ($t = 0; $t < count($taggedList); $t++) { $tagItem =& $taggedList[$t]; $tagUser = CFactory::getUser($tagItem->userid); $canRemoveTag = 0; // 1st we check the tagged user is the photo owner. // If yes, canRemoveTag == true. // If no, then check on user is the tag creator or not. // If yes, canRemoveTag == true // If no, then check on user whether user is being tagged if (COwnerHelper::isMine($my->id, $row->creator) || COwnerHelper::isMine($my->id, $tagItem->created_by) || COwnerHelper::isMine($my->id, $tagItem->userid)) { $canRemoveTag = 1; } $tagItem->user = $tagUser; $tagItem->canRemoveTag = $canRemoveTag; } $row->tagged = $taggedList; } //$friends = $handler->getTaggingUsers(); // Show wall contents CFactory::load('helpers', 'friends'); CFactory::load('helpers', 'owner'); CFactory::load('libraries', 'bookmarks'); // Load up required objects. $isMine = $handler->isAlbumOwner($album->id); $bookmarks = new CBookmarks($handler->getPhotoExternalURI($photo->id, $album->id)); //Performance issues: blocked users should be handle in sql statment /** * Get ban list */ //$block = CFactory::getModel( 'block' ); //$friendlist = array(); //foreach($friends as $friend){ // Exclude blocked user // if( !$block->getBlockStatus($my->id,$friend->id) ){ // $friendlist[] = $friend; // } //} $this->showSubmenu(); $tmpl = new CTemplate(); echo $tmpl->set('bookmarksHTML', $bookmarks->getHTML())->set('showWall', $handler->isWallAllowed())->set('allowTag', $handler->isTaggable())->set('isOwner', $isMine)->set('isAdmin', COwnerHelper::isCommunityAdmin())->set('photos', $photos)->set('default', $default)->set('album', $album)->set('config', $config)->set('photoCreator', CFactory::getUser($photo->creator))->fetch('photos.photo'); }
function showToolbar($data = null) { $mySQLVer = 0; if (JFile::exists(JPATH_COMPONENT . DS . 'libraries' . DS . 'advancesearch.php')) { require_once JPATH_COMPONENT . DS . 'libraries' . DS . 'advancesearch.php'; $mySQLVer = CAdvanceSearch::getMySQLVersion(); } require_once JPATH_COMPONENT . DS . 'libraries' . DS . 'toolbar.php'; require_once JPATH_COMPONENT . DS . 'libraries' . DS . 'miniheader.php'; $format = JRequest::getVar('format', 'html', 'get'); if ($format == 'json') { return; } $mainframe =& JFactory::getApplication(); $document =& JFactory::getDocument(); $my = CFactory::getUser(); $userid = JRequest::getInt('userid', ''); $user = CFactory::getUser($userid); // Get the configuration object. $config = CFactory::getConfig(); //JHTML::_('behavior.tooltip'); $js = 'assets/window-1.0'; $js .= $config->getBool('usepackedjavascript') ? '.pack.js' : '.js'; CAssets::attach($js, 'js'); $js = 'assets/script-1.2'; $js .= $config->getBool('usepackedjavascript') ? '.pack.js' : '.js'; CAssets::attach($js, 'js'); $js = '<script type=\'text/javascript\'>'; $js .= '/*<![CDATA[*/'; $js .= 'var js_viewerId = ' . $my->id . '; '; $js .= 'var js_profileId = ' . $user->id . ';'; $js .= '/*]]>*/'; $js .= '</script>'; $mainframe->addCustomHeadTag($js); CFactory::load('libraries', 'template'); CTemplate::addStylesheet('style'); // Load rtl stylesheet if ($document->direction == 'rtl') { CTemplate::addStylesheet('style.rtl'); } // FOr iPhone, we need to add the stylesheet AFTER the main stylesheet has been loaded // if(JRequest::getVar('screen')=='mobile') // { // $document->addStylesheet( JURI::root() . 'components/com_community/templates/default/css/style.mobile.css' ); // } // This need to be loaded in main messaging library CFactory::load('libraries', 'window'); CWindow::load(); $template = new CTemplateHelper(); $styleIE7 = $template->getTemplateAsset('styleIE7', 'css'); $styleIE6 = $template->getTemplateAsset('styleIE6', 'css'); $css = '<!-- Jom Social --> <!--[if IE 7.0]> <link rel="stylesheet" href="' . $styleIE7->url . '" type="text/css" /> <![endif]--> <!--[if lte IE 6]> <link rel="stylesheet" href="' . $styleIE6->url . '" type="text/css" /> <![endif]-->'; $mainframe->addCustomHeadTag($css); $css = 'assets/autocomplete.css'; CAssets::attach($css, 'css'); // Load joms.ajax CTemplate::addScript('joms.ajax'); $task = JRequest::getVar('task', '', 'GET'); $groupId = JRequest::getInt('groupid', '', 'GET'); // Hide the toolbar from unregistered user // but still show the mini header if (empty($my->id)) { if (!empty($groupId) && $task != 'viewgroup') { CFactory::load('libraries', 'miniheader'); echo CMiniHeader::showGroupMiniHeader($groupId); return; } echo CMiniHeader::showMiniHeader($this->_showMiniHeaderUser); return; } /** * Inbox unread count */ $inboxUnread = 0; if (!empty($data['inbox'])) { $inboxUnread = $data['inbox']; } /** * Notification alert */ $notiAlert = 0; $notiAlert = $this->_newNotification(); if (!empty($notiAlert) && $notiAlert > 0) { CFactory::load('libraries', 'window'); CWindow::load(); } $config = CFactory::getConfig(); $logoutLink = CRoute::_('index.php?option=com_community&view=' . $config->get('redirect_logout'), false); $logoutLink = base64_encode($logoutLink); $isFacebookUser = false; if ($config->get('fbconnectkey') && $config->get('fbconnectsecret')) { CFactory::load('libraries', 'facebook'); CFactory::load('models', 'connect'); // Once they reach here, we assume that they are already logged into facebook. // Since CFacebook library handles the security we don't need to worry about any intercepts here. $facebook = new CFacebook(); $connectTable =& JTable::getInstance('Connect', 'CTable'); $fbUser = $facebook->getUser(); $connectTable->load($fbUser); $isFacebookUser = $connectTable->userid == $my->id; } $groupMiniHeader = ''; // Show miniheader if ($task != 'viewgroup') { CFactory::load('libraries', 'miniheader'); $groupMiniHeader = CMiniHeader::showGroupMiniHeader($groupId); } $tmpl = new CTemplate(); $tmpl->set('my', $my); $tmpl->set('isMine', COwnerHelper::isMine($my->id, $user->id)); $tmpl->set('config', $config); $tmpl->set('inboxUnread', $inboxUnread); $tmpl->set('notiAlert', $notiAlert); $tmpl->set('miniheader', CMiniHeader::showMiniHeader($this->_showMiniHeaderUser)); $tmpl->set('groupMiniHeader', $groupMiniHeader); $tmpl->set('showAdvanceSearch', $mySQLVer > 4.1 ? 1 : 0); $tmpl->set('logoutLink', $logoutLink); $tmpl->set('isFacebookUser', $isFacebookUser); $toolbar = CFactory::getToolbar(); $tmpl->set('customToolbar', $toolbar); echo $tmpl->fetch('toolbar.index'); }
/** * 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'); }