Ejemplo n.º 1
0
 function _groupPhoto()
 {
     $mainframe =& JFactory::getApplication();
     $document =& JFactory::getDocument();
     // Get necessary properties and load the libraries
     CFactory::load('models', 'photos');
     CFactory::load('helpers', 'friends');
     $my = CFactory::getUser();
     $model = CFactory::getModel('photos');
     $groupId = JRequest::getVar('groupid', '', 'GET');
     $albumId = JRequest::getVar('albumid', '', 'GET');
     $defaultId = JRequest::getVar('photoid', '', 'GET');
     if (empty($albumId)) {
         echo JText::_('CC NO PROPER ALBUM ID');
         return;
     }
     // Load the album table
     $album =& JTable::getInstance('Album', 'CTable');
     $album->load($albumId);
     // Set pathway
     $pathway =& $mainframe->getPathway();
     $pathway->addItem($album->name, '');
     CFactory::load('models', 'groups');
     $group =& JTable::getInstance('Group', 'CTable');
     $group->load($groupId);
     CFactory::load('helpers', 'group');
     //@rule: Do not allow non members to view albums for private group
     if (!CGroupHelper::allowViewMedia($group->id)) {
         // Set document title
         $document->setTitle(JText::_('CC RESTRICTED ACCESS'));
         $mainframe->enqueueMessage(JText::_('CC RESTRICTED ACCESS', 'notice'));
         echo JText::_('CC PHOTO NEED GROUP MEMBER PERMISSION');
         return;
     }
     // Get list of photos and set some limit to be displayed.
     // @todo: make limit configurable? set to 1000, unlimited?
     $photos = $model->getPhotos($albumId, 1000);
     // Set document title
     CFactory::load('helpers', 'string');
     $document->setTitle($album->name);
     // @checks: Test if album doesnt have any default photo id. We need to get the first row
     // of the photos to be the default
     if ($album->photoid == '0') {
         $album->photoid = count($photos) >= 1 ? $photos[0]->id : '0';
     }
     // Try to see if there is any photo id in the query
     $defaultId = !empty($defaultId) ? $defaultId : $album->photoid;
     // Load the default photo
     $photo =& JTable::getInstance('Photo', 'CTable');
     $photo->load($defaultId);
     // If default has an id of 0, we need to tell the template to dont process anything
     $default = $photo->id == 0 ? false : $photo;
     CFactory::load('helpers', 'owner');
     //friend list for photo tag
     CFactory::load('libraries', 'phototagging');
     $tagging = new CPhotoTagging();
     for ($i = 0; $i < count($photos); $i++) {
         // Convert the generic object row into CTablePhoto object
         $item =& JTable::getInstance('Photo', 'CTable');
         $item->bind($photos[$i]);
         $photos[$i] = $item;
         $row =& $photos[$i];
         $taggedList = $tagging->getTaggedList($row->id);
         for ($t = 0; $t < count($taggedList); $t++) {
             $tagItem =& $taggedList[$t];
             $tagUser = CFactory::getUser($tagItem->userid);
             $canRemoveTag = 0;
             // 1st we check the tagged user is the photo owner.
             //	If yes, canRemoveTag == true.
             //	If no, then check on user is the tag creator or not.
             //		If yes, canRemoveTag == true
             //		If no, then check on user whether user is being tagged
             if (COwnerHelper::isMine($my->id, $row->creator) || COwnerHelper::isMine($my->id, $tagItem->created_by) || COwnerHelper::isMine($my->id, $tagItem->userid)) {
                 $canRemoveTag = 1;
             }
             $tagItem->user = $tagUser;
             $tagItem->canRemoveTag = $canRemoveTag;
         }
         $row->tagged = $taggedList;
     }
     // for photo tagging. only allow to tag members
     $groupModel = CFactory::getModel('groups');
     $groupMemberIds = $groupModel->getMembersId($groupId, true);
     $friends = array();
     foreach ($groupMemberIds as $grpMemberId) {
         if ($my->id != $grpMemberId) {
             $memberUser = CFactory::getUser($grpMemberId);
             $friends[] = $memberUser;
         }
     }
     if (COwnerHelper::isCommunityAdmin() || $group->isAdmin($my->id) || $group->isMember($my->id)) {
         array_unshift($friends, $my);
     }
     CFactory::load('helpers', 'group');
     $allowManagePhotos = CGroupHelper::allowManagePhoto($groupId);
     // Only add these links when there are photos in the album
     if ($allowManagePhotos && $default) {
         $this->addSubmenuItem('', JText::_('CC SET IMAGE AS ALBUM COVER'), "setPhotoAsDefault();", true);
         $this->addSubmenuItem('', JText::_('CC DELETE IMAGE'), "removePhoto();", true);
     }
     // Show wall contents
     CFactory::load('helpers', 'friends');
     // Load up required objects.
     $friendModel = CFactory::getModel('friends');
     $config = CFactory::getConfig();
     $showWall = false;
     $allowTag = false;
     //check if we can allow the current viewing user to tag the photos
     if ($group->isMember($my->id) || $group->isAdmin($my->id) || COwnerHelper::isCommunityAdmin()) {
         $showWall = true;
         $allowTag = true;
     }
     $tmpl = new CTemplate();
     CFactory::load('libraries', 'bookmarks');
     $bookmarks = new CBookmarks(CRoute::getExternalURL('index.php?option=com_community&view=photos&task=album&albumid=' . $album->id . '&groupid=' . $group->id));
     $bookmarksHTML = $bookmarks->getHTML();
     $photoCreator = CFactory::getUser($photo->creator);
     $tmpl->set('bookmarksHTML', $bookmarksHTML);
     $tmpl->set('showWall', $showWall);
     $tmpl->set('allowTag', $allowTag);
     $tmpl->set('isOwner', $group->isAdmin($my->id));
     $tmpl->set('photos', $photos);
     $tmpl->set('default', $default);
     $tmpl->set('album', $album);
     $tmpl->set('friends', $friends);
     $tmpl->set('config', $config);
     $tmpl->set('photoCreator', $photoCreator);
     echo $tmpl->fetch('photos.photo');
 }
