Ejemplo n.º 1
0
 /**
  * Displays single photo view
  *
  * */
 public function photo()
 {
     $mainframe = JFactory::getApplication();
     $jinput = $mainframe->input;
     $document = JFactory::getDocument();
     $photoId = $jinput->get('photoid', '', 'INT');
     $photo = JTable::getInstance('Photo', 'CTable');
     $photo->load($photoId);
     $albumId = $jinput->get('albumid', $photo->albumid, 'INT');
     $userId = JRequest::getInt('userid', '');
     $user = CFactory::getUser($userId);
     $my = CFactory::getUser();
     $album = JTable::getInstance('Album', 'CTable');
     $album->load($photo->albumid);
     // add this to the request just in case its missing
     if ($album->eventid) {
         JRequest::setVar('eventid', $album->eventid);
     } elseif ($album->groupid) {
         JRequest::setVar('groupid', $album->groupid);
     }
     echo $this->showSubmenu();
     $document->setTitle($album->name);
     $document->setMetaData('title', $album->name);
     $document->setMetaData('description', $photo->caption);
     CHeadHelper::addOpengraph('og:image', JUri::root() . $photo->image, true);
     $tmpl = new CTemplate();
     echo $tmpl->set('album', $album)->set('photo', $photo)->set('my', $my)->fetch('photos/single');
 }
Ejemplo n.º 2
0
 /**
  * Displays single photo view
  *
  * */
 public function photo()
 {
     $mainframe = JFactory::getApplication();
     $jinput = $mainframe->input;
     $document = JFactory::getDocument();
     $albumId = $jinput->get('albumid', '', 'INT');
     $photoId = $jinput->get('photoid', '', 'INT');
     $userId = JRequest::getInt('userid', '');
     $user = CFactory::getUser($userId);
     $my = CFactory::getUser();
     echo $this->showSubmenu();
     $photo = JTable::getInstance('Photo', 'CTable');
     $photo->load($photoId);
     $album = JTable::getInstance('Album', 'CTable');
     $album->load($photo->albumid);
     CHeadHelper::addOpengraph('og:image', JUri::root() . $photo->image, true);
     $tmpl = new CTemplate();
     echo $tmpl->set('album', $album)->set('photo', $photo)->set('my', $my)->fetch('photos/single');
 }
