Пример #1
0
 /**
  * Application full view
  **/
 public function appFullView()
 {
     $document = JFactory::getDocument();
     $this->showSubmenu();
     $applicationName = JString::strtolower(JRequest::getVar('app', '', 'GET'));
     if (empty($applicationName)) {
         JError::raiseError(500, 'COM_COMMUNITY_APP_ID_REQUIRED');
     }
     if (!$this->accessAllowed('registered')) {
         return;
     }
     $output = '';
     //@todo: Since group walls doesn't use application yet, we process it manually now.
     if ($applicationName == 'walls') {
         CFactory::load('libraries', 'wall');
         $jConfig = JFactory::getConfig();
         $limit = JRequest::getInt('limit', 5, 'REQUEST');
         $limitstart = JRequest::getInt('limitstart', 0, 'REQUEST');
         $eventId = JRequest::getInt('eventid', '', 'GET');
         $my = CFactory::getUser();
         $config = CFactory::getConfig();
         $eventsModel = CFactory::getModel('Events');
         $event =& JTable::getInstance('Event', 'CTable');
         $event->load($eventId);
         $config = CFactory::getConfig();
         $document->setTitle(JText::sprintf('COM_COMMUNITY_EVENTS_WALL_TITLE', $event->title));
         CFactory::load('helpers', 'owner');
         $guest = $event->isMember($my->id);
         $waitingApproval = $event->isPendingApproval($my->id);
         $status = $event->getUserStatus($my->id, 'events');
         $responded = $status == COMMUNITY_EVENT_STATUS_ATTEND || $status == COMMUNITY_EVENT_STATUS_WONTATTEND || $status == COMMUNITY_EVENT_STATUS_MAYBE;
         if (!$config->get('lockeventwalls') || $config->get('lockeventwalls') && $guest && !$waitingApproval && $responded || COwnerHelper::isCommunityAdmin()) {
             $output .= CWallLibrary::getWallInputForm($event->id, 'events,ajaxSaveWall', 'events,ajaxRemoveWall');
             // Get the walls content
             $output .= '<div id="wallContent">';
             $output .= CWallLibrary::getWallContents('events', $event->id, $event->isAdmin($my->id), $limit, $limitstart, 'wall.content', 'events,events');
             $output .= '</div>';
             jimport('joomla.html.pagination');
             $wallModel = CFactory::getModel('wall');
             $pagination = new JPagination($wallModel->getCount($event->id, 'events'), $limitstart, $limit);
             $output .= '<div class="pagination-container">' . $pagination->getPagesLinks() . '</div>';
         }
     } else {
         CFactory::load('libraries', 'apps');
         $model = CFactory::getModel('apps');
         $applications =& CAppPlugins::getInstance();
         $applicationId = $model->getUserApplicationId($applicationName);
         $application = $applications->get($applicationName, $applicationId);
         if (!$application) {
             JError::raiseError(500, 'COM_COMMUNITY_APPS_NOT_FOUND');
         }
         // Get the parameters
         $manifest = CPluginHelper::getPluginPath('community', $applicationName) . DS . $applicationName . DS . $applicationName . '.xml';
         $params = new CParameter($model->getUserAppParams($applicationId), $manifest);
         $application->params =& $params;
         $application->id = $applicationId;
         $output = $application->onAppDisplay($params);
     }
     echo $output;
 }
