本文整理汇总了PHP中CTemplate::setMetaTags方法的典型用法代码示例。如果您正苦于以下问题:PHP CTemplate::setMetaTags方法的具体用法?PHP CTemplate::setMetaTags怎么用?PHP CTemplate::setMetaTags使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CTemplate
的用法示例。
在下文中一共展示了CTemplate::setMetaTags方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: viewGroup
//.........这里部分代码省略.........
// We should really load this in saperate file
// @todo: editing group should really open a new page
if ($my->id == $group->ownerid || COwnerHelper::isCommunityAdmin()) {
$categories = $groupModel->getCategories();
CError::assert($categories, 'array', 'istype', __FILE__, __LINE__);
$tmpl->set('categories', $categories);
}
$isMine = $my->id == $group->ownerid;
// Get reporting html
CFactory::load('libraries', 'reporting');
$report = new CReportingLibrary();
$reportHTML = $report->getReportingHTML(JText::_('COM_COMMUNITY_REPORT_GROUP'), 'groups,reportGroup', array($group->id));
$isSuperAdmin = COwnerHelper::isCommunityAdmin();
if ($group->approvals == '1' && !$isMine && !$isMember && !$isSuperAdmin) {
$this->addWarning(JText::_('COM_COMMUNITY_GROUPS_PRIVATE_NOTICE'));
}
$videoThumbWidth = CVideoLibrary::thumbSize('width');
$videoThumbHeight = CVideoLibrary::thumbSize('height');
$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;
}
$allowManagePhotos = CGroupHelper::allowManagePhoto($group->id);
$allowManageVideos = CGroupHelper::allowManageVideo($group->id);
$allowCreateEvent = CGroupHelper::allowCreateEvent($my->id, $group->id);
CFactory::load('libraries', 'bookmarks');
$bookmarks = new CBookmarks(CRoute::getExternalURL('index.php?option=com_community&view=groups&task=viewgroup&groupid=' . $group->id));
$bookmarksHTML = $bookmarks->getHTML();
$isCommunityAdmin = COwnerHelper::isCommunityAdmin();
if ($group->approvals == '0' || $isMine || $isMember && !$isBanned || $isCommunityAdmin) {
// 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);
}
$friendsModel = CFactory::getModel('Friends');
$groupsModel = CFactory::getModel('Groups');
CFactory::load('libraries', 'invitation');
$inviteHTML = CInvitation::getHTML(null, 'groups,inviteUsers', $group->id);
// Add tagging code
/*
$tagsHTML = '';
if($config->get('tags_groups')){
CFactory::load('libraries', 'tags');
$tags = new CTags();
$tagsHTML = $tags->getHTML('groups', $group->id, $isAdmin );
}
*/
// Upgrade wall to stream @since 2.5
if (!$params->get('stream', FALSE)) {
$group->upgradeWallToStream();
}
// Add custom stream
$activities = new CActivities();
$streamHTML = $groupLib->getStreamHTML($group);
$totalStream = $activityModel->getTotalActivities(array("`groupid` = '{$group->id}'"));
CFactory::load('libraries', 'userstatus');
$creators = array();
$creators[] = CUserStatusCreator::getMessageInstance();
if ($isAdmin && $params->get('photopermission') == 1 || $isMember && $params->get('photopermission') == 2) {
$creators[] = CUserStatusCreator::getPhotoInstance();
}
if ($isAdmin && $params->get('videopermission') == 1 || $isMember && $params->get('videopermission') == 2) {
$creators[] = CUserStatusCreator::getVideoInstance();
}
if ($allowCreateEvent && $config->get('group_events') && $config->get('enableevents') && ($config->get('createevents') || COwnerHelper::isCommunityAdmin())) {
$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>');
}
$adminsList = ltrim(implode(', ', $adminsInArray), ',');
echo $tmpl->setMetaTags('group', $group)->set('streamHTML', $streamHTML)->set('status', $status)->set('likesHTML', $likesHTML)->set('events', $events)->set('totalEvents', $totalEvents)->set('inviteHTML', $inviteHTML)->set('showEvents', $config->get('group_events') && $config->get('enableevents'))->set('showPhotos', $params->get('photopermission') != -1)->set('showVideos', $params->get('videopermission') != -1)->set('bookmarksHTML', $bookmarksHTML)->set('allowManagePhotos', $allowManagePhotos)->set('allowManageVideos', $allowManageVideos)->set('allowCreateEvent', $allowCreateEvent)->set('videos', $videos)->set('videoThumbWidth', $videoThumbWidth)->set('videoThumbHeight', $videoThumbHeight)->set('totalVideos', $totalVideos)->set('albums', $albums)->set('totalAlbums', $totalAlbums)->set('reportHTML', $reportHTML)->set('editGroup', $editGroup)->set('waitingApproval', $waitingApproval)->set('config', $config)->set('my', $my)->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('wallForm', $wallForm)->set('wallContent', $wallContent)->set('discussions', $discussions)->set('discussionsHTML', $discussionsHTML)->set('bulletinsHTML', $bulletinsHTML)->set('isCommunityAdmin', $isCommunityAdmin)->set('isBanned', $isBanned)->set('isPrivate', $group->approvals)->set('limit', $limit)->set('adminsList', $adminsList)->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)->fetch('groups.viewgroup');
// Update stream count cache, can only set this after we've set the alert aove
$my->setCount('group_activity_' . $group->id, $totalStream);
}
示例2: viewevent
//.........这里部分代码省略.........
$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');
}
示例3: video
//.........这里部分代码省略.........
}
$this->_addSubmenu();
$this->showSubmenu();
// Show the mini header when viewing other's photos
if ($video->creator_type == VIDEO_USER_TYPE && $my->id != $video->creator) {
$this->attachMiniHeaderUser($video->creator);
}
// Check permission
$user = CFactory::getUser($video->creator);
$blocked = $user->isBlocked();
if ($blocked && !COwnerHelper::isCommunityAdmin()) {
$tmpl = new CTemplate();
echo $tmpl->fetch('profile.blocked');
return;
}
if ($video->creator_type == VIDEO_GROUP_TYPE) {
CFactory::load('helpers', 'group');
if (!CGroupHelper::allowViewMedia($groupId)) {
$document->setTitle(JText::_('CC RESTRICTED ACCESS'));
$mainframe->enqueueMessage(JText::_('CC RESTRICTED ACCESS', 'notice'));
echo JText::_('CC VIDEO NEED GROUP MEMBER PERMISSION');
return;
}
$group =& JTable::getInstance('Group', 'CTable');
$group->load($groupId);
// Set pathway
$pathway =& $mainframe->getPathway();
$pathway->addItem(JText::_('CC GROUPS'), CRoute::_('index.php?option=com_community&view=groups'));
$pathway->addItem($group->name, CRoute::_('index.php?option=com_community&view=groups&task=viewgroup&groupid=' . $groupId));
$pathway->addItem(JText::_('CC VIDEOS'), CRoute::_('index.php?option=com_community&view=videos&groupid=' . $groupId));
$pathway->addItem($video->getTitle(), '');
} else {
if (!$this->isPermitted($my->id, $video->creator, $video->permissions)) {
$document->setTitle(JText::_('CC RESTRICTED ACCESS'));
$mainframe->enqueueMessage(JText::_('CC RESTRICTED ACCESS', 'notice'));
switch ($video->permissions) {
case '40':
echo JText::_('CC VIDEO OWNNER ONLY', 'notice');
break;
case '30':
$owner = CFactory::getUser($video->creator);
echo JText::sprintf('CC VIDEO NEED FRIEND PERMISSION', $owner->getDisplayName());
break;
default:
echo '<p>' . JText::_('CC VIDEO NEED LOGIN', 'notice') . '</p>';
break;
}
return;
}
// Set pathway
$pathway =& $mainframe->getPathway();
$pathway->addItem('Video', CRoute::_('index.php?option=com_community&view=videos'));
$pathway->addItem($video->getTitle(), '');
}
// Set the current user's active profile
CFactory::setActiveProfile($video->creator);
// Hit counter + 1
$video->hit();
// Get reporting html
$reportHTML = '';
CFactory::load('libraries', 'reporting');
$report = new CReportingLibrary();
$reportHTML = $report->getReportingHTML(JText::_('CC REPORT VIDEOS'), 'videos,reportVideo', array($video->id));
// Get bookmark html
CFactory::load('libraries', 'bookmarks');
$bookmarks = new CBookmarks($video->getPermalink());
$bookmarksHTML = $bookmarks->getHTML();
// Get the walls
CFactory::load('libraries', 'wall');
$wallContent = CWallLibrary::getWallContents('videos', $video->id, COwnerHelper::isCommunityAdmin() || $my->id == $video->creator && $my->id != 0, 10, 0);
$wallCount = CWallLibrary::getWallCount('videos', $video->id);
$viewAllLink = false;
if (JRequest::getVar('task', '', 'REQUEST') != 'app') {
$viewAllLink = CRoute::_('index.php?option=com_community&view=videos&task=app&videoid=' . $video->id . '&app=walls');
}
$wallContent .= CWallLibrary::getViewAllLinkHTML($viewAllLink, $wallCount);
$wallForm = '';
$wallForm = CWallLibrary::getWallInputForm($video->id, 'videos,ajaxSaveWall', 'videos,ajaxRemoveWall', $viewAllLink);
$redirectUrl = CRoute::getURI(false);
// Get like
CFactory::load('libraries', 'like');
$likes = new CLike();
$likesHTML = $likes->getHTML('videos', $video->id, $my->id);
$tmpl = new CTemplate();
$tmpl->setMetaTags('video', $video);
if ($video->creator_type == VIDEO_GROUP_TYPE) {
$group =& JTable::getInstance('Group', 'CTable');
$group->load($groupId);
$document =& JFactory::getDocument();
$document->addHeadLink($group->getThumbAvatar(), 'image_src', 'rel');
}
$tmpl->set('likesHTML', $likesHTML);
$tmpl->set('redirectUrl', $redirectUrl);
$tmpl->set('wallForm', $wallForm);
$tmpl->set('wallContent', $wallContent);
$tmpl->set('bookmarksHTML', $bookmarksHTML);
$tmpl->set('reportHTML', $reportHTML);
$tmpl->set('video', $video);
echo $tmpl->fetch('videos.video');
}
示例4: viewevent
//.........这里部分代码省略.........
$allday = false;
if ($startDate->format('%Y-%m-%d') == $endDate->format('%Y-%m-%d') && $startDate->format('%H:%M:%S') == '00:00:00' && $endDate->format('%H:%M:%S') == '23:59:59') {
$format = JText::_('COM_COMMUNITY_EVENT_TIME_FORMAT_LC1');
$allday = true;
}
$event->startdateHTML = CTimeHelper::getFormattedTime($event->startdate, $format);
$event->enddateHTML = CTimeHelper::getFormattedTime($event->enddate, $format);
if (!isset($event->params)) {
$event->params = '';
}
$params = new CParameter($event->params);
$event->defaultCover = $event->isDefaultCover();
// Cover position.
$event->coverPostion = $params->get('coverPosition', '');
if (strpos($event->coverPostion, '%') === false) {
$event->coverPostion = 0;
}
// Find cover album and photo.
$event->coverAlbum = false;
$event->coverPhoto = false;
$album = JTable::getInstance('Album', 'CTable');
$albumId = $album->isCoverExist('event', $event->id);
if ($albumId) {
$album->load($albumId);
$event->coverAlbum = $albumId;
$event->coverPhoto = $album->photoid;
}
$inviteHTML = CInvitation::getHTML(null, 'events,inviteUsers', $event->id, CInvitation::SHOW_FRIENDS, CInvitation::SHOW_EMAIL);
$status = new CUserStatus($event->id, 'events');
$tmpl = new CTemplate();
$creator = new CUserStatusCreator('message');
$creator->title = $isMine ? JText::_('COM_COMMUNITY_STATUS') : JText::_('COM_COMMUNITY_MESSAGE');
$creator->html = $tmpl->fetch('status.message');
$status->addCreator($creator);
// Upgrade wall to stream @since 2.5
$event->upgradeWallToStream();
// Add custom stream
$streamHTML = $eventLib->getStreamHTML($event);
if ($event->getMemberStatus($my->id) == COMMUNITY_EVENT_STATUS_ATTEND) {
$RSVPmessage = JText::_('COM_COMMUNITY_EVENTS_ATTENDING_EVENT_MESSAGE');
} else {
if ($event->getMemberStatus($my->id) == COMMUNITY_EVENT_STATUS_WONTATTEND) {
$RSVPmessage = JText::_('COM_COMMUNITY_EVENTS_NOT_ATTENDING_EVENT_MESSAGE');
} else {
$RSVPmessage = JText::_('COM_COMMUNITY_EVENTS_NOT_RESPOND_RSVP_MESSAGE');
}
}
// Get recurring event series
$eventSeries = null;
$seriesCount = 0;
if ($event->isRecurring()) {
$advance = array('expired' => false, 'return' => 'object', 'limit' => COMMUNITY_EVENT_SERIES_LIMIT, 'exclude' => $event->id, 'published' => 1);
$tempseries = $eventModel->getEventChilds($event->parent, $advance);
foreach ($tempseries as $series) {
$table = JTable::getInstance('Event', 'CTable');
$table->bind($series);
$eventSeries[] = $table;
}
$seriesCount = $eventModel->getEventChildsCount($event->parent);
}
//pending request invitation guest
$pendingRequestGuests = $event->getMembers(COMMUNITY_EVENT_STATUS_REQUESTINVITE, 0, false, false);
// Pre-load multiple users at once
$tempUserInfo = array();
foreach ($pendingRequestGuests as $uid) {
$tempUserInfo[] = CFactory::getUser($uid->id);
}
$pendingRequestGuests = $tempUserInfo;
$featured = new CFeatured(FEATURED_EVENTS);
$featuredList = $featured->getItemIds();
// Get Attending Event Guests
$maybeList = $event->getMembers(COMMUNITY_EVENT_STATUS_MAYBE, 12, CC_RANDOMIZE);
$maybeCount = $event->getMembersCount(COMMUNITY_EVENT_STATUS_MAYBE);
$tempUserInfo = array();
foreach ($maybeList as $uid) {
$tempUserInfo[] = CFactory::getUser($uid->id);
}
$maybeList = $tempUserInfo;
$wontAttendList = $event->getMembers(COMMUNITY_EVENT_STATUS_WONTATTEND, 12, CC_RANDOMIZE);
$wontAttendCount = $event->getMembersCount(COMMUNITY_EVENT_STATUS_WONTATTEND);
$tempUserInfo = array();
foreach ($wontAttendList as $uid) {
$tempUserInfo[] = CFactory::getUser($uid->id);
}
$wontAttendList = $tempUserInfo;
//gets all the albums related to this photo
$photosModel = CFactory::getModel('photos');
$albums = $photosModel->getEventAlbums($event->id);
$totalPhotos = 0;
foreach ($albums as $album) {
$albumParams = new CParameter($album->params);
$totalPhotos = $totalPhotos + $albumParams->get('count');
}
//get total videos
$videosModel = CFactory::getModel('videos');
$videos = $videosModel->getEventVideos($eventid);
$totalVideos = count($videosModel->getEventVideos($eventid));
// Output to template
echo $tmpl->setMetaTags('event', $event)->set('status', $status)->set('albums', $albums)->set('videos', $videos)->set('pendingRequestGuests', $pendingRequestGuests)->set('streamHTML', $streamHTML)->set('timezone', CTimeHelper::getTimezone($event->offset))->set('handler', $handler)->set('isUserLiked', $isUserLiked)->set('totalLikes', $totalLikes)->set('inviteHTML', $inviteHTML)->set('guestStatus', $event->getUserStatus($my->id))->set('event', $event)->set('radioList', $radioList)->set('bookmarksHTML', $bookmarksHTML)->set('isLikeEnabled', $isLikeEnabled)->set('isEventGuest', $isEventGuest)->set('isMine', $isMine)->set('isAdmin', $isAdmin)->set('isCommunityAdmin', $isCommunityAdmin)->set('unapproved', $unapprovedCount)->set('waitingApproval', $waitingApproval)->set('wallContent', $wallContent)->set('eventMembers', $eventMembers)->set('eventMembersCount', $eventMembersCount)->set('editEvent', $editEvent)->set('my', $my)->set('creator', CFactory::getUser($event->creator))->set('memberStatus', $myStatus)->set('waitingRespond', $waitingRespond)->set('isInvited', $isInvited)->set('join', $join)->set('friendsCount', $friendsCount)->set('isPastEvent', $isPastEvent)->set('adminsList', $adminsList)->set('RSVPmessage', $RSVPmessage)->set('allday', $allday)->set('eventSeries', $eventSeries)->set('seriesCount', $seriesCount)->set('groupEventDetails', isset($groupEventDetails) ? $groupEventDetails : null)->set('featuredList', $featuredList)->set('photoPermission', $params->get('photopermission'))->set('videoPermission', $params->get('videopermission'))->set('showPhotos', $params->get('photopermission') != -1 && $config->get('enablephotos') && $config->get('eventphotos'))->set('showVideos', $params->get('videopermission') != -1 && $config->get('enablevideos') && $config->get('eventvideos'))->set('totalPhotos', $totalPhotos)->set('totalVideos', $totalVideos)->set('maybeList', $maybeList)->set('maybeCount', $maybeCount)->set('wontAttendList', $wontAttendList)->set('wontAttendCount', $wontAttendCount)->fetch('events/single');
}
示例5: video
//.........这里部分代码省略.........
/**
* 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');
}
示例6: viewGroup
//.........这里部分代码省略.........
$videoThumbWidth = CVideoLibrary::thumbSize('width');
$videoThumbHeight = CVideoLibrary::thumbSize('height');
$totalVideos = $videoModel->total;
$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;
}
$allowManagePhotos = CGroupHelper::allowManagePhoto($group->id);
$allowManageVideos = CGroupHelper::allowManageVideo($group->id);
$allowCreateEvent = CGroupHelper::allowCreateEvent($my->id, $group->id);
CFactory::load('libraries', 'bookmarks');
$bookmarks = new CBookmarks(CRoute::getExternalURL('index.php?option=com_community&view=groups&task=viewgroup&groupid=' . $group->id));
$bookmarksHTML = $bookmarks->getHTML();
$isCommunityAdmin = COwnerHelper::isCommunityAdmin();
if ($group->approvals == '0' || $isMine || $isMember && !$isBanned || $isCommunityAdmin) {
// 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::_('CC 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::_('CC 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::_('CC SUBSCRIBE TO GROUP PHOTOS FEEDS') . '" href="' . $feedLink . '"/>';
$mainframe->addCustomHeadTag($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::_('CC SUBSCRIBE TO GROUP VIDEOS FEEDS') . '" href="' . $feedLink . '"/>';
$mainframe->addCustomHeadTag($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::_('CC SUBSCRIBE TO GROUP EVENTS FEEDS') . '" href="' . $feedLink . '"/>';
$mainframe->addCustomHeadTag($feed);
}
$friendsModel = CFactory::getModel('Friends');
$groupsModel = CFactory::getModel('Groups');
$tmpFriends = $friendsModel->getFriends($my->id, 'name', false);
$friends = array();
for ($i = 0; $i < count($tmpFriends); $i++) {
$friend =& $tmpFriends[$i];
$groupInvite =& JTable::getInstance('GroupInvite', 'CTable');
$groupInvite->load($group->id, $friend->id);
if (!$groupsModel->isMember($friend->id, $group->id)) {
$friends[] = $friend;
}
}
unset($tmpFriends);
CFactory::load('libraries', 'invitation');
$inviteHTML = CInvitation::getHTML($friends, 'groups,inviteUsers', $group->id);
$tmpl->setMetaTags('group', $group);
$tmpl->set('likesHTML', $likesHTML);
$tmpl->set('events', $events);
$tmpl->set('totalEvents', $totalEvents);
$tmpl->set('inviteHTML', $inviteHTML);
$tmpl->set('showEvents', $params->get('eventpermission') != -1);
$tmpl->set('showPhotos', $params->get('photopermission') != -1);
$tmpl->set('showVideos', $params->get('videopermission') != -1);
$tmpl->set('bookmarksHTML', $bookmarksHTML);
$tmpl->set('allowManagePhotos', $allowManagePhotos);
$tmpl->set('allowManageVideos', $allowManageVideos);
$tmpl->set('allowCreateEvent', $allowCreateEvent);
$tmpl->set('videos', $videos);
$tmpl->set('videoThumbWidth', $videoThumbWidth);
$tmpl->set('videoThumbHeight', $videoThumbHeight);
$tmpl->set('totalVideos', $totalVideos);
$tmpl->set('albums', $albums);
$tmpl->set('totalAlbums', $totalAlbums);
$tmpl->set('reportHTML', $reportHTML);
$tmpl->set('editGroup', $editGroup);
$tmpl->set('waitingApproval', $waitingApproval);
$tmpl->set('config', $config);
$tmpl->set('my', $my);
$tmpl->set('isMine', $isMine);
$tmpl->set('isAdmin', $isAdmin);
$tmpl->set('isSuperAdmin', $isSuperAdmin);
$tmpl->set('isMember', $isMember);
$tmpl->set('isInvited', $isInvited);
$tmpl->set('friendsCount', $friendsCount);
$tmpl->set('join', $join);
$tmpl->set('unapproved', count($unapproved));
$tmpl->set('membersCount', $membersCount);
$tmpl->set('group', $group);
$tmpl->set('totalBulletin', $totalBulletin);
$tmpl->set('totalDiscussion', $totalDiscussion);
$tmpl->set('members', $members);
$tmpl->set('admins', $admins);
$tmpl->set('adminsCount', $adminsCount);
$tmpl->set('bulletins', $bulletins);
$tmpl->set('wallForm', $wallForm);
$tmpl->set('wallContent', $wallContent);
$tmpl->set('discussions', $discussions);
$tmpl->set('discussionsHTML', $discussionsHTML);
$tmpl->set('bulletinsHTML', $bulletinsHTML);
$tmpl->set('isCommunityAdmin', $isCommunityAdmin);
$tmpl->set('isBanned', $isBanned);
echo $tmpl->fetch('groups.viewgroup');
}
示例7: viewGroup
//.........这里部分代码省略.........
$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);
}
示例8: video
//.........这里部分代码省略.........
$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');
}
示例9: viewevent
//.........这里部分代码省略.........
foreach ($eventMembers as $uid) {
$userids[] = $uid->id;
}
CFactory::loadUsers($userids);
for ($i = 0; $i < count($eventMembers); $i++) {
$row =& $eventMembers[$i];
$eventMembers[$i] = CFactory::getUser($row->id);
}
// Pre-load multiple users at once
$waitingApproval = $event->isPendingApproval($my->id);
$waitingRespond = false;
$myStatus = $event->getUserStatus($my->id);
$hasResponded = $myStatus == COMMUNITY_EVENT_STATUS_ATTEND || $myStatus == COMMUNITY_EVENT_STATUS_WONTATTEND || $myStatus == COMMUNITY_EVENT_STATUS_MAYBE;
// Get Bookmark HTML
CFactory::load('libraries', 'bookmarks');
$bookmarks = new CBookmarks(CRoute::getExternalURL('index.php?option=com_community&view=events&task=viewevent&eventid=' . $event->id));
$bookmarksHTML = $bookmarks->getHTML();
// Get Reporting HTML
CFactory::load('libraries', 'reporting');
$report = new CReportingLibrary();
$reportHTML = $report->getReportingHTML(JText::_('COM_COMMUNITY_EVENTS_REPORT'), 'events,reportEvent', array($event->id));
// Get the Wall
CFactory::load('libraries', 'wall');
$wallContent = CWallLibrary::getWallContents('events', $event->id, $isAdmin, 10, 0, 'wall.content', 'events,events');
$wallCount = CWallLibrary::getWallCount('events', $event->id);
$viewAllLink = false;
if (JRequest::getVar('task', '', 'REQUEST') != 'app') {
$viewAllLink = CRoute::_('index.php?option=com_community&view=events&task=app&eventid=' . $event->id . '&app=walls');
}
$wallContent .= CWallLibrary::getViewAllLinkHTML($viewAllLink, $wallCount);
$wallForm = '';
/*if( !$config->get('lockeventwalls')
|| ($config->get('lockeventwalls') && ($isEventGuest) && !($waitingApproval) && $hasResponded)
|| $isCommunityAdmin )
{
$wallForm = CWallLibrary::getWallInputForm( $event->id , 'events,ajaxSaveWall', 'events,ajaxRemoveWall' );
}*/
// Construct the RVSP radio list
$arr = array(JHTML::_('select.option', COMMUNITY_EVENT_STATUS_ATTEND, JText::_('COM_COMMUNITY_EVENTS_YES')), JHTML::_('select.option', COMMUNITY_EVENT_STATUS_WONTATTEND, JText::_('COM_COMMUNITY_EVENTS_NO')), JHTML::_('select.option', COMMUNITY_EVENT_STATUS_MAYBE, JText::_('COM_COMMUNITY_EVENTS_MAYBE')));
$status = $event->getMemberStatus($my->id);
$radioList = JHTML::_('select.radiolist', $arr, 'status', '', 'value', 'text', $status, false);
$unapprovedCount = $event->inviteRequestCount();
//...
$editEvent = JRequest::getVar('edit', false, 'GET');
$editEvent = $editEvent == 1 ? true : false;
// Am I invited in this event?
$isInvited = false;
$join = '';
$friendsCount = 0;
$isInvited = $eventModel->isInvitedMe(0, $my->id, $event->id);
// If I was invited, I want to know my invitation informations
if ($isInvited) {
$invitor = CFactory::getUser($isInvited[0]->invited_by);
$join = '<a href="' . CUrlHelper::userLink($invitor->id) . '">' . $invitor->getDisplayName() . '</a>';
// Get users friends in this group
$friendsCount = $eventModel->getFriendsCount($my->id, $event->id);
}
// Get like
CFactory::load('libraries', 'like');
$likes = new CLike();
$likesHTML = $likes->getHTML('events', $event->id, $my->id);
// Is this event is a past event?
$now = new JDate();
$isPastEvent = $event->getEndDate(false)->toMySQL() < $now->toMySQL(true) ? true : false;
// Get the formated date & time
$format = $config->get('eventshowampm') ? JText::_('COM_COMMUNITY_EVENTS_TIME_FORMAT_12HR') : JText::_('COM_COMMUNITY_EVENTS_TIME_FORMAT_24HR');
$startDate = $event->getStartDate(false);
$endDate = $event->getEndDate(false);
$allday = false;
if ($startDate->toFormat('%Y-%m-%d') == $endDate->toFormat('%Y-%m-%d') && $startDate->toFormat('%H:%M:%S') == '00:00:00' && $endDate->toFormat('%H:%M:%S') == '23:59:59') {
$format = JText::_('COM_COMMUNITY_EVENT_TIME_FORMAT_LC1');
$allday = true;
}
$event->startdateHTML = CTimeHelper::getFormattedTime($event->startdate, $format);
$event->enddateHTML = CTimeHelper::getFormattedTime($event->enddate, $format);
CFactory::load('libraries', 'invitation');
$inviteHTML = CInvitation::getHTML(null, 'events,inviteUsers', $event->id, CInvitation::SHOW_FRIENDS, CInvitation::SHOW_EMAIL);
CFactory::load('libraries', 'userstatus');
$status = new CUserStatus($event->id, 'events');
$tmpl = new CTemplate();
$creator = new CUserStatusCreator('message');
$creator->title = $isMine ? JText::_('COM_COMMUNITY_STATUS') : JText::_('COM_COMMUNITY_MESSAGE');
$creator->html = $tmpl->fetch('status.message');
$status->addCreator($creator);
// Upgrade wall to stream @since 2.5
$event->upgradeWallToStream();
// Add custom stream
$streamHTML = $eventLib->getStreamHTML($event);
if ($event->getMemberStatus($my->id) == COMMUNITY_EVENT_STATUS_ATTEND) {
$RSVPmessage = JText::_('COM_COMMUNITY_EVENTS_ATTENDING_EVENT_MESSAGE');
} else {
if ($event->getMemberStatus($my->id) == COMMUNITY_EVENT_STATUS_WONTATTEND) {
$RSVPmessage = JText::_('COM_COMMUNITY_EVENTS_NOT_ATTENDING_EVENT_MESSAGE');
} else {
$RSVPmessage = JText::_('COM_COMMUNITY_EVENTS_NOT_RESPOND_RSVP_MESSAGE');
}
}
// Output to template
echo $tmpl->setMetaTags('event', $event)->set('status', $status)->set('streamHTML', $streamHTML)->set('timezone', CTimeHelper::getTimezone($event->offset))->set('handler', $handler)->set('likesHTML', $likesHTML)->set('inviteHTML', $inviteHTML)->set('guestStatus', $event->getUserStatus($my->id))->set('event', $event)->set('radioList', $radioList)->set('bookmarksHTML', $bookmarksHTML)->set('reportHTML', $reportHTML)->set('isEventGuest', $isEventGuest)->set('isMine', $isMine)->set('isAdmin', $isAdmin)->set('isCommunityAdmin', $isCommunityAdmin)->set('unapproved', $unapprovedCount)->set('waitingApproval', $waitingApproval)->set('wallContent', $wallContent)->set('eventMembers', $eventMembers)->set('eventMembersCount', $eventMembersCount)->set('editEvent', $editEvent)->set('my', $my)->set('memberStatus', $myStatus)->set('waitingRespond', $waitingRespond)->set('isInvited', $isInvited)->set('join', $join)->set('friendsCount', $friendsCount)->set('isPastEvent', $isPastEvent)->set('adminsList', $adminsList)->set('RSVPmessage', $RSVPmessage)->set('allday', $allday)->fetch('events.viewevent');
}