Ejemplo n.º 3
0
 /**
  * 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');
 }
Ejemplo n.º 4
0
 public function singleActivity($activity)
 {
     // we will determine all the user settings based on the activity viewed
     $actor = CFactory::getUser($activity->actor);
     $userId = $activity->actor;
     if ($activity->id == 0 || empty($activity->id)) {
         //redirect this to error : no activity found
         JError::raiseWarning(404, JText::_('COM_COMMUNITY_ERROR_ACTIVITY_NOT_FOUND'));
     }
     $document = JFactory::getDocument();
     $document->setTitle(JHTML::_('string.truncate', $activity->title, 75));
     CHeadHelper::setDescription(JHTML::_('string.truncate', $activity->title, 300, true));
     //lets find the image if there is any
     $params = new CParameter($activity->params);
     $headMetaParams = new JRegistry($params->get('headMetas'));
     if ($headMetaParams->get('image')) {
         CHeadHelper::addOpengraph('og:image', $headMetaParams->get('image'));
     } else {
         if (($photo = $actor->getAvatarInfo()) && !$actor->isDefaultAvatar()) {
             CHeadHelper::addOpengraph('og:image', $photo->getImageURI(true));
         } else {
             CHeadHelper::addOpengraph('og:image', JURI::base() . $actor->getAvatar());
         }
     }
     if ($headMetaParams->get('title')) {
         CHeadHelper::addOpengraph('og:title', $headMetaParams->get('title'));
     }
     //see if the user has blocked each other
     $getBlockStatus = new blockUser();
     $blocked = $getBlockStatus->isUserBlocked($userId, 'profile');
     if ($blocked && !COwnerHelper::isCommunityAdmin()) {
         JError::raiseWarning(404, JText::_('COM_COMMUNITY_ERROR_ACTIVITY_NOT_FOUND'));
     }
     //everything is fine, lets get to the activity
     echo $this->_getNewsfeedHTML();
 }
Ejemplo n.º 5
0
 /**
  * Displays specific groups
  * */
 public function viewGroup($group)
 {
     CWindow::load();
     $config = CFactory::getConfig();
     $document = JFactory::getDocument();
     $groupLib = new CGroups();
     $mainframe = JFactory::getApplication();
     $jinput = $mainframe->input;
     // Load appropriate models
     $groupModel = CFactory::getModel('groups');
     $wallModel = CFactory::getModel('wall');
     $userModel = CFactory::getModel('user');
     $discussModel = CFactory::getModel('discussions');
     $bulletinModel = CFactory::getModel('bulletins');
     $photosModel = CFactory::getModel('photos');
     $activityModel = CFactory::getModel('activities');
     $fileModel = CFactory::getModel('files');
     $editGroup = $jinput->get->get('edit', FALSE, 'NONE');
     $editGroup = $editGroup == 1 ? true : false;
     $params = $group->getParams();
     /**
      * Opengraph
      * @todo Support group avatar og:image
      */
     CHeadHelper::setType('website', CStringHelper::escape($group->name), CStringHelper::escape(strip_tags($group->description)));
     $document->addCustomTag('<link rel="image_src" href="' . JURI::root(true) . '/' . $group->thumb . '" />');
     // @rule: Test if the group is unpublished, don't display it at all.
     if (!$group->published) {
         $this->_redirectUnpublishGroup();
         return;
     }
     $group->hit();
     $this->addPathway(JText::_('COM_COMMUNITY_GROUPS'), CRoute::_('index.php?option=com_community&view=groups'));
     $this->addPathway(JText::sprintf('COM_COMMUNITY_GROUPS_NAME_TITLE', $group->name), '');
     // Load the current browsers data
     $my = CFactory::getUser();
     // If user are invited
     $isInvited = $groupModel->isInvited($my->id, $group->id);
     // Get members list for display
     //$members	= $groupModel->getAllMember($group->id);
     //Set limit for member listing on view group page
     $limit = 12;
     $approvedMembers = $groupModel->getMembers($group->id, $limit, true, false, true);
     CError::assert($approvedMembers, 'array', 'istype', __FILE__, __LINE__);
     $membersCount = count($groupModel->getAllMember($group->id));
     // Is there any my friend is the member of this group?
     $join = '';
     $friendsCount = 0;
     if ($isInvited) {
         // Get the invitors
         $invitors = $groupModel->getInvitors($my->id, $group->id);
         if (count($invitors) == 1) {
             $user = CFactory::getUser($invitors[0]->creator);
             $join = '<a href="' . CUrlHelper::userLink($user->id) . '">' . $user->getDisplayName() . '</a>';
         } else {
             for ($i = 0; $i < count($invitors); $i++) {
                 $user = CFactory::getUser($invitors[$i]->creator);
                 if ($i + 1 == count($invitors)) {
                     $join .= ' ' . JText::_('COM_COMMUNITY_AND') . ' ' . '<a href="' . CUrlHelper::userLink($user->id) . '">' . $user->getDisplayName() . '</a>';
                 } else {
                     $join .= ', ' . '<a href="' . CUrlHelper::userLink($user->id) . '">' . $user->getDisplayName() . '</a>';
                 }
             }
         }
         // Get users friends in this group
         $friendsCount = $groupModel->getFriendsCount($my->id, $group->id);
     }
     // Get list of unapproved members
     $unapproved = $groupModel->getMembers($group->id, null, false);
     $unapproved = count($unapproved);
     // Test if the current user is admin
     $isAdmin = $groupModel->isAdmin($my->id, $group->id);
     // Test if the current browser is a member of the group
     $isMember = $groupModel->isMember($my->id, $group->id);
     $waitingApproval = false;
     // Test if the current user is banned from this group
     $isBanned = $group->isBanned($my->id);
     // Attach avatar of the member
     // Pre-load multiple users at once
     $userids = array();
     $limitloop = $limit;
     foreach ($approvedMembers as $uid) {
         $userids[] = $uid->id;
         if (--$limitloop < 1) {
             break;
         }
     }
     CFactory::loadUsers($userids);
     $limitloop = $limit;
     for ($i = 0; $i < count($approvedMembers); $i++) {
         $row = $approvedMembers[$i];
         $approvedMembers[$i] = CFactory::getUser($row->id);
         if (--$limitloop < 1) {
             break;
         }
     }
     if ($isBanned) {
         $mainframe = JFactory::getApplication();
         $mainframe->enqueueMessage(JText::_('COM_COMMUNITY_GROUPS_MEMBER_BANNED'), 'error');
         return;
     }
     // If I have tried to join this group, but not yet approved, display a notice
     if ($groupModel->isWaitingAuthorization($my->id, $group->id)) {
         $waitingApproval = true;
     }
     // Get like
     $likes = new CLike();
     $isUserLiked = false;
     if ($isLikeEnabled = $likes->enabled('groups')) {
         $isUserLiked = $likes->userLiked('groups', $group->id, $my->id);
     }
     $totalLikes = $likes->getLikeCount('groups', $group->id);
     // Get discussions data
     $discussionData = $this->_cachedCall('_getDiscussionListHTML', array($params, $group->id), $group->id, array(COMMUNITY_CACHE_TAG_GROUPS_DETAIL));
     $discussionsHTML = $discussionData['HTML'];
     $totalDiscussion = $discussionData['total'];
     $discussions = $discussionData['data'];
     // Get bulletins data
     $bulletinData = $this->_cachedCall('_getBulletinListHTML', array($group->id), $group->id, array(COMMUNITY_CACHE_TAG_GROUPS_DETAIL));
     $totalBulletin = $bulletinData['total'];
     $bulletinsHTML = $bulletinData['HTML'];
     $bulletins = $bulletinData['data'];
     // Get album data
     $albumData = $this->_cachedCall('_getAlbums', array($params, $group->id), $group->id, array(COMMUNITY_CACHE_TAG_GROUPS_DETAIL));
     $albums = $albumData['data'];
     $totalAlbums = $albumData['total'];
     // Get video data
     $videoData = $this->_getVideos($params, $group->id);
     $videos = $videoData['data'];
     $totalVideos = $videoData['total'];
     $tmpl = new CTemplate();
     $isMine = $my->id == $group->ownerid;
     $isSuperAdmin = COwnerHelper::isCommunityAdmin();
     if ($group->approvals == '1' && !$isMine && !$isMember && !$isSuperAdmin) {
         $this->addWarning(JText::_('COM_COMMUNITY_GROUPS_PRIVATE_NOTICE'));
     }
     $eventsModel = CFactory::getModel('Events');
     $tmpEvents = $eventsModel->getGroupEvents($group->id, $params->get('grouprecentevents', GROUP_EVENT_RECENT_LIMIT));
     $totalEvents = $eventsModel->getTotalGroupEvents($group->id);
     $events = array();
     foreach ($tmpEvents as $event) {
         $table = JTable::getInstance('Event', 'CTable');
         $table->bind($event);
         $events[] = $table;
     }
     $allowCreateEvent = CGroupHelper::allowCreateEvent($my->id, $group->id);
     if ($group->approvals == '0' || $isMine || $isMember && !$isBanned || $isSuperAdmin) {
         // Set feed url
         $feedLink = CRoute::_('index.php?option=com_community&view=groups&task=viewbulletins&groupid=' . $group->id . '&format=feed');
         $feed = '<link rel="alternate" type="application/rss+xml" title="' . JText::_('COM_COMMUNITY_SUBSCRIBE_TO_BULLETIN_FEEDS') . '" href="' . $feedLink . '"/>';
         $document->addCustomTag($feed);
         $feedLink = CRoute::_('index.php?option=com_community&view=groups&task=viewdiscussions&groupid=' . $group->id . '&format=feed');
         $feed = '<link rel="alternate" type="application/rss+xml" title="' . JText::_('COM_COMMUNITY_SUBSCRIBE_TO_DISCUSSION_FEEDS') . '" href="' . $feedLink . '"/>';
         $document->addCustomTag($feed);
         $feedLink = CRoute::_('index.php?option=com_community&view=photos&groupid=' . $group->id . '&format=feed');
         $feed = '<link rel="alternate" type="application/rss+xml" title="' . JText::_('COM_COMMUNITY_SUBSCRIBE_TO_GROUP_PHOTOS_FEEDS') . '" href="' . $feedLink . '"/>';
         $document->addCustomTag($feed);
         $feedLink = CRoute::_('index.php?option=com_community&view=videos&groupid=' . $group->id . '&format=feed');
         $feed = '<link rel="alternate" type="application/rss+xml" title="' . JText::_('COM_COMMUNITY_SUBSCRIBE_TO_GROUP_VIDEOS_FEEDS') . '"  href="' . $feedLink . '"/>';
         $document->addCustomTag($feed);
         $feedLink = CRoute::_('index.php?option=com_community&view=events&groupid=' . $group->id . '&format=feed');
         $feed = '<link rel="alternate" type="application/rss+xml" title="' . JText::_('COM_COMMUNITY_SUBSCRIBE_TO_GROUP_EVENTS_FEEDS') . '"  href="' . $feedLink . '"/>';
         $document->addCustomTag($feed);
     }
     // Upgrade wall to stream @since 2.5
     if (!$params->get('stream', FALSE)) {
         $group->upgradeWallToStream();
     }
     $group->coverPostion = $params->get('coverPosition', '');
     $group->defaultCover = empty($group->cover) ? true : false;
     if (strpos($group->coverPostion, '%') === false) {
         $group->coverPostion = 0;
     }
     // Add custom stream
     $activities = new CActivities();
     $streamHTML = $activities->getOlderStream(1000000000, 'active-group', $group->id);
     $totalStream = $activityModel->getTotalActivities(array("`groupid` = '{$group->id}'"));
     $creators = array();
     $creators[] = CUserStatusCreator::getMessageInstance();
     if (($isAdmin || $isSuperAdmin) && $params->get('photopermission') == 1 || ($isMember || $isSuperAdmin) && $params->get('photopermission') == 2 || $isSuperAdmin) {
         $creators[] = CUserStatusCreator::getPhotoInstance();
     }
     if (($isAdmin || $isSuperAdmin) && $params->get('videopermission') == 1 || ($isMember || $isSuperAdmin) && $params->get('videopermission') == 2 || $isSuperAdmin) {
         $creators[] = CUserStatusCreator::getVideoInstance();
     }
     if (($allowCreateEvent || $isSuperAdmin) && $config->get('group_events') && $config->get('enableevents') && $config->get('createevents') || $isSuperAdmin) {
         $creators[] = CUserStatusCreator::getEventInstance();
     }
     $status = new CUserStatus($group->id, 'groups', $creators);
     // Get Event Admins
     $groupAdmins = $group->getAdmins(12, CC_RANDOMIZE);
     $adminsInArray = array();
     // Attach avatar of the admin
     for ($i = 0; $i < count($groupAdmins); $i++) {
         $row = $groupAdmins[$i];
         $admin = CFactory::getUser($row->id);
         array_push($adminsInArray, '<a href="' . CUrlHelper::userLink($admin->id) . '">' . $admin->getDisplayName() . '</a>');
     }
     $totalPhotos = 0;
     foreach ($albums as $album) {
         $albumParams = new CParameter($album->params);
         $totalPhotos = $totalPhotos + $albumParams->get('count');
     }
     $adminsList = ltrim(implode(', ', $adminsInArray), ',');
     $showMoreActivity = $totalStream <= $config->get('maxactivities') ? false : true;
     $groupsModel = CFactory::getModel('groups');
     $bannedMembers = $groupsModel->getBannedMembers($group->id);
     /* Opengraph */
     CHeadHelper::addOpengraph('og:image', $group->getAvatar('avatar'), true);
     CHeadHelper::addOpengraph('og:image', $group->getCover(), true);
     $featured = new CFeatured(FEATURED_GROUPS);
     $featuredList = $featured->getItemIds();
     echo $tmpl->setMetaTags('group', $group)->set('streamHTML', $streamHTML)->set('showMoreActivity', $showMoreActivity)->set('status', $status)->set('events', $events)->set('totalEvents', $totalEvents)->set('showEvents', $config->get('group_events') && $config->get('enableevents') && $params->get('eventpermission', 1) >= 1)->set('showPhotos', $params->get('photopermission') != -1 && $config->get('enablephotos') && $config->get('groupphotos'))->set('showVideos', $params->get('videopermission') != -1 && $config->get('enablevideos') && $config->get('groupvideos'))->set('eventPermission', $params->get('eventpermission'))->set('photoPermission', $params->get('photopermission'))->set('videoPermission', $params->get('videopermission'))->set('allowCreateEvent', $allowCreateEvent)->set('videos', $videos)->set('totalVideos', $totalVideos)->set('albums', $albums)->set('editGroup', $editGroup)->set('waitingApproval', $waitingApproval)->set('config', $config)->set('isMine', $isMine)->set('isAdmin', $isAdmin)->set('isSuperAdmin', $isSuperAdmin)->set('isMember', $isMember)->set('isInvited', $isInvited)->set('friendsCount', $friendsCount)->set('join', $join)->set('unapproved', $unapproved)->set('membersCount', $membersCount)->set('group', $group)->set('totalBulletin', $totalBulletin)->set('totalDiscussion', $totalDiscussion)->set('totalVideos', $totalVideos)->set('members', $approvedMembers)->set('bulletins', $bulletins)->set('discussions', $discussions)->set('discussionsHTML', $discussionsHTML)->set('bulletinsHTML', $bulletinsHTML)->set('isBanned', $isBanned)->set('totalBannedMembers', count($bannedMembers))->set('isPrivate', $group->approvals)->set('limit', $limit)->set('adminsList', $adminsList)->set('isFile', $fileModel->isfileAvailable($group->id, 'group'))->set('alertNewDiscussion', $my->count('group_discussion_' . $group->id) != $totalDiscussion)->set('alertNewBulletin', $my->count('group_bulletin_' . $group->id) != $totalBulletin)->set('alertNewStream', $my->count('group_activity_' . $group->id) != $totalStream)->set('isUserLiked', $isUserLiked)->set('totalLikes', $totalLikes)->set('isLikeEnabled', $isLikeEnabled)->set('totalPhotos', $totalPhotos)->set('totalAlbums', $totalAlbums)->set('profile', $my)->set('featuredList', $featuredList)->fetch('groups/single');
     // Update stream count cache, can only set this after we've set the alert aove
     $my->setCount('group_activity_' . $group->id, $totalStream);
 }
