public function remove($tag) { $oZendCache = CFactory::getCache('core'); if ($tag == COMMUNITY_CACHE_TAG_ALL) { $oZendCache->clean(Zend_Cache::CLEANING_MODE_ALL); } else { $oZendCache->clean(Zend_Cache::CLEANING_MODE_MATCHING_ANY_TAG, $tag); } }
function display($tpl = null) { $mainframe =& JFactory::getApplication(); $document =& JFactory::getDocument(); $config = CFactory::getConfig(); $my = CFactory::getUser(); $script = '<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>'; $mainframe->addCustomHeadTag($script); $groupId = JRequest::getVar('groupid', '', 'GET'); if (!empty($groupId)) { $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)); } //page title $this->addPathway(JText::_('CC EVENTS'), CRoute::_('index.php?option=com_community&view=events')); // Get category id from the query string if there are any. $categoryId = JRequest::getInt('categoryid', 0); $limitstart = JRequest::getVar('limitstart', 0); $category =& JTable::getInstance('EventCategory', 'CTable'); $category->load($categoryId); if (isset($category) && $category->id != 0) { $document->setTitle(JText::sprintf('CC VIEW BY CATEGORY NAME', JText::_($this->escape($category->name)))); } else { $document->setTitle(JText::_('CC BROWSE EVENTS TITLE')); } $this->showSubmenu(); $feedLink = CRoute::_('index.php?option=com_community&view=events&format=feed'); $feed = '<link rel="alternate" type="application/rss+xml" title="' . JText::_('CC SUBSCRIBE ALL EVENTS FEED') . '" href="' . $feedLink . '"/>'; $mainframe->addCustomHeadTag($feed); // loading neccessary files here. CFactory::load('libraries', 'filterbar'); CFactory::load('helpers', 'owner'); CFactory::load('helpers', 'event'); CFactory::load('models', 'events'); $data = new stdClass(); $sorted = JRequest::getVar('sort', 'startdate', 'GET'); /* begin: UNLIMITED LEVEL BREADCRUMBS PROCESSING */ if ($category->parent == COMMUNITY_NO_PARENT) { $this->addPathway($category->name, CRoute::_('index.php?option=com_community&view=events&categoryid=' . $category->id)); } else { // Parent Category $parentsInArray = array(); $n = 0; $parentId = $category->id; $parent =& JTable::getInstance('EventCategory', 'CTable'); do { $parent->load($parentId); $parentId = $parent->parent; $parentsInArray[$n]['id'] = $parent->id; $parentsInArray[$n]['parent'] = $parent->parent; $parentsInArray[$n]['name'] = $parent->name; $n++; } while ($parent->parent > COMMUNITY_NO_PARENT); for ($i = count($parentsInArray) - 1; $i >= 0; $i--) { $this->addPathway($parentsInArray[$i]['name'], CRoute::_('index.php?option=com_community&view=events&categoryid=' . $parentsInArray[$i]['id'])); } } /* end: UNLIMITED LEVEL BREADCRUMBS PROCESSING */ $model = CFactory::getModel('events'); $cache = CFactory::getCache('Core'); if (!($data->categories = $cache->load('_events_category_' . $categoryId))) { // Get the categories $data->categories = $model->getCategories(CEventHelper::ALL_TYPES, $categoryId); $cache->save($data->categories, NULL, array(COMMUNITY_CACHE_TAG_EVENTS_CAT)); } CFactory::load('helpers', 'event'); $event =& JTable::getInstance('Event', 'CTable'); $handler = CEventHelper::getHandler($event); if (!($eventsHTML = $cache->load('_events_eventList_' . $categoryId . '_' . $limitstart))) { // It is safe to pass 0 as the category id as the model itself checks for this value. $data->events = $model->getEvents($category->id, null, $sorted, null, true, false, null, null, $handler->getContentTypes(), $handler->getContentId()); // Get pagination object $data->pagination = $model->getPagination(); // Get the template for the event category lists $eventsHTML = $this->_getEventsHTML($data->events, false, $data->pagination); $cache->save($eventsHTML, NULL, array(COMMUNITY_CACHE_TAG_PHOTOS, COMMUNITY_CACHE_TAG_EVENTS)); } $tmpl = new CTemplate(); $sortItems = array('latest' => JText::_('CC SORT EVENT CREATED'), 'startdate' => JText::_('CC SORT EVENT STARTDATE')); $tmpl->set('handler', $handler); $tmpl->set('index', true); $tmpl->set('categories', $data->categories); $tmpl->set('eventsHTML', $eventsHTML); $tmpl->set('config', $config); $tmpl->set('category', $category); $tmpl->set('isCommunityAdmin', COwnerHelper::isCommunityAdmin()); $tmpl->set('sortings', CFilterBar::getHTML(CRoute::getURI(), $sortItems, 'startdate')); $tmpl->set('my', $my); echo $tmpl->fetch('events.index'); }
private function _getFeaturedAlbum() { $featuredList = array(); $cache = CFactory::getCache('Core'); $config = CFactory::getConfig(); if (!($featuredList = $cache->load('_photos_featuredList'))) { CFactory::load('libraries', 'featured'); $featured = new CFeatured(FEATURED_ALBUMS); $featuredAlbums = $featured->getItemIds(); foreach ($featuredAlbums as $album) { $table =& JTable::getInstance('Album', 'CTable'); $table->load($album); $table->thumbnail = $table->getCoverThumbPath(); $table->thumbnail = $table->thumbnail ? JURI::root() . $table->thumbnail : JURI::root() . 'components/com_community/assets/album_thumb.jpg'; if ($table->location != '') { CFactory::load('libraries', 'mapping'); $zoomableMap = CMapping::drawZoomableMap($table->location, 220, 150); } else { $zoomableMap = ""; } $table->zoomableMap = $zoomableMap; $featuredList[] = $table; } $cache->save($featuredList, NULL, array(COMMUNITY_CACHE_TAG_PHOTOS, COMMUNITY_CACHE_TAG_ALBUMS)); } $tmpl = new CTemplate(); CFactory::load('helpers', 'owner'); $photoTag = CFactory::getModel('phototagging'); //add photos info in featured list //$handler = $this->_getHandler(); $photoModel = CFactory::getModel('photos'); if (is_array($featuredList)) { foreach ($featuredList as &$fl) { // bind photo links $fl->photos = $photoModel->getPhotos($fl->id, 5); //set the photo limit to be configurable by admin $photos =& $fl->photos; $maxTime = ''; $tagRecords = array(); // Get all photos from album for ($i = 0; $i < count($photos); $i++) { $item =& JTable::getInstance('Photo', 'CTable'); $item->bind($photos[$i]); $photos[$i] = $item; $photo =& $photos[$i]; $photo->link = CRoute::_('index.php?option=com_community&view=photos&task=photo&userid=' . $fl->creator . '&albumid=' . $photo->albumid) . '#photoid=' . $photo->id; //Cannot use handler as Handler needs userid obtained from Get. In here, userid might not exists in $_GET //$handler->getPhotoURI( $photo->id , $photo->albumid ); $tagRecords[] = $photoTag->getTaggedList($photo->id); //Get last update $maxTime = $photo->created > $maxTime ? $photo->created : $maxTime; } $people = array(); // Get the people in the tags foreach ($tagRecords as $tag) { foreach ($tag as $t) { $people[] = $t->userid; } } $people = array_unique($people); foreach ($people as &$person) { $person = CFactory::getUser($person); } //bind tagged person in the album $fl->tagged = $people; //bind album desc $maxTime = new JDate($maxTime); $fl->lastUpdated = CActivityStream::_createdLapse($maxTime, false); } } //try to get the photos within this album // Get show photo location map by default $photoMapsDefault = $config->get('photosmapdefault'); return $tmpl->set('isCommunityAdmin', COwnerHelper::isCommunityAdmin())->set('featuredList', $featuredList)->set('photoModel', $photoModel)->set('photoMapsDefault', $photoMapsDefault)->fetch('photos.album.featured'); }
/** * Display all videos in the whole system **/ function display($id = null) { // Load required filterbar library that will be used to display the filtering and sorting. CFactory::load('libraries', 'filterbar'); $mainframe = JFactory::getApplication(); $document = JFactory::getDocument(); $my = CFactory::getUser(); $model = CFactory::getModel('videos'); $this->_addSubmenu(); $this->showSubmenu(); // Get category id from the query string if there are any. $categoryId = JRequest::getInt('catid', null); $category = JTable::getInstance('VideosCategory', 'CTable'); $category->load($categoryId); $groupId = JRequest::getVar('groupid', '', 'GET'); if (!empty($groupId)) { $group =& JTable::getInstance('Group', 'CTable'); $group->load($groupId); // Set pathway for group videos // Community > Groups > Group Name > Videos $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)); } // If we are browing by category, add additional breadcrumb and add // category name in the page title if ($categoryId != 0) { if (!empty($groupId)) { $this->addPathway(JText::_('CC VIDEOS'), CRoute::_('index.php?option=com_community&view=videos&groupid=' . $groupId)); } else { $this->addPathway(JText::_('CC VIDEOS'), CRoute::_('index.php?option=com_community&view=videos')); } $this->addPathway($category->name, ''); $document->setTitle(JText::_('CC BROWSE VIDEOS CATEGORIES') . ' : ' . JText::_($category->name)); } else { $this->addPathway(JText::_('CC VIDEOS')); $document->setTitle(JText::_('CC BROWSE ALL VIDEOS')); } $groupId = JRequest::getVar('groupid', '', 'GET'); $groupLink = !empty($groupId) ? '&groupid=' . $groupId : ''; $feedLink = CRoute::_('index.php?option=com_community&view=videos' . $groupLink . '&format=feed'); $feed = '<link rel="alternate" type="application/rss+xml" title="' . JText::_('CC SUBSCRIBE ALL VIDEOS FEED') . '" href="' . $feedLink . '"/>'; $mainframe->addCustomHeadTag($feed); // Featured Videos $featVideos = ''; $featuredHTML = ''; $sorted = JRequest::getVar('sort', 'latest'); $limitstart = JRequest::getVar('limitstart', 0); $cache = CFactory::getCache('Core'); $permissions = $my->id == 0 ? 0 : 20; if (!empty($groupId)) { $group = JTable::getInstance('Group', 'CTable'); $group->load($groupId); CFactory::load('helpers', 'owner'); $isMember = $group->isMember($my->id); $isMine = $my->id == $group->ownerid; $isBanned = $group->isBanned($my->id); if (!$isMember && !$isMine && !COwnerHelper::isCommunityAdmin() && $group->approvals == COMMUNITY_PRIVATE_GROUP) { $this->noAccess(JText::_('CC PRIVATE GROUP NOTICE')); return; } // cache video list. if (!($videosHTML = $cache->load('_videos_showAllVideos_' . $permissions . '_' . $categoryId . '_' . $groupId . '_' . $sorted . '_' . $limitstart))) { $videos = $model->getGroupVideos($groupId, $category->id); $pagination = $model->getPagination(); $videosHTML = $this->_getVideosHTML($videos, $pagination); $cache->save($videosHTML, NULL, array(COMMUNITY_CACHE_TAG_VIDEOS)); } $allVideosUrl = 'index.php?option=com_community&view=videos&groupid=' . $groupId; $catVideoUrl = 'index.php?option=com_community&view=videos&groupid=' . $groupId . '&catid='; } else { // cache video list. if (!($videosHTML = $cache->load('_videos_showAllVideos_' . $permissions . '_' . $categoryId . '_' . $groupId . '_' . $sorted . '_' . $limitstart))) { $filters = array('status' => 'ready', 'category_id' => $category->id, 'permissions' => $permissions, 'or_group_privacy' => 0, 'sorting' => $sorted); $videos = $model->getVideos($filters); $pagination = $model->getPagination(); $videosHTML = $this->_getVideosHTML($videos, $pagination); $cache->save($videosHTML, NULL, array(COMMUNITY_CACHE_TAG_VIDEOS)); } $allVideosUrl = 'index.php?option=com_community&view=videos'; $catVideoUrl = 'index.php?option=com_community&view=videos&catid='; // Featured Videos // Cache featured video. if (!($featuredHTML = $cache->load('_videos_featuredList'))) { $featVideos = $this->_getFeatVideos(); $featuredHTML = $this->_getFeatHTML($featVideos); $cache->save($featuredHTML, NULL, array(COMMUNITY_CACHE_TAG_VIDEOS)); } } if (!($categories = $cache->load('_videos_category_' . $permissions . '_' . $groupId))) { $categories = $model->getCategories(); $cache->save($categories, NULL, array(COMMUNITY_CACHE_TAG_VIDEOS_CAT)); } $sortItems = array('latest' => JText::_('CC VIDEO SORT LATEST'), 'mostwalls' => JText::_('CC VIDEO SORT MOST WALL POST'), 'mostviews' => JText::_('CC VIDEO SORT POPULAR'), 'title' => JText::_('CC VIDEO SORT TITLE')); $tmpl = new CTemplate(); $tmpl->set('sort', JRequest::getVar('sort', 'latest')); $tmpl->set('currentTask', JRequest::getCmd('task', '')); $tmpl->set('featuredHTML', $featuredHTML); $tmpl->set('videosHTML', $videosHTML); $tmpl->set('categories', $categories); $tmpl->set('sortings', CFilterBar::getHTML(CRoute::getURI(), $sortItems, 'latest')); $tmpl->set('allVideosUrl', $allVideosUrl); $tmpl->set('catVideoUrl', $catVideoUrl); echo $tmpl->fetch('videos.index'); }
public function ajaxGetNewestVideos($limit) { $limit = max(0, $limit); $cache = CFactory::getCache('Core'); $intRandom = rand(COMMUNITY_CACHE_RANDOM_MIN, COMMUNITY_CACHE_RANDOM_MAX); $my = CFactory::getUser(); $permissions = $my->id == 0 ? 0 : 20; if (!($html = $cache->load('frontpage_ajaxGetNewestVideos_' . $permissions . '_' . $intRandom))) { $html = ''; $oversampledTotal = $limit * COMMUNITY_OVERSAMPLING_FACTOR; $model = CFactory::getModel('videos'); $filter = array('status' => 'ready', 'permissions' => $permissions, 'or_group_privacy' => 0, 'sorting' => 'latest', 'limit' => $oversampledTotal); $latestVideos = $model->getVideos($filter, true); if (!empty($latestVideos)) { shuffle($latestVideos); $maxLatestCount = count($latestVideos) > $limit ? $limit : count($latestVideos); $html = $this->prepareVideosData($latestVideos, $maxLatestCount, $objResponse); } else { $html = JText::_('COM_COMMUNITY_VIDEOS_NO_VIDEO'); } $cache->save($html, NULL, array(COMMUNITY_CACHE_TAG_VIDEOS)); } $objResponse = new JAXResponse(); $objResponse->addAssign('latest-videos-container', 'innerHTML', $html); $objResponse->addScriptCall("joms.filters.hideLoading();"); return $objResponse->sendResponse(); }
/** * Method to display listing of groups from the site **/ function display($data) { $mainframe =& JFactory::getApplication(); $document =& JFactory::getDocument(); // Load required filterbar library that will be used to display the filtering and sorting. CFactory::load('libraries', 'filterbar'); require_once JPATH_COMPONENT . DS . 'libraries' . DS . 'activities.php'; $model =& CFactory::getModel('groups'); $avatarModel =& CFactory::getModel('avatar'); $wallsModel =& CFactory::getModel('wall'); // Get category id from the query string if there are any. $categoryId = JRequest::getInt('categoryid', 0); $category =& JTable::getInstance('GroupCategory', 'CTable'); $category->load($categoryId); if ($categoryId != 0) { $this->addPathway(JText::_('CC GROUPS'), CRoute::_('index.php?option=com_community&view=groups')); $document->setTitle(JText::_('CC BROWSE GROUPS CATEGORIES') . ' : ' . $category->name); } else { $this->addPathway(JText::_('CC GROUPS')); $document->setTitle(JText::_('CC BROWSE ALL GROUPS')); } // If we are browing by category, add additional breadcrumb and add // category name in the page title /* begin: UNLIMITED LEVEL BREADCRUMBS PROCESSING */ if ($category->parent == COMMUNITY_NO_PARENT) { $this->addPathway($category->name, CRoute::_('index.php?option=com_community&view=groups&categoryid=' . $category->id)); } else { // Parent Category $parentsInArray = array(); $n = 0; $parentId = $category->id; $parent =& JTable::getInstance('GroupCategory', 'CTable'); do { $parent->load($parentId); $parentId = $parent->parent; $parentsInArray[$n]['id'] = $parent->id; $parentsInArray[$n]['parent'] = $parent->parent; $parentsInArray[$n]['name'] = $parent->name; $n++; } while ($parent->parent > COMMUNITY_NO_PARENT); for ($i = count($parentsInArray) - 1; $i >= 0; $i--) { $this->addPathway($parentsInArray[$i]['name'], CRoute::_('index.php?option=com_community&view=groups&categoryid=' . $parentsInArray[$i]['id'])); } } /* end: UNLIMITED LEVEL BREADCRUMBS PROCESSING */ $config =& CFactory::getConfig(); $my = CFactory::getUser(); $uri = JURI::base(); $this->showSubmenu(); $feedLink = CRoute::_('index.php?option=com_community&view=groups&format=feed'); $feed = '<link rel="alternate" type="application/rss+xml" title="' . JText::_('CC SUBSCRIBE TO LATEST GROUPS FEED') . '" href="' . $feedLink . '"/>'; $document->addCustomTag($feed); $feedLink = CRoute::_('index.php?option=com_community&view=groups&task=viewlatestdiscussions&format=feed'); $feed = '<link rel="alternate" type="application/rss+xml" title="' . JText::_('CC SUBSCRIBE TO LATEST GROUP DISCUSSIONS FEED') . '" href="' . $feedLink . '"/>'; $document->addCustomTag($feed); $data = new stdClass(); $sorted = JRequest::getVar('sort', 'latest', 'GET'); $limitstart = JRequest::getVar('limitstart', 0); $cache = CFactory::getCache('Core'); if (!($data->categories = $cache->load('_groups_category_' . $category->id))) { // Get the categories $data->categories = $model->getCategories($category->id); $cache->save($data->categories, NULL, array(COMMUNITY_CACHE_TAG_GROUPS_CAT)); } // cache groups list. if (!($groupsHTML = $cache->load('_groups_showAllGroups_' . $categoryId . '_' . $sorted . '_' . $limitstart))) { // It is safe to pass 0 as the category id as the model itself checks for this value. $data->groups = $model->getAllGroups($category->id, $sorted); // Get pagination object $data->pagination = $model->getPagination(); // Get the template for the group lists $groupsHTML = $this->_getGroupsHTML($data->groups, $data->pagination); $cache->save($groupsHTML, NULL, array(COMMUNITY_CACHE_TAG_GROUPS)); } $act = new CActivityStream(); CFactory::load('helpers', 'owner'); if (!($featuredList = $cache->load('_groups_featuredList'))) { CFactory::load('libraries', 'featured'); $featured = new CFeatured(FEATURED_GROUPS); $featuredGroups = $featured->getItemIds(); $featuredList = array(); foreach ($featuredGroups as $group) { $table =& JTable::getInstance('Group', 'CTable'); $table->load($group); $featuredList[] = $table; } $cache->save($featuredList, NULL, array(COMMUNITY_CACHE_TAG_GROUPS)); } // getting group's latest discussion activities. $templateParams = CTemplate::getTemplateParams(); $discussions = $model->getGroupLatestDiscussion($categoryId, '', $templateParams->get('sidebarTotalDiscussions')); $tmpl = new CTemplate(); $sortItems = array('latest' => JText::_('CC GROUP SORT LATEST'), 'alphabetical' => JText::_('CC SORT ALPHABETICAL'), 'mostdiscussed' => JText::_('CC GROUP SORT MOST DISCUSSED'), 'mostwall' => JText::_('CC GROUP SORT MOST WALL POST'), 'mostmembers' => JText::_('CC GROUP SORT MOST MEMBERS'), 'mostactive' => JText::_('CC GROUP SORT MOST ACTIVE')); $tmpl->set('featuredList', $featuredList); $tmpl->set('index', true); $tmpl->set('categories', $data->categories); $tmpl->set('groupsHTML', $groupsHTML); $tmpl->set('config', $config); $tmpl->set('category', $category); $tmpl->set('isCommunityAdmin', COwnerHelper::isCommunityAdmin()); $tmpl->set('sortings', CFilterBar::getHTML(CRoute::getURI(), $sortItems, 'latest')); $tmpl->set('my', $my); $tmpl->set('discussionsHTML', $this->_getSidebarDiscussions($discussions)); echo $tmpl->fetch('groups.index'); }
/** * Triggered when invoking inaccessible method in an object. * **/ public function __call($methodName, $arguments) { // Cache is set in the model class. if (($oCache = CCache::load($this->oModel)) && ($aSetting = $oCache->getMethod($methodName))) { $cacheAction = $aSetting['action']; $aCacheTag = $aSetting['tag']; $oZendCache = CFactory::getCache('core'); $className = get_class($this->oModel); // Genereate cache file. if ($cacheAction == CCache::ACTION_SAVE) { if (!($data = $oZendCache->load($className . '_' . $methodName . '_' . md5(serialize($arguments))))) { $data = call_user_func_array(array($this->oModel, $methodName), $arguments); $oZendCache->save($data, NULL, $aCacheTag); } // Remove cache file. } elseif ($cacheAction == CCache::ACTION_REMOVE) { $oCache->remove($aCacheTag); $data = call_user_func_array(array($this->oModel, $methodName), $arguments); } } else { $data = call_user_func_array(array($this->oModel, $methodName), $arguments); } return $data; }
/** * Default view method * Display all photos in the whole system **/ function display() { $document =& JFactory::getDocument(); $my = CFactory::getUser(); $document->setTitle(JText::_('CC ALL PHOTOS TITLE')); $mainframe =& JFactory::getApplication(); // Set pathway for group photos // Community > Groups > Group Name > Photos $groupId = JRequest::getVar('groupid', '', 'GET'); if (!empty($groupId)) { $group =& JTable::getInstance('Group', 'CTable'); $group->load($groupId); $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)); } $this->addPathway(JText::_('CC PHOTOS')); // Load tooltips lib CFactory::load('libraries', 'tooltip'); CFactory::load('models', 'groups'); $model = CFactory::getModel('photos'); $groupId = JRequest::getInt('groupid', '', 'REQUEST'); $limitstart = JRequest::getInt('limitstart', 0); $type = PHOTOS_USER_TYPE; $handler = $this->_getHandler(); $this->showSubmenu(); $groupLink = !empty($groupId) ? '&groupid=' . $groupId : ''; $feedLink = CRoute::_('index.php?option=com_community&view=photos' . $groupLink . '&format=feed'); $feed = '<link rel="alternate" type="application/rss+xml" title="' . JText::_('CC SUBSCRIBE ALL PHOTOS FEED') . '" href="' . $feedLink . '"/>'; $mainframe->addCustomHeadTag($feed); $albumsData = $handler->getAllAlbumData(); if ($albumsData === FALSE) { return; } $albumHTML = $this->_getAllAlbumsHTML($albumsData, $type, $model->getPagination()); $featuredList = array(); if (empty($groupId)) { $cache = CFactory::getCache('Core'); if (!($featuredList = $cache->load('_photos_featuredList'))) { CFactory::load('libraries', 'featured'); $featured = new CFeatured(FEATURED_ALBUMS); $featuredAlbums = $featured->getItemIds(); foreach ($featuredAlbums as $album) { $table =& JTable::getInstance('Album', 'CTable'); $table->load($album); $table->thumbnail = $table->getCoverThumbPath(); $table->thumbnail = $table->thumbnail ? JURI::root() . $table->thumbnail : JURI::root() . 'components/com_community/assets/album_thumb.jpg'; $featuredList[] = $table; } $cache->save($featuredList, NULL, array(COMMUNITY_CACHE_TAG_PHOTOS, COMMUNITY_CACHE_TAG_ALBUMS)); } } $tmpl = new CTemplate(); CFactory::load('helpers', 'owner'); $tmpl->set('isCommunityAdmin', COwnerHelper::isCommunityAdmin()); $tmpl->set('featuredList', $featuredList); $tmpl->set('albumsHTML', $albumHTML); echo $tmpl->fetch('photos.index'); }
function display() { $mainframe = JFactory::getApplication(); $config = CFactory::getConfig(); $document = JFactory::getDocument(); $config = CFactory::getConfig(); $document->setTitle(JText::sprintf('CC FRONTPAGE TITLE', $config->get('sitename'))); $my = CFactory::getUser(); $model = CFactory::getModel('user'); $avatarModel = CFactory::getModel('avatar'); $status = CFactory::getModel('status'); $frontpageUsers = intval($config->get('frontpageusers')); $document->addScriptDeclaration("var frontpageUsers\t= " . $frontpageUsers . ";"); $frontpageVideos = intval($config->get('frontpagevideos')); $document->addScriptDeclaration("var frontpageVideos\t= " . $frontpageVideos . ";"); $status = $status->get($my->id); $feedLink = CRoute::_('index.php?option=com_community&view=frontpage&format=feed'); $feed = '<link rel="alternate" type="application/rss+xml" title="' . JText::_('CC SUBSCRIBE RECENT ACTIVITIES FEED') . '" href="' . $feedLink . '"/>'; $mainframe->addCustomHeadTag($feed); CFactory::load('libraries', 'tooltip'); CFactory::load('libraries', 'activities'); // Process headers HTML output $headerHTML = ''; $tmpl = new CTemplate(); $alreadyLogin = 0; if ($my->id != 0) { $headerHTML = $tmpl->fetch('frontpage.members'); $alreadyLogin = 1; } else { $uri = CRoute::_('index.php?option=com_community&view=' . $config->get('redirect_login'), false); $uri = base64_encode($uri); $fbHtml = ''; if ($config->get('fbconnectkey') && $config->get('fbconnectsecret')) { CFactory::load('libraries', 'facebook'); $facebook = new CFacebook(); $fbHtml = $facebook->getLoginHTML(); } $usersConfig =& JComponentHelper::getParams('com_users'); $tmpl->set('fbHtml', $fbHtml); $tmpl->set('return', $uri); $tmpl->set('config', $config); $tmpl->set('usersConfig', $usersConfig); $headerHTML = $tmpl->fetch('frontpage.guests'); } $my = CFactory::getUser(); $totalMembers = $model->getMembersCount(); unset($tmpl); // Caching on latest members, groups, videos, activities, photos... $cache = CFactory::getCache('Core'); $permission = $my->id == 0 ? 0 : 20; // public or site members // Cache few groups to display random data because shuffle is not working after page cached. $intRandom = rand(COMMUNITY_CACHE_RANDOM_MIN, COMMUNITY_CACHE_RANDOM_MAX); if (!($latestMembersHTML = $cache->load('frontpage_showLatestMembers_' . $intRandom))) { $latestMembersHTML = $this->showLatestMembers($config->get('frontpageusers')); $cache->save($latestMembersHTML, NULL, array(COMMUNITY_CACHE_TAG_MEMBERS)); } if (!($latestGroupsHTML = $cache->load('frontpage_showLatestgroups'))) { $latestGroupsHTML = $this->showLatestGroups($config->get('frontpagegroups')); $cache->save($latestGroupsHTML, NULL, array(COMMUNITY_CACHE_TAG_GROUPS)); } if (!($latestVideoHTML = $cache->load('frontpage_showLatestVideos_' . $permission . '_' . $intRandom))) { $latestVideoHTML = $this->showLatestVideos($config->get('frontpagevideos')); $cache->save($latestVideoHTML, NULL, array(COMMUNITY_CACHE_TAG_VIDEOS)); } if (!($latestPhotosHTML = $cache->load('frontpage_showLatestPhotos_' . $intRandom))) { $latestPhotosHTML = $this->showLatestPhotos(); $cache->save($latestPhotosHTML, NULL, array(COMMUNITY_CACHE_TAG_PHOTOS)); } $latestEventsHTML = $this->showLatestEvents($config->get('frontpage_events_limit')); $latestActivitiesHTML = $this->showLatestActivities(); $tmpl = new CTemplate(); $tmpl->set('totalMembers', $totalMembers); $tmpl->set('my', $my); $tmpl->set('alreadyLogin', $alreadyLogin); $tmpl->set('header', $headerHTML); $tmpl->set('onlineMembers', $this->getOnlineMembers()); $tmpl->set('userActivities', $latestActivitiesHTML); $tmpl->set('config', $config); $tmpl->set('latestMembers', $latestMembersHTML); $tmpl->set('latestGroups', $latestGroupsHTML); /** Compatibility fix **/ $tmpl->set('latestPhotos', $this->showLatestPhotos(true)); $tmpl->set('latestPhotosHTML', $latestPhotosHTML); $tmpl->set('latestVideos', $this->showLatestVideos($config->get('frontpagevideos'), true)); $tmpl->set('latestVideosHTML', $latestVideoHTML); $tmpl->set('latestEvents', $latestEventsHTML); $tmpl->set('customActivityHTML', $this->getCustomActivityHTML()); CFactory::load('helpers', 'string'); echo $tmpl->fetch('frontpage.index'); }