Пример #2
0
 /**
  * Application full view
  * */
 public function appFullView()
 {
     /**
      * Opengraph
      */
     // CHeadHelper::setType('website', JText::_('COM_COMMUNITY_PHOTOS_WALL_TITLE'));
     $mainframe = JFactory::getApplication();
     $jinput = $mainframe->input;
     $applicationName = JString::strtolower($jinput->get->get('app', '', 'STRING'));
     if (empty($applicationName)) {
         JError::raiseError(500, JText::_('COM_COMMUNITY_APP_ID_REQUIRED'));
     }
     $output = '<div class="joms-page">';
     $output .= '<h3 class="joms-page__title">' . JText::_('COM_COMMUNITY_PHOTOS_WALL_TITLE') . '</h3>';
     if ($applicationName == 'walls') {
         //CFactory::load( 'libraries' , 'wall' );
         $limit = $jinput->request->get('limit', 5, 'INT');
         //JRequest::getVar( 'limit' , 5 , 'REQUEST' );
         $limitstart = $jinput->request->get('limitstart', 0, 'INT');
         //JRequest::getVar( 'limitstart', 0, 'REQUEST' );
         $albumId = JRequest::getInt('albumid', '');
         $my = CFactory::getUser();
         $album = JTable::getInstance('Album', 'CTable');
         $album->load($albumId);
         //CFactory::load( 'helpers' , 'owner' );
         //CFactory::load( 'helpers' , 'friends' );
         // Get the walls content
         $viewAllLink = false;
         $wallCount = false;
         if ($jinput->request->get('task', '') != 'app') {
             $viewAllLink = CRoute::_('index.php?option=com_community&view=photos&task=app&albumid=' . $album->id . '&app=walls');
             $wallCount = CWallLibrary::getWallCount('album', $album->id);
         }
         $output .= CWallLibrary::getWallContents('albums', $album->id, COwnerHelper::isCommunityAdmin() || COwnerHelper::isMine($my->id, $album->creator), $limit, $limitstart);
         if (CFriendsHelper::isConnected($my->id, $album->creator) || COwnerHelper::isCommunityAdmin()) {
             $output .= CWallLibrary::getWallInputForm($album->id, 'photos,ajaxAlbumSaveWall', 'photos,ajaxAlbumRemoveWall');
         }
         $output .= CWallLibrary::getViewAllLinkHTML($viewAllLink, $wallCount);
         jimport('joomla.html.pagination');
         $wallModel = CFactory::getModel('wall');
         $pagination = new JPagination($wallModel->getCount($album->id, 'albums'), $limitstart, $limit);
         $output .= '<div class="cPagination">' . $pagination->getPagesLinks() . '</div>';
     } else {
         $model = CFactory::getModel('apps');
         $applications = CAppPlugins::getInstance();
         $applicationId = $model->getUserApplicationId($applicationName);
         $application = $applications->get($applicationName, $applicationId);
         if (is_callable(array($application, 'onAppDisplay'), true)) {
             // Get the parameters
             $manifest = CPluginHelper::getPluginPath('community', $applicationName) . '/' . $applicationName . '/' . $applicationName . '.xml';
             $params = new CParameter($model->getUserAppParams($applicationId), $manifest);
             $application->params = $params;
             $application->id = $applicationId;
             $output = $application->onAppDisplay($params);
         } else {
             JError::raiseError(500, JText::_('COM_COMMUNITY_APPS_NOT_FOUND'));
         }
     }
     $output .= '</div>';
     echo $output;
 }
Пример #3
0
 /**
  * This method is an AJAX call that displays the walls form
  *
  * @param    photoId    int The current photo id that is being browsed.
  *
  * returns
  * */
 private function _getWallFormHTML($photoId)
 {
     // Include necessary libraries
     require_once JPATH_COMPONENT . '/libraries/wall.php';
     // Include helper
     require_once JPATH_COMPONENT . '/helpers/friends.php';
     // Load up required objects.
     $my = CFactory::getUser();
     $friendsModel = CFactory::getModel('friends');
     $config = CFactory::getConfig();
     $html = '';
     $photo = JTable::getInstance('Photo', 'CTable');
     $photo->load($photoId);
     $album = JTable::getInstance('Album', 'CTable');
     $album->load($photo->albumid);
     $handler = $this->_getHandler($album);
     if ($handler->isWallsAllowed($photoId)) {
         $html .= CWallLibrary::getWallInputForm($photoId, 'photos,ajaxSaveWall', 'photos,ajaxRemoveWall');
     }
     return $html;
 }