Ejemplo n.º 6
0
<a id="lists" name="listing"></a>

<?php 
if ($albums) {
    ?>

    <ul class="cMedia-ThumbList Albums cResetList cFloatedList clearfix">
        <?php 
    $i = 0;
    foreach ($albums as $album) {
        $coverThumbUri = $album->getCoverThumbURI();
        /* Filter normal user to view cover album */
        if ($album->type == 'profile.Cover' && !$album->isOwner && !$isSuperAdmin && !$isCommunityAdmin) {
            continue;
        }
        CHeadHelper::addOpengraph('og:image', $coverThumbUri, true);
        ?>

            <li class="album-permission-<?php 
        echo $album->permissions;
        ?>
">
                <div class="cMedia-Box">
                    <div class="cMedia-AlbumCover">
                        <a class="cPhotoAvatar" href="<?php 
        echo $album->getURI();
        ?>
">
                            <img class="cAvatar" src="<?php 
        echo $coverThumbUri;
        ?>
Ejemplo n.º 7
0
        <?php 
if ($albums) {
    ?>
            <ul class="joms-gallery">
                <?php 
    $i = 0;
    foreach ($albums as $album) {
        //check if current album is featured
        $isFeatured = in_array($album->id, $featuredList);
        $featurePermission = $isCommunityAdmin && ($type == PHOTOS_USER_TYPE || $type == PHOTOS_GROUP_TYPE) && ($album->permissions == 0 || $album->permissions == 10) && $album->type != 'profile.avatar';
        /* Filter normal user to view cover album */
        if (($album->type == 'profile.Cover' || $album->type == 'profile.avatar') && !$album->isOwner && !$isSuperAdmin && !$isCommunityAdmin) {
            continue;
        }
        CHeadHelper::addOpengraph('og:image', $album->getCoverThumbURI(), true);
        $isAvatarAlbum = strpos($album->type, '.avatar') !== false ? true : false;
        ?>
                        <li class="joms-gallery__item album-permission-<?php 
        echo $album->permissions;
        ?>
">
                            <div class="joms-gallery__thumbnail" >

                                <?php 
        if (in_array($album->id, $featuredList)) {
            ?>
                                    <div class="joms-ribbon__wrapper">
                                        <span
                                            class="joms-ribbon"><?php 
            echo JText::_('COM_COMMUNITY_FEATURED');