Ejemplo n.º 2
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');
     }
 }
Ejemplo n.º 3
0
/**
 * Deprecated since 1.8
 * Use CGroupHelper::allowViewMedia instead. 
 */
function cAllowViewMedia($groupId)
{
    return CGroupHelper::allowViewMedia($groupId);
}
Ejemplo n.º 4
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.º 5
0
    public function ajaxShowVideoFeatured($video_id)
    {
        $objResponse = new JAXResponse();
        $allowToView = true;
        //determine the view premission
        $my = CFactory::getUser();
        $video = JTable::getInstance('Video', 'CTable');
        if (!$video->load($video_id)) {
            $allowToView = false;
        }
        /* === Start Premission Checking === */
        $user = CFactory::getUser($video->creator);
        $blocked = $user->isBlocked();
        if ($blocked && !COwnerHelper::isCommunityAdmin()) {
            $allowToView = false;
        }
        if ($video->creator_type == VIDEO_GROUP_TYPE) {
            //CFactory::load( 'helpers' , 'group' );
            if (!CGroupHelper::allowViewMedia($video->groupid)) {
                $allowToView = false;
            }
        } else {
            if (!CPrivacy::isAccessAllowed($my->id, $video->creator, 'custom', $video->permissions)) {
                switch ($video->permissions) {
                    case '40':
                        $allowToView = false;
                        break;
                    case '30':
                        $allowToView = false;
                        $this->noAccess(JText::sprintf('COM_COMMUNITY_VIDEOS_FRIEND_PERMISSION_MESSAGE', $owner->getDisplayName()));
                        break;
                    default:
                        $allowToView = false;
                        break;
                }
            }
        }
        /* === End Permission Checking === */
        if ($allowToView) {
            // Hit counter + 1
            $video->hit();
            $notiHtml = '<div class="cVideo-Player video-player">
							' . $video->getPlayerHTML() . '
						</div>';
        } else {
            $notiHtml = JText::_('COM_COMMUNITY_VIDEO_UNABLE_VIEW');
        }
        // Get like
        //CFactory::load( 'libraries' , 'like' );
        $likes = new CLike();
        $likesHTML = $likes->getHTML('videos', $video->id, $my->id);
        // Get wall count
        //CFactory::load( 'libraries' , 'wall' );
        $wallCount = CWallLibrary::getWallCount('videos', $video->id);
        // Get video link
        $videoCommentLink = CRoute::_('index.php?option=com_community&view=videos&task=video&videoid=' . $video->id . '&groupid=' . $video->groupid . '&userid=' . $video->creator . '#comments');
        $videoLink = CRoute::_('index.php?option=com_community&view=videos&task=video&videoid=' . $video->id . '&groupid=' . $video->groupid . '&userid=' . $video->creator);
        $creatorName = $video->getCreatorName();
        $creatorLink = CRoute::_('index.php?option=com_community&view=profile&userid=' . $video->creator);
        $objResponse->addScriptCall('updatePlayer', $notiHtml, $video->title, $likesHTML, $video->getHits(), $wallCount, $videoLink, $videoCommentLink, $creatorName, $creatorLink);
        $objResponse->sendResponse();
    }
Ejemplo n.º 6
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');
 }