本文整理汇总了PHP中CRoute::getURI方法的典型用法代码示例。如果您正苦于以下问题:PHP CRoute::getURI方法的具体用法?PHP CRoute::getURI怎么用?PHP CRoute::getURI使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRoute
的用法示例。
在下文中一共展示了CRoute::getURI方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: blockUnregister
public function blockUnregister()
{
$my = CFactory::getUser();
$config = CFactory::getConfig();
if ($my->id == 0) {
$config = CFactory::getConfig();
$uri = CRoute::getURI(false);
$uri = base64_encode($uri);
$tmpl = new CTemplate();
$fbHtml = '';
if ($config->get('fbconnectkey') && $config->get('fbconnectsecret')) {
CFactory::load('libraries', 'facebook');
$facebook = new CFacebook(FACEBOOK_LOGIN_NOT_REQUIRED);
$fbHtml = $facebook->getButtonHTML();
}
$tmpl->set('fbHtml', $fbHtml);
$tmpl->set('return', $uri);
$tmpl->set('config', $config);
$html = $tmpl->fetch('guests.denied');
echo $html;
return true;
}
return false;
}
示例2: _groupVideo
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');
}
}
示例3:
<div class="joms-textarea__loading"><img src="<?php
echo JURI::root(true);
?>
/components/com_community/assets/ajax-loader.gif" alt="loader" ></div>
<div class="joms-textarea joms-textarea__attachment">
<button onclick="joms.view.comment.removeAttachment(this);">×</button>
<div class="joms-textarea__attachment--loading"><img src="<?php
echo JURI::root(true);
?>
/components/com_community/assets/ajax-loader.gif" alt="loader"></div>
<div class="joms-textarea__attachment--thumbnail"><img src="#" alt="attachment"></div>
</div>
</div>
<svg viewBox="0 0 16 16" class="joms-icon joms-icon--add" onclick="joms.view.comment.addAttachment(this);">
<use xlink:href="<?php
echo $isAjax ? '' : CRoute::getURI();
?>
#joms-icon-camera"></use>
</svg>
<span><input class="joms-button--comment joms-button--small joms-js--btn-send" type="submit" value="<?php
echo JText::_('COM_COMMUNITY_SEND');
?>
"></span>
</div>
<script>
joms_wall_remove_func = '<?php
echo $ajaxRemoveFunc;
?>
';
</script>
示例4: album
//.........这里部分代码省略.........
$pagination = $model->getPagination();
$photo =& JTable::getInstance('Photo', 'CTable');
$photo->load($album->photoid);
if ($album->photoid == '0') {
$album->thumbnail = $photo->getThumbURI();
} else {
$album->thumbnail = $photo->getImageURI();
}
// Increment album's hit each time this page is loaded.
$album->hit();
$otherAlbums = $model->_getOnlyAlbums($user->id, PHOTOS_USER_TYPE, 0, 20);
$totalAlbums = count($otherAlbums);
$showOtherAlbum = 6;
$randomAlbum = array();
if (count($otherAlbums) > 0) {
$randomId = $totalAlbums < $showOtherAlbum ? array_rand($otherAlbums, $totalAlbums) : array_rand($otherAlbums, $showOtherAlbum);
$count = 0;
for ($i = 0; $i < $totalAlbums; $i++) {
$num = is_array($randomId) ? $randomId[$i] : $randomId;
if ($otherAlbums[$num]->id != $album->id) {
$count++;
$randomAlbum[] = $otherAlbums[$num];
}
if (count($randomAlbum) == $showOtherAlbum - 1) {
break;
}
}
}
$js = 'assets/gallery';
$js .= $config->getBool('usepackedjavascript') ? '.pack.js' : '.js';
CAssets::attach($js, 'js');
CFactory::load('helpers', 'string');
$document->setTitle(JText::sprintf('COM_COMMUNITY_PHOTOS_USER_PHOTOS_TITLE', $handler->getCreatorName()) . ' - ' . $album->name);
$this->setTitle($album->name);
$handler->setAlbumPathway(CStringHelper::escape($album->name));
$handler->setRSSHeader($albumId);
// Set album thumbnail and description for social bookmarking sites linking
$document->addHeadLink($album->getCoverThumbURI(), 'image_src', 'rel');
$document->setDescription(CStringHelper::escape($album->getDescription()));
CFactory::load('libraries', 'phototagging');
$tagging = new CPhotoTagging();
$people = array();
$maxTime = $album->created;
// Need to append the absolute path for the captions
for ($i = 0; $i < count($photos); $i++) {
$item =& JTable::getInstance('Photo', 'CTable');
$item->bind($photos[$i]);
$photos[$i] = $item;
$photo =& $photos[$i];
$photo->link = $handler->getPhotoURI($photo->id, $photo->albumid);
$tags = $tagging->getTaggedList($photo->id);
//Get last update
$maxTime = $photo->created > $maxTime ? $photo->created : $maxTime;
// Get the people in the tags
foreach ($tags as $tag) {
$people[] = $tag->userid;
}
}
//Update lastUpdated
$maxTime = new JDate($maxTime);
$album->lastUpdated = CActivityStream::_createdLapse($maxTime, false);
$people = array_unique($people);
foreach ($people as &$person) {
$person = CFactory::getUser($person);
}
CFactory::load('libraries', 'bookmarks');
$bookmarks = new CBookmarks($handler->getAlbumExternalURI($album->id));
// Get the walls
CFactory::load('libraries', 'wall');
$wallContent = CWallLibrary::getWallContents('albums', $album->id, COwnerHelper::isCommunityAdmin() || $my->id == $album->creator && $my->id != 0, 10, 0);
$wallCount = CWallLibrary::getWallCount('albums', $album->id);
$viewAllLink = false;
if (JRequest::getVar('task', '', 'REQUEST') != 'app') {
$viewAllLink = CRoute::_('index.php?option=com_community&view=photos&task=app&albumid=' . $album->id . '&app=walls');
}
$wallContent .= CWallLibrary::getViewAllLinkHTML($viewAllLink, $wallCount);
$wallForm = CWallLibrary::getWallInputForm($album->id, 'photos,ajaxAlbumSaveWall', 'photos,ajaxAlbumRemoveWall', $viewAllLink);
$redirectUrl = CRoute::getURI(false);
// Add tagging code
// $tagsHTML = '';
// if($config->get('tags_photos')){
// CFactory::load('libraries', 'tags');
// $tags = new CTags();
// $tagsHTML = $tags->getHTML('albums', $album->id, $handler->isAlbumOwner( $album->id ) );
// }
$this->showSubmenu();
$tmpl = new CTemplate();
if ($album->location != "") {
CFactory::load('libraries', 'mapping');
$zoomableMap = CMapping::drawZoomableMap($album->location, 220, 150);
} else {
$zoomableMap = "";
}
// Get the likes / dislikes item
CFactory::load('libraries', 'like');
$like = new CLike();
$likesHTML = $like->getHTML('album', $album->id, $my->id);
$owner = CFactory::getUser($album->creator);
echo $tmpl->set('likesHTML', $likesHTML)->set('photosmapdefault', $photoMapsDefault)->set('my', $my)->set('bookmarksHTML', $bookmarks->getHTML())->set('isOwner', $handler->isAlbumOwner($album->id))->set('isAdmin', COwnerHelper::isCommunityAdmin())->set('owner', $owner)->set('photos', $photos)->set('people', $people)->set('album', $album)->set('otherAlbums', $randomAlbum)->set('likesHTML', $likesHTML)->set('wallForm', $wallForm)->set('wallContent', $wallContent)->set('zoomableMap', $zoomableMap)->set('pagination', $pagination)->fetch('photos.album');
}
示例5: video
/**
* 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(), '');
//.........这里部分代码省略.........
示例6: album
//.........这里部分代码省略.........
$album->thumbnail = $photo->getThumbURI();
} else {
$album->thumbnail = $photo->getImageURI();
}
// Increment album's hit each time this page is loaded.
$album->hit();
if ($groupId > 0) {
$otherAlbums = $model->getGroupAlbums($groupId);
} else {
$otherAlbums = $model->getAlbums($user->id);
}
$totalAlbums = count($otherAlbums);
$showOtherAlbum = 6;
$randomAlbum = array();
if (count($otherAlbums) > 0) {
$randomId = $totalAlbums < $showOtherAlbum ? array_rand($otherAlbums, $totalAlbums) : array_rand($otherAlbums, $showOtherAlbum);
$count = 0;
for ($i = 0; $i < $totalAlbums; $i++) {
$num = is_array($randomId) ? $randomId[$i] : $randomId;
if ($otherAlbums[$num]->id != $album->id) {
$count++;
$randomAlbum[] = $otherAlbums[$num];
}
if (count($randomAlbum) == $showOtherAlbum - 1) {
break;
}
}
}
/* set head meta */
if (strtolower(trim(JText::sprintf('COM_COMMUNITY_PHOTOS_USER_PHOTOS_TITLE', $handler->getCreatorName()))) == strtolower(trim($album->name))) {
/**
* Opengraph
*/
CHeadHelper::setType('website', JText::sprintf('COM_COMMUNITY_PHOTOS_USER_PHOTOS_TITLE', $handler->getCreatorName()), CStringHelper::escape($album->getDescription()));
} else {
/**
* Opengraph
*/
CHeadHelper::setType('website', JText::sprintf('COM_COMMUNITY_PHOTOS_USER_PHOTOS_TITLE', $handler->getCreatorName()) . ' - ' . $album->name, CStringHelper::escape($album->getDescription()));
}
$this->setTitle($album->name);
$handler->setAlbumPathway(CStringHelper::escape($album->name));
$handler->setRSSHeader($albumId);
// Set album thumbnail and description for social bookmarking sites linking
$document->addHeadLink($album->getCoverThumbURI(), 'image_src', 'rel');
//$document->setDescription( CStringHelper::escape($album->getDescription()) );
//CFactory::load( 'libraries' , 'phototagging' );
$getTaggingUsers = new CPhotoTagging();
$people = array();
// @TODO temporary fix for undefined link
$list = array();
foreach ($photos as $photo) {
$photo->link = $handler->getPhotoURI($photo->id, $photo->albumid);
CHeadHelper::addOpengraph('og:image', JUri::root(true) . '/' . $photo->image, true);
$list[] = $photo;
}
$photos = $list;
$albumParam = new Cparameter($album->params);
$tagged = $albumParam->get('tagged');
if (!empty($tagged)) {
$people = explode(',', $albumParam->get('tagged'));
}
//Update lastUpdated
$lastUpdated = new JDate($album->lastupdated);
$album->lastUpdated = CActivityStream::_createdLapse($lastUpdated, false);
$people = array_unique($people);
CFactory::loadUsers($people);
foreach ($people as &$person) {
$person = CFactory::getUser($person);
}
//CFactory::load( 'libraries' , 'bookmarks' );
$bookmarks = new CBookmarks($handler->getAlbumExternalURI($album->id));
// Get wall data.
$wallCount = CWallLibrary::getWallCount('albums', $album->id);
$viewAllLink = false;
if ($jinput->request->get('task', '') != 'app') {
$viewAllLink = CRoute::_('index.php?option=com_community&view=photos&task=app&albumid=' . $album->id . '&app=walls');
}
$wallContent = CWallLibrary::getWallContents('albums', $album->id, COwnerHelper::isCommunityAdmin() || $my->id == $album->creator && $my->id != 0, $config->get('stream_default_comments'), 0, 'wall/content', 'photos,album');
$wallForm = CWallLibrary::getWallInputForm($album->id, 'photos,ajaxAlbumSaveWall', 'photos,ajaxAlbumRemoveWall', $viewAllLink);
$viewAllLink = CRoute::_('index.php?option=com_community&view=photos&task=app&albumid=' . $album->id . '&app=walls');
$wallViewAll = '';
if ($wallCount > $config->get('stream_default_comments')) {
$wallViewAll = CWallLibrary::getViewAllLinkHTML($viewAllLink, $wallCount);
}
$redirectUrl = CRoute::getURI(false);
$tmpl = new CTemplate();
if ($album->location != "") {
$zoomableMap = CMapping::drawZoomableMap($album->location, 220, 150);
} else {
$zoomableMap = "";
}
// Get the likes / dislikes item
//CFactory::load( 'libraries' , 'like' );
$like = new CLike();
$likeCount = $like->getLikeCount('album', $album->id);
$likeLiked = $like->userLiked('album', $album->id, $my->id) === COMMUNITY_LIKE;
$owner = CFactory::getUser($album->creator);
echo $tmpl->set('photosmapdefault', $photoMapsDefault)->set('my', $my)->set('bookmarksHTML', $bookmarks->getHTML())->set('isOwner', $handler->isAlbumOwner($album->id))->set('isAdmin', COwnerHelper::isCommunityAdmin())->set('owner', $owner)->set('photos', $photos)->set('people', $people)->set('album', $album)->set('groupId', $groupId)->set('otherAlbums', $randomAlbum)->set('likeCount', $likeCount)->set('likeLiked', $likeLiked)->set('wallContent', $wallContent)->set('wallForm', $wallForm)->set('wallCount', $wallCount)->set('wallViewAll', $wallViewAll)->set('zoomableMap', $zoomableMap)->set('pagination', $pagination)->set('photoId', $defaultId)->set('submenu', $this->showSubmenu(false))->fetch('photos/list');
}
示例7: browse
public function browse($data = null)
{
//require_once (JPATH_COMPONENT . '/libraries/template.php');
$mainframe = JFactory::getApplication();
$jinput = $mainframe->input;
$document = JFactory::getDocument();
$this->addPathway(JText::_('COM_COMMUNITY_GROUPS_MEMBERS'), '');
/**
* Opengraph
*/
CHeadHelper::setType('website', JText::_('COM_COMMUNITY_GROUPS_MEMBERS'));
$my = CFactory::getUser();
$view = CFactory::getView('search');
$searchModel = CFactory::getModel('search');
$userModel = CFactory::getModel('user');
$avatar = CFactory::getModel('avatar');
$friends = CFactory::getModel('friends');
$tmpl = new CTemplate();
$sorted = $jinput->get->get('sort', 'latest', 'STRING');
//JRequest::getVar( 'sort' , 'latest' , 'GET' );
$filter = JRequest::getWord('filter', 'all', 'GET');
$profiletype = $jinput->get('profiletype', 0, 'INT');
$rows = $searchModel->getPeople($sorted, $filter, $profiletype);
$sortItems = array('online' => JText::_('COM_COMMUNITY_SORT_ONLINE'), 'latest' => JText::_('COM_COMMUNITY_SORT_LATEST'), 'alphabetical' => JText::_('COM_COMMUNITY_SORT_ALPHABETICAL'));
$filterItems = array();
$config = CFactory::getConfig();
if ($config->get('alphabetfiltering')) {
$filterItems = array('all' => JText::_('COM_COMMUNITY_JUMP_ALL'), 'abc' => JText::_('COM_COMMUNITY_JUMP_ABC'), 'def' => JText::_('COM_COMMUNITY_JUMP_DEF'), 'ghi' => JText::_('COM_COMMUNITY_JUMP_GHI'), 'jkl' => JText::_('COM_COMMUNITY_JUMP_JKL'), 'mno' => JText::_('COM_COMMUNITY_JUMP_MNO'), 'pqr' => JText::_('COM_COMMUNITY_JUMP_PQR'), 'stu' => JText::_('COM_COMMUNITY_JUMP_STU'), 'vwx' => JText::_('COM_COMMUNITY_JUMP_VWX'), 'yz' => JText::_('COM_COMMUNITY_JUMP_YZ'), 'others' => JText::_('COM_COMMUNITY_JUMP_OTHERS'));
}
$html = '';
$totalUser = $userModel->getMembersCount();
$resultRows = array();
$alreadyfriend = array();
// No need to pre-load multiple users at once since $searchModel->getPeople
// already did
for ($i = 0; $i < count($rows); $i++) {
$row = $rows[$i];
$obj = clone $row;
$user = CFactory::getUser($row->id);
$obj->friendsCount = $user->getFriendCount();
$obj->user = $user;
$obj->profileLink = CUrl::build('profile', '', array('userid' => $row->id));
$isFriend = CFriendsHelper::isConnected($row->id, $my->id);
$connection = $friends->getFriendConnection($my->id, $row->id);
$obj->isMyFriend = false;
if (!empty($connection)) {
if ($connection[0]->connect_from == $my->id) {
$obj->isMyFriend = true;
}
}
$obj->addFriend = !$isFriend && $my->id != $row->id ? true : false;
if ($obj->addFriend) {
$alreadyfriend[$row->id] = $row->id;
}
$resultRows[] = $obj;
}
$featuredList = $this->_cachedCall('getFeaturedMember', array(), '', array(COMMUNITY_CACHE_TAG_FEATURED));
$config = CFactory::getConfig();
if ($config->get('alphabetfiltering')) {
$sortingsHTML = CFilterBar::getHTML(CRoute::getURI(), $sortItems, 'latest');
$alphabetHTML = CFilterBar::getHTML(CRoute::getURI(), '', '', $filterItems, 'all');
} else {
$sortingsHTML = CFilterBar::getHTML(CRoute::getURI(), $sortItems, 'latest');
}
$multiprofileArr = array();
$hasMultiprofile = false;
//let see if we have any multiprofile enabled
if ($config->get('profile_multiprofile')) {
$hasMultiprofile = true;
//lets get the available profile
$profileModel = CFactory::getModel('Profile');
$profiles = $profileModel->getProfileTypes();
if ($profiles) {
$multiprofileArr[] = array('url' => CRoute::_('index.php?option=com_community&view=search&task=browse&filter=' . $filter . '&sort=' . $sorted), 'name' => JText::_('COM_COMMUNITY_ALL_PROFILE'), 'selected' => !$profiletype ? 1 : 0);
foreach ($profiles as $profile) {
$multiprofileArr[] = array('url' => CRoute::_('index.php?option=com_community&view=search&task=browse&filter=' . $filter . '&sort=' . $sorted . '&profiletype=' . $profile->id), 'name' => $profile->name, 'selected' => $profile->id == $profiletype ? 1 : 0);
}
}
}
echo $tmpl->set('featuredList', $featuredList)->set('hasMultiprofile', $hasMultiprofile)->set('multiprofileArr', $multiprofileArr)->set('alreadyfriend', $alreadyfriend)->set('isCommunityAdmin', COwnerHelper::isCommunityAdmin())->set('data', $resultRows)->set('sortings', $sortingsHTML)->set('alphabet', $alphabetHTML)->set('my', $my)->set('submenu', $this->showSubmenu(false))->set('totalUser', $totalUser)->set('showFeaturedList', $config->get('show_featured'))->set('pagination', $searchModel->getPagination())->fetch('people.browse');
}
示例8: video
/**
* 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()));
//.........这里部分代码省略.........
示例9: myinvites
function myinvites()
{
$mainframe =& JFactory::getApplication();
$userId = JRequest::getVar('userid', '');
// Load required filterbar library that will be used to display the filtering and sorting.
CFactory::load('libraries', 'filterbar');
$document =& JFactory::getDocument();
$this->addPathway(JText::_('CC GROUPS'), CRoute::_('index.php?option=com_community&view=groups'));
$this->addPathway(JText::_('CC GROUP PENDING INVITATIONS'), '');
$document->setTitle(JText::_('CC GROUP PENDING INVITATIONS'));
$this->showSubmenu();
$feedLink = CRoute::_('index.php?option=com_community&view=groups&task=mygroups&userid=' . $userId . '&format=feed');
$feed = '<link rel="alternate" type="application/rss+xml" title="' . JText::_('CC SUBSCRIBE TO PENDING INVITATIONS FEED') . '" href="' . $feedLink . '"/>';
$mainframe->addCustomHeadTag($feed);
$my = CFactory::getUser();
$model = CFactory::getModel('groups');
$discussionModel = CFactory::getModel('discussions');
$sorted = JRequest::getVar('sort', 'latest', 'GET');
$rows = $model->getGroupInvites($my->id);
$pagination = $model->getPagination(count($rows));
$groups = array();
$ids = '';
if ($rows) {
foreach ($rows as $row) {
$table =& JTable::getInstance('Group', 'CTable');
$table->load($row->groupid);
$groups[] = $table;
$ids = empty($ids) ? $table->id : $ids . ',' . $table->id;
}
}
$sortItems = array('latest' => JText::_('CC GROUP SORT LATEST'), 'alphabetical' => JText::_('CC SORT ALPHABETICAL'), 'mostdiscussed' => JText::_('CC GROUP SORT MOST DISCUSSED'), 'mostwall' => JText::_('CC GROUP SORT MOST WALL POST'), 'mostmembers' => JText::_('CC GROUP SORT MOST MEMBERS'), 'mostactive' => JText::_('CC GROUP SORT MOST ACTIVE'));
$tmpl = new CTemplate();
$tmpl->set('groups', $groups);
$tmpl->set('pagination', $pagination);
$tmpl->set('count', $pagination->total);
$tmpl->set('my', $my);
$tmpl->set('sortings', CFilterBar::getHTML(CRoute::getURI(), $sortItems, 'latest'));
//echo $tmpl->fetch('groups.mygroups');
echo $tmpl->fetch('groups.myinvites');
}
示例10: linkVideo
/**
* Display Upload video form for user
* */
public function linkVideo()
{
if (!$this->accessAllowed('registered')) {
echo JText::_('COM_COMMUNITY_MEMBERS_AREA');
return;
}
$mainframe = JFactory::getApplication();
$jinput = $mainframe->input;
$document = JFactory::getDocument();
$config = CFactory::getConfig();
$my = CFactory::getUser();
$videoModel = CFactory::getModel('videos');
$pathway = $mainframe->getPathway();
$pathway->addItem(JText::_($my->getDisplayName()), CRoute::_('index.php?option=com_community&view=profile&userid=' . $my->id));
$pathway->addItem(JText::_('COM_COMMUNITY_VIDEOS_EDIT_PROFILE_VIDEO'), '');
// Load the toolbar
//$this->showSubmenu();
/**
* Opengraph
*/
CHeadHelper::setType('website', JText::_('COM_COMMUNITY_VIDEOS_EDIT_PROFILE_VIDEO'));
$video = $this->_getCurrentProfileVideo();
$filters = array('creator' => $my->id, 'status' => 'ready', 'sorting' => $jinput->get('sort', 'latest', 'STRING'));
$videos = $videoModel->getVideos($filters, true);
$sortItems = array('latest' => JText::_('COM_COMMUNITY_VIDEOS_SORT_LATEST'), 'mostwalls' => JText::_('COM_COMMUNITY_VIDEOS_SORT_MOST_WALL_POST'), 'mostviews' => JText::_('COM_COMMUNITY_VIDEOS_SORT_POPULAR'), 'title' => JText::_('COM_COMMUNITY_VIDEOS_SORT_TITLE'));
// Pagination
$pagination = $videoModel->getPagination();
$redirectUrl = CRoute::getURI(false);
$tmpl = new CTemplate();
echo $tmpl->set('my', $my)->set('video', $video)->set('sort', $jinput->get('sort', 'latest', 'STRING'))->set('videos', $videos)->set('sortings', CFilterBar::getHTML(CRoute::getURI(), $sortItems, 'latest'))->set('pagination', $pagination)->set('videoThumbWidth', CVideoLibrary::thumbSize('width'))->set('videoThumbHeight', CVideoLibrary::thumbSize('height'))->set('redirectUrl', $redirectUrl)->set('submenu', $this->showSubmenu(false))->fetch('profile.linkvideo');
}
示例11: blockUnregister
public function blockUnregister($uri = null)
{
$my = CFactory::getUser();
$config = CFactory::getConfig();
$usersConfig = JComponentHelper::getParams('com_users');
if ($my->id == 0) {
$config = CFactory::getConfig();
if (empty($uri)) {
$uri = CRoute::getURI(false);
}
$uri = base64_encode($uri);
$tmpl = new CTemplate();
$fbHtml = '';
if ($config->get('fbconnectkey') && $config->get('fbconnectsecret') && !$config->get('usejfbc')) {
$facebook = new CFacebook();
$fbHtml = $facebook->getLoginHTML();
}
if ($config->get('usejfbc')) {
if (class_exists('JFBCFactory')) {
$providers = JFBCFactory::getAllProviders();
$fbHtml = '';
foreach ($providers as $p) {
$fbHtml .= $p->loginButton();
}
}
}
//hero image
$heroImage = JURI::root() . 'components/com_community/assets/frontpage-image-default.jpg';
if (file_exists(COMMUNITY_PATH_ASSETS . 'frontpage-image.jpg')) {
$heroImage = JURI::root() . 'components/com_community/assets/frontpage-image.jpg';
} else {
if (file_exists(COMMUNITY_PATH_ASSETS . 'frontpage-image.png')) {
$heroImage = JURI::root() . 'components/com_community/assets/frontpage-image.png';
}
}
$themeModel = CFactory::getModel('theme');
$settings = $themeModel->getSettings();
$tmpl->set('settings', $settings);
$tmpl->set('heroImage', $heroImage);
$tmpl->set('fbHtml', $fbHtml);
$tmpl->set('return', $uri);
$tmpl->set('allowUserRegister', $usersConfig->get('allowUserRegistration'));
$tmpl->set('useractivation', $usersConfig->get('useractivation'));
$html = $tmpl->fetch('guests.denied');
echo $html;
return true;
}
return false;
}
示例12: friends
/**
* DIsplay list of friends
*
* if no $_GET['id'] is set, we're viewing our own friends
*/
public function friends($data = null)
{
// Load window library
CFactory::load('libraries', 'window');
// Load required filterbar library that will be used to display the filtering and sorting.
CFactory::load('libraries', 'filterbar');
// Load necessary window css / javascript headers.
CWindow::load();
$mainframe =& JFactory::getApplication();
$document = JFactory::getDocument();
$my = CFactory::getUser();
$id = JRequest::getInt('userid', null);
if ($id == null) {
$id = $my->id;
}
// Display mini header if user is viewing other user's friend
if ($id != $my->id) {
$this->attachMiniHeaderUser($id);
}
$feedLink = CRoute::_('index.php?option=com_community&view=friends&format=feed');
$feed = '<link rel="alternate" type="application/rss+xml" title="' . JText::_('COM_COMMUNITY_SUBSCRIBE_TO_FRIENDS_FEEDS') . '" href="' . $feedLink . '"/>';
$document->addCustomTag($feed);
$friendsModel = CFactory::getModel('friends');
$user = CFactory::getUser($id);
$params = $user->getParams();
CFactory::load('helpers', 'friends');
$people = CFactory::getModel('search');
$userModel = CFactory::getModel('user');
$avatar = CFactory::getModel('avatar');
$friends = CFactory::getModel('friends');
$sorted = JRequest::getVar('sort', 'latest', 'GET');
$filter = JRequest::getWord('filter', 'all', 'GET');
CFactory::load('helpers', 'friends');
$rows = $friends->getFriends($id, $sorted, true, $filter);
$isMine = $id == $my->id && $my->id != 0;
$document = JFactory::getDocument();
$this->addPathway(JText::_('COM_COMMUNITY_FRIENDS'), CRoute::_('index.php?option=com_community&view=friends'));
if ($my->id == $id) {
$this->addPathway(JText::_('COM_COMMUNITY_FRIENDS_MY_FRIENDS'));
} else {
$this->addPathway(JText::sprintf('COM_COMMUNITY_FRIENDS_ALL_FRIENDS', $user->getDisplayName()));
}
// Hide submenu if we are viewing other's friends
if ($isMine) {
$this->showSubmenu();
$document->setTitle(JText::_('COM_COMMUNITY_FRIENDS_MY_FRIENDS'));
} else {
$this->addSubmenuItem('index.php?option=com_community&view=profile&userid=' . $user->id, JText::_('COM_COMMUNITY_PROFILE_BACK_TO_PROFILE'));
$this->addSubmenuItem('index.php?option=com_community&view=friends&userid=' . $user->id, JText::_('COM_COMMUNITY_FRIENDS_VIEW_ALL'));
$this->addSubmenuItem('index.php?option=com_community&view=friends&task=mutualFriends&userid=' . $user->id . '&filter=mutual', JText::_('COM_COMMUNITY_MUTUAL_FRIENDS'));
$tmpl = new CTemplate();
$tmpl->set('view', "friends");
$tmpl->set('url', CRoute::_('index.php?option=com_community&view=friends&task=viewfriends'));
$html = $tmpl->fetch('friendsearch.submenu');
$this->addSubmenuItem('index.php?option=com_community&view=friends&task=viewfriends', JText::_('COM_COMMUNITY_SEARCH_FRIENDS'), 'joms.videos.toggleSearchSubmenu(this)', SUBMENU_LEFT, $html);
parent::showSubmenu();
$document->setTitle(JText::sprintf('COM_COMMUNITY_FRIENDS_ALL_FRIENDS', $user->getDisplayName()));
}
$sortItems = array('latest' => JText::_('COM_COMMUNITY_SORT_RECENT_FRIENDS'), 'online' => JText::_('COM_COMMUNITY_ONLINE'), 'name' => JText::_('COM_COMMUNITY_SORT_ALPHABETICAL'));
$config = CFactory::getConfig();
$filterItems = array();
if ($config->get('alphabetfiltering')) {
$filterItems = array('all' => JText::_('COM_COMMUNITY_JUMP_ALL'), 'abc' => JText::_('COM_COMMUNITY_JUMP_ABC'), 'def' => JText::_('COM_COMMUNITY_JUMP_DEF'), 'ghi' => JText::_('COM_COMMUNITY_JUMP_GHI'), 'jkl' => JText::_('COM_COMMUNITY_JUMP_JKL'), 'mno' => JText::_('COM_COMMUNITY_JUMP_MNO'), 'pqr' => JText::_('COM_COMMUNITY_JUMP_PQR'), 'stu' => JText::_('COM_COMMUNITY_JUMP_STU'), 'vwx' => JText::_('COM_COMMUNITY_JUMP_VWX'), 'yz' => JText::_('COM_COMMUNITY_JUMP_YZ'), 'others' => JText::_('COM_COMMUNITY_JUMP_OTHERS'));
}
// Check if friend is banned
$blockModel = CFactory::getModel('block');
$resultRows = array();
// @todo: preload all friends
foreach ($rows as $row) {
$user = CFactory::getUser($row->id);
$obj = clone $row;
$obj->friendsCount = $user->getFriendCount();
$obj->profileLink = CUrlHelper::userLink($row->id);
$obj->isFriend = true;
$obj->isBlocked = $blockModel->getBlockStatus($user->id, $my->id);
$resultRows[] = $obj;
}
unset($rows);
// Should not show recently added filter to otehr people
$sortingHTML = '';
if ($isMine) {
$sortingHTML = CFilterBar::getHTML(CRoute::getURI(), $sortItems, 'latest', $filterItems, 'all');
}
$tmpl = new CTemplate();
$html = $tmpl->set('isMine', $isMine)->setRef('my', $my)->setRef('friends', $resultRows)->set('sortings', $sortingHTML)->set('config', CFactory::getConfig())->fetch('friends.list');
$html .= '<div class="pagination-container">';
$pagination = $friends->getPagination();
$html .= $pagination->getPagesLinks();
$html .= '</div>';
echo $html;
}
示例13: display
public function display()
{
$id = JRequest::getVar('listid', '');
$list =& JTable::getInstance('MemberList', 'CTable');
$list->load($id);
if (empty($list->id) || is_null($list->id)) {
echo JText::_('CC INVALID ID');
return;
}
$document =& JFactory::getDocument();
$document->setTitle($list->getTitle());
$tmpCriterias = $list->getCriterias();
$criterias = array();
foreach ($list->getCriterias() as $criteria) {
$obj = new stdClass();
$obj->field = $criteria->field;
$obj->condition = $criteria->condition;
$obj->fieldType = $criteria->type;
switch ($criteria->type) {
case 'date':
if ($criteria->condition == 'between') {
$date = explode(',', $criteria->value);
$startDate = explode('/', $date[0]);
$endDate = explode('/', $date[1]);
$obj->value = array($startDate[2] . '-' . intval($startDate[1]) . '-' . $startDate[0] . ' 00:00:00', $endDate[2] . '-' . intval($endDate[1]) . '-' . $endDate[0] . ' 23:59:59');
} else {
$startDate = explode('/', $criteria->value);
$obj->value = $startDate[2] . '-' . intval($startDate[1]) . '-' . $startDate[0] . ' 00:00:00';
}
break;
case 'checkbox':
default:
$obj->value = $criteria->value;
break;
}
$criterias[] = $obj;
}
CFactory::load('helpers', 'time');
$created = CTimeHelper::getDate($list->created);
CFactory::load('libraries', 'advancesearch');
CFactory::load('libraries', 'filterbar');
$sortItems = array('latest' => JText::_('CC SORT LATEST'), 'online' => JText::_('CC SORT ONLINE'), 'alphabetical' => JText::_('CC SORT ALPHABETICAL'));
$sorting = JRequest::getVar('sort', 'latest', 'GET');
$data = CAdvanceSearch::getResult($criterias, $list->condition, $list->avataronly, $sorting);
$tmpl = new CTemplate();
$tmpl->set('list', $list);
$tmpl->set('created', $created);
$tmpl->set('sorting', CFilterBar::getHTML(CRoute::getURI(), $sortItems, 'latest'));
$html = $tmpl->fetch('memberlist.result');
unset($tmpl);
CFactory::load('libraries', 'tooltip');
CFactory::load('helpers', 'owner');
CFactory::load('libraries', 'featured');
$featured = new CFeatured(FEATURED_USERS);
$featuredList = $featured->getItemIds();
$my = CFactory::getUser();
$resultRows = array();
$friendsModel = CFactory::getModel('friends');
CFactory::load('helpers', 'friends');
foreach ($data->result as $user) {
$obj = new stdClass();
$obj->user = $user;
$obj->friendsCount = $user->getFriendCount();
$obj->profileLink = CRoute::_('index.php?option=com_community&view=profile&userid=' . $user->id);
$isFriend = CFriendsHelper::isConnected($user->id, $my->id);
$obj->addFriend = !$isFriend && $my->id != 0 && $my->id != $user->id ? true : false;
$resultRows[] = $obj;
}
$tmpl = new CTemplate();
$tmpl->set('data', $resultRows);
$tmpl->set('sortings', '');
$tmpl->set('pagination', $data->pagination);
$tmpl->set('filter', '');
$tmpl->set('featuredList', $featuredList);
$tmpl->set('my', $my);
$tmpl->set('showFeaturedList', false);
$tmpl->set('isCommunityAdmin', COwnerHelper::isCommunityAdmin());
$html .= $tmpl->fetch('people.browse');
echo $html;
}
示例14: myinvites
public function myinvites()
{
$mainframe =& JFactory::getApplication();
$userId = JRequest::getVar('userid', '');
$config = CFactory::getConfig();
// Load required filterbar library that will be used to display the filtering and sorting.
CFactory::load('libraries', 'filterbar');
$document = JFactory::getDocument();
$this->addPathway(JText::_('COM_COMMUNITY_GROUPS'), CRoute::_('index.php?option=com_community&view=groups'));
$this->addPathway(JText::_('COM_COMMUNITY_GROUPS_PENDING_INVITES'), '');
$document->setTitle(JText::_('COM_COMMUNITY_GROUPS_PENDING_INVITES'));
$this->showSubmenu();
$feedLink = CRoute::_('index.php?option=com_community&view=groups&task=mygroups&userid=' . $userId . '&format=feed');
$feed = '<link rel="alternate" type="application/rss+xml" title="' . JText::_('COM_COMMUNITY_SUBSCRIBE_TO_PENDING_INVITATIONS_FEED') . '" href="' . $feedLink . '"/>';
$document->addCustomTag($feed);
$my = CFactory::getUser();
$model = CFactory::getModel('groups');
$discussionModel = CFactory::getModel('discussions');
$sorted = JRequest::getVar('sort', 'latest', 'GET');
$rows = $model->getGroupInvites($my->id);
$pagination = $model->getPagination(count($rows));
$groups = array();
$ids = '';
if ($rows) {
foreach ($rows as $row) {
$table =& JTable::getInstance('Group', 'CTable');
$table->load($row->groupid);
$table->description = CStringHelper::clean(CStringHelper::truncate($table->description, $config->get('tips_desc_length')));
$groups[] = $table;
$ids = empty($ids) ? $table->id : $ids . ',' . $table->id;
}
}
$sortItems = array('latest' => JText::_('COM_COMMUNITY_GROUPS_SORT_LATEST'), 'alphabetical' => JText::_('COM_COMMUNITY_SORT_ALPHABETICAL'), 'mostactive' => JText::_('COM_COMMUNITY_GROUPS_SORT_MOST_ACTIVE'));
$tmpl = new CTemplate();
echo $tmpl->set('groups', $groups)->set('pagination', $pagination)->set('count', $pagination->total)->set('my', $my)->set('sortings', CFilterBar::getHTML(CRoute::getURI(), $sortItems, 'latest'))->fetch('groups.myinvites');
}
示例15: friends
//.........这里部分代码省略.........
$mainframe = JFactory::getApplication();
$jinput = $mainframe->input;
$document = JFactory::getDocument();
$my = CFactory::getUser();
$userid = $jinput->get('userid', 0, 'INT');
$search = $jinput->get('search', false, 'STRING');
$searchQuery = $jinput->get('q', '', 'STRING');
$id = $userid ? $userid : $my->id;
// Display mini header if user is viewing other user's friend
if ($id != $my->id) {
$this->attachMiniHeaderUser($id);
}
$feedLink = CRoute::_('index.php?option=com_community&view=friends&format=feed');
$feed = '<link rel="alternate" type="application/rss+xml" title="' . JText::_('COM_COMMUNITY_SUBSCRIBE_TO_FRIENDS_FEEDS') . '" href="' . $feedLink . '"/>';
$document->addCustomTag($feed);
$user = CFactory::getUser($id);
$params = $user->getParams();
$people = CFactory::getModel('search');
$userModel = CFactory::getModel('user');
$avatar = CFactory::getModel('avatar');
$friends = CFactory::getModel('friends');
$sorted = $jinput->get->get('sort', 'latest', 'STRING');
$filter = JRequest::getWord('filter', 'all', 'GET');
if ($searchQuery == '') {
$rows = $friends->getFriends($id, $sorted, true, $filter);
} else {
$rows = $friends->getFriends($id, $sorted, true, 'friends', 0, $searchQuery);
}
$isMine = $id == $my->id && $my->id != 0;
$document = JFactory::getDocument();
$this->addPathway(JText::_('COM_COMMUNITY_FRIENDS'), CRoute::_('index.php?option=com_community&view=friends'));
if ($my->id == $id) {
$this->addPathway(JText::_('COM_COMMUNITY_FRIENDS_MY_FRIENDS'));
} else {
$this->addPathway(JText::sprintf('COM_COMMUNITY_FRIENDS_ALL_FRIENDS', $user->getDisplayName()));
}
$featured = new CFeatured(FEATURED_USERS);
$featuredList = $featured->getItemIds();
// Hide submenu if we are viewing other's friends
if ($isMine) {
$submenu = $this->showSubmenu(false);
/**
* Opengraph
*/
CHeadHelper::setType('website', JText::_('COM_COMMUNITY_FRIENDS_MY_FRIENDS'));
} else {
$this->addSubmenuItem('index.php?option=com_community&view=profile&userid=' . $user->id, JText::_('COM_COMMUNITY_PROFILE_BACK_TO_PROFILE'));
//$this->addSubmenuItem('index.php?option=com_community&view=friends&userid=' . $user->id, JText::_('COM_COMMUNITY_FRIENDS_VIEW_ALL'));
//$this->addSubmenuItem('index.php?option=com_community&view=friends&task=mutualFriends&userid=' . $user->id . '&filter=mutual', JText::_('COM_COMMUNITY_MUTUAL_FRIENDS'));
//$tmpl = new CTemplate();
//$tmpl->set('view', "friends");
//$tmpl->set('url', CRoute::_('index.php?option=com_community&view=friends&task=viewfriends'));
//$html = $tmpl->fetch('friendsearch.submenu');
//$this->addSubmenuItem('index.php?option=com_community&view=friends&task=viewfriends', JText::_('COM_COMMUNITY_SEARCH_FRIENDS'), 'joms.videos.toggleSearchSubmenu(this)', SUBMENU_LEFT, $html);
$submenu = parent::showSubmenu(false);
/**
* Opengraph
*/
CHeadHelper::setType('website', JText::sprintf('COM_COMMUNITY_FRIENDS_ALL_FRIENDS', $user->getDisplayName()));
}
$sortItems = array();
$config = CFactory::getConfig();
$filterItems = array();
if ($config->get('alphabetfiltering')) {
$filterItems = array('all' => JText::_('COM_COMMUNITY_JUMP_ALL'), 'abc' => JText::_('COM_COMMUNITY_JUMP_ABC'), 'def' => JText::_('COM_COMMUNITY_JUMP_DEF'), 'ghi' => JText::_('COM_COMMUNITY_JUMP_GHI'), 'jkl' => JText::_('COM_COMMUNITY_JUMP_JKL'), 'mno' => JText::_('COM_COMMUNITY_JUMP_MNO'), 'pqr' => JText::_('COM_COMMUNITY_JUMP_PQR'), 'stu' => JText::_('COM_COMMUNITY_JUMP_STU'), 'vwx' => JText::_('COM_COMMUNITY_JUMP_VWX'), 'yz' => JText::_('COM_COMMUNITY_JUMP_YZ'), 'others' => JText::_('COM_COMMUNITY_JUMP_OTHERS'));
}
// Check if friend is banned
$blockModel = CFactory::getModel('block');
$resultRows = array();
// @todo: preload all friends
foreach ($rows as $row) {
$user = CFactory::getUser($row->id);
$obj = clone $row;
$obj->friendsCount = $user->getFriendCount();
$obj->profileLink = CUrlHelper::userLink($row->id);
$obj->isFriend = true;
$obj->isBlocked = $blockModel->getBlockStatus($user->id, $my->id);
//display online friends only.
if ($onlineFriendsOnly && !$user->isOnline()) {
continue;
}
//if this is a search, only apply to those with subset of search name
if ($search) {
// if( trim($searchQuery) != '' && strpos(strtolower($user->getDisplayName()), strtolower($searchQuery)) === false){
// continue;
// }
}
$resultRows[] = $obj;
}
unset($rows);
// Should not show recently added filter to otehr people
$sortingHTML = '';
if ($isMine) {
$sortingHTML = CFilterBar::getHTML(CRoute::getURI(), $sortItems, 'latest', $filterItems, 'all');
}
$pagination = $friends->getPagination();
$tmpl = new CTemplate();
$html = $tmpl->set('isMine', $isMine)->set('userid', $userid)->setRef('my', $my)->set('search', $search)->set('searchQuery', $searchQuery)->setRef('friends', $resultRows)->set('sortings', $sortingHTML)->set('config', CFactory::getConfig())->set('submenu', $submenu)->set('featuredList', $featuredList)->set('pagination', $pagination)->fetch('friends/list');
echo $html;
}