Пример #4
0
 /**
  * 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');
 }
Пример #5
0
        function _getWallHTML($userid, $limit, $limitstart, $allowPosting, $allowRemoval)
        {
            $config = CFactory::getConfig();
            $html = '';
            $viewAllLink = false;
            if (JRequest::getVar('task', '', 'REQUEST') != 'app') {
                $viewAllLink = CRoute::_('index.php?option=com_community&view=profile&userid=' . $userid . '&task=app&app=walls');
            }
            $wallCount = CWallLibrary::getWallCount('user', $userid);
            $wallModel = CFactory::getModel('wall');
            $wallsinput = "";
            if ($allowPosting) {
                $wallsinput = CWallLibrary::getWallInputForm($userid, 'plugins,walls,ajaxSaveWall', 'plugins,walls,ajaxRemoveWall', $viewAllLink);
            }
            $contents = CWallLibrary::getWallContents('user', $userid, $allowRemoval, $limit, $limitstart, 'wall.content', 'profile,profile');
            $contents .= CWallLibrary::getViewAllLinkHTML($viewAllLink, $wallCount);
            $html .= $wallsinput;
            $html .= '<div id="wallContent" style="display: block; visibility: visible;">';
            if ($contents == '') {
                $html .= '
				<div id="wall-empty-container">
					<div class="icon-nopost">
			            <img src="' . JURI::base() . 'plugins/community/walls/favicon.png" alt="" />
			        </div>
			        <div class="content-nopost">' . JText::_('PLG_WALLS_NO_WALL_POST') . '
			        </div>
				</div>';
            } else {
                $html .= CStringHelper::replaceThumbnails($contents);
            }
            $html .= '</div>';
            // Add pagination links, only in full app view
            if (JRequest::getVar('task', '', 'REQUEST') == 'app') {
                jimport('joomla.html.pagination');
                $pagination = new JPagination($wallModel->getCount($userid, 'user'), $limitstart, $limit);
                $html .= '
				<!-- Pagination -->
				<div style="text-align: center;">
					' . $pagination->getPagesLinks() . '
				</div>
				<!-- End Pagination -->';
            }
            return $html;
        }
Пример #6
0
 /**
  * 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');
 }
Пример #7
0
 public function _groupVideo()
 {
     $mainframe = JFactory::getApplication();
     $document = JFactory::getDocument();
     // Get necessary properties and load the libraries
     CFactory::load('models', 'videos');
     $my = CFactory::getUser();
     $model = CFactory::getModel('videos');
     $videoId = JRequest::getVar('videoid', '', 'GET');
     $groupId = JRequest::getVar('groupid', '', 'GET');
     $video = JTable::getInstance('Video', 'CTable');
     $video->load($videoId);
     $video->loadExtra();
     CFactory::load('helpers', 'owner');
     $user = CFactory::getUser($video->creator);
     $blocked = $user->isBlocked();
     if ($blocked && !COwnerHelper::isCommunityAdmin()) {
         $tmpl = new CTemplate();
         echo $tmpl->fetch('profile.blocked');
         return;
     }
     if (empty($videoId)) {
         $url = CRoute::_('index.php?option=com_community&view=videos', false);
         $mainframe->redirect($url, JText::_('COM_COMMUNITY_VIDEOS_ID_ERROR'), 'warning');
     }
     CFactory::load('helpers', 'group');
     // Check permission
     if (!CGroupHelper::allowViewMedia($groupId)) {
         // Set document title
         $document->setTitle(JText::_('COM_COMMUNITY_RESTRICTED_ACCESS'));
         $mainframe->enqueueMessage(JText::_('COM_COMMUNITY_RESTRICTED_ACCESS', 'notice'));
         echo JText::_('COM_COMMUNITY_GROUPS_VIDEO_MEMBER_PERMISSION');
     } else {
         // Get extra properties
         $video->player = $video->getViewHTML($video->getWidth(), $video->getHeight());
         $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));
         // Set pathway
         $pathway =& $mainframe->getPathway();
         $pathway->addItem('Video', CRoute::_('index.php?option=com_community&view=videos'));
         $pathway->addItem($video->title, '');
         // Set the current user's active profile
         CFactory::setActiveProfile($video->creator);
         // Set document title
         $document->setTitle($video->title);
         CFactory::load('libraries', 'bookmarks');
         $bookmarks = new CBookmarks($video->permalink);
         $bookmarksHTML = $bookmarks->getHTML();
         $tmpl = new CTemplate();
         // Get the walls
         CFactory::load('libraries', 'wall');
         $wallContent = CWallLibrary::getWallContents('videos', $video->id, COwnerHelper::isCommunityAdmin() || $my->id == $video->creator && $my->id != 0, 10, 0);
         $wallForm = '';
         $viewAllLink = false;
         if (JRequest::getVar('task', '', 'REQUEST') != 'app') {
             $viewAllLink = CRoute::_('index.php?option=com_community&view=videos&task=app&videoid=' . $video->id . '&app=walls');
         }
         $wallForm = CWallLibrary::getWallInputForm($video->id, 'videos,ajaxSaveWall', 'videos,ajaxRemoveWall', $viewAllLink);
         $redirectUrl = CRoute::getURI(false);
         $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');
     }
 }
Пример #8
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');
 }
Пример #9
0
 public function ajaxGetInfo($videoId, $showAllComments = false)
 {
     $my = CFactory::getUser();
     $config = CFactory::getConfig();
     $json = array();
     $video = JTable::getInstance('Video', 'CTable');
     $video->load($videoId);
     // Get the header info.
     $header = $this->getVideoInfoHeader($video);
     // Get the wall form.
     $wallInput = '';
     if (CPrivacy::isAccessAllowed($my->id, $video->creator, 'custom', PRIVACY_FRIENDS) || !$config->get('lockvideoswalls')) {
         $wallInput = CWallLibrary::getWallInputForm($video->id, 'videos,ajaxSaveWall', 'videos,ajaxRemoveWall');
     }
     // Get the wall contents.
     $wallContents = CWallLibrary::getWallContents('videos', $video->id, COwnerHelper::isCommunityAdmin() || $my->id == $video->creator && $my->id != 0, $showAllComments ? false : $config->get('stream_default_comments'), 0, 'wall/content', 'videos,video');
     // JSON.
     $json['head'] = $header;
     $json['comments'] = $wallContents;
     $json['form'] = $wallInput;
     $json['description'] = array('content' => $video->description, 'excerpt' => JHTML::_('string.truncate', $video->description, $config->getInt('streamcontentlength')), 'lang_cancel' => JText::_('COM_COMMUNITY_CANCEL'), 'lang_save' => JText::_('COM_COMMUNITY_SAVE'), 'lang_add' => JText::_('COM_COMMUNITY_ADD_DESCRIPTION'), 'lang_edit' => JText::_('COM_COMMUNITY_EDIT_DESCRIPTION'), 'lang_placeholder' => JText::_('COM_COMMUNITY_EDIT_DESCRIPTION_PLACEHOLDER'));
     // Get the wall comments count.
     $totalComments = CWallLibrary::getWallCount('videos', $video->id);
     // Only show if we are not showing all comments, and total comments is not 0.
     if (!$showAllComments) {
         $commentDiff = $totalComments - $config->get('stream_default_comments');
         if ($commentDiff > 0) {
             $json['showall'] = JText::_('COM_COMMUNITY_SHOW_PREVIOUS_COMMENTS') . ' (' . $commentDiff . ')';
         }
     }
     // Tag info.
     $json['tagged'] = $this->getVideoTags($video);
     $json['tagLabel'] = JText::_('COM_COMMUNITY_VIDEOS_IN_THIS_VIDEO');
     $json['tagRemoveLabel'] = JText::_('COM_COMMUNITY_REMOVE');
     die(json_encode($json));
 }
Пример #10
0
 /**
  * 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');
 }