本文整理汇总了PHP中CRoute::_方法的典型用法代码示例。如果您正苦于以下问题:PHP CRoute::_方法的具体用法?PHP CRoute::_怎么用?PHP CRoute::_使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRoute
的用法示例。
在下文中一共展示了CRoute::_方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getMembersData
function getMembersData(&$params)
{
$model = CFactory::getModel('user');
$db = JFactory::getDBO();
$limit = $params->get('count', '5');
$query = 'SELECT ' . $db->quoteName('userid') . ' FROM ' . $db->quoteName('#__community_users') . ' AS a ' . ' INNER JOIN ' . $db->quoteName('#__users') . ' AS b ON a.' . $db->quoteName('userid') . '=b.' . $db->quoteName('id') . ' WHERE ' . $db->quoteName('thumb') . '!=' . $db->Quote('components/com_community/assets/default_thumb.jpg') . ' ' . ' AND ' . $db->quoteName('block') . '=' . $db->Quote(0) . ' ' . ' ORDER BY ' . $db->quoteName('points') . ' DESC ' . ' LIMIT ' . $limit;
$db->setQuery($query);
$row = $db->loadObjectList();
if ($db->getErrorNum()) {
JError::raiseError(500, $db->stderr());
}
$_members = array();
if (!empty($row)) {
foreach ($row as $data) {
$user = CFactory::getUser($data->userid);
$_obj = new stdClass();
$_obj->id = $data->userid;
$_obj->name = $user->getDisplayName();
$_obj->avatar = $user->getThumbAvatar();
$CUserPoints = new CUserPoints();
$_obj->karma = $CUserPoints->getPointsImage($user);
$_obj->userpoints = $user->_points;
$_obj->link = CRoute::_('index.php?option=com_community&view=profile&userid=' . $data->userid);
$_members[] = $_obj;
}
}
return $_members;
}
示例2: _getMutualFriendsHTML
public static function _getMutualFriendsHTML($userid = null)
{
$my = CFactory::getUser();
if ($my->id == $userid) {
return;
}
$friendsModel = CFactory::getModel('Friends');
$friends = $friendsModel->getFriends($userid, 'latest', false, 'mutual');
$html = "<ul class='joms-list--friend single-column'>";
if (sizeof($friends)) {
foreach ($friends as $friend) {
$html .= "<li class='joms-list__item'>";
$html .= "<div class='joms-list__avatar'>";
$html .= '<div class="joms-avatar ' . CUserHelper::onlineIndicator($friend) . '"><a href="' . CRoute::_('index.php?option=com_community&view=profile&userid=' . $friend->id) . '">';
$html .= '<img src="' . $friend->getThumbAvatar() . '" data-author="' . $friend->id . '" />';
$html .= "</a></div></div>";
$html .= "<div class='joms-list__body'>";
$html .= CFriendsHelper::getUserCog($friend->id, null, null, true);
$html .= CFriendsHelper::getUserFriendDropdown($friend->id);
$html .= '<a href="' . CRoute::_('index.php?option=com_community&view=profile&userid=' . $friend->id) . '">';
$html .= '<h4 class="joms-text--username">' . $friend->getDisplayName() . '</h4></a>';
$html .= '<span class="joms-text--title">' . JText::sprintf('COM_COMMUNITY_TOTAL_MUTUAL_FRIENDS', CFriendsHelper::getTotalMutualFriends($friend->id)) . '</span>';
$html .= "</div></li>";
}
$html .= "</ul>";
} else {
$html .= JText::_('COM_COMMUNITY_NO_MUTUAL_FRIENDS');
}
return $html;
}
示例3: display
function display($data = null)
{
$mainframe = JFactory::getApplication();
$config = CFactory::getConfig();
$document =& JFactory::getDocument();
$document->setTitle(JText::sprintf('CC FRONTPAGE TITLE', $config->get('sitename')));
$document->setLink(CRoute::_('index.php?option=com_community'));
$my = CFactory::getUser();
CFactory::load('libraries', 'activities');
CFactory::load('helpers', 'string');
$act = new CActivityStream();
$rows = $act->getFEED('', '', null, $mainframe->getCfg('feed_limit'));
if ($config->get('showactivitystream') == COMMUNITY_SHOW || $config->get('showactivitystream') == COMMUNITY_MEMBERS_ONLY && $my->id != 0) {
foreach ($rows->data as $row) {
if ($row->type != 'title') {
// load individual item creator class
$item = new JFeedItem();
// cannot escape the title. it's already formated. we should
// escape it during CActivityStream::add
//$item->title = CStringHelper::escape($row->title);
$item->title = $row->title;
$item->link = CRoute::_('index.php?option=com_community&view=profile&userid=' . $row->actor);
$item->description = "<img src=\"{$row->favicon}\" alt=\"\"/> " . $row->title;
$item->date = $row->createdDate;
$item->category = '';
//$row->category;
// Make sure url is absolute
$item->description = JString::str_ireplace('href="/', 'href="' . JURI::base(), $item->description);
// loads item info into rss array
$document->addItem($item);
}
}
}
}
示例4: onPromoteData
function onPromoteData($id)
{
$db = JFactory::getDBO();
$Itemid = JRequest::getInt('Itemid');
$jschk = $this->_chkextension();
if (!empty($jschk)) {
$query = "SELECT cf.id FROM #__community_fields as cf\n\t\t\t\t\t\t\t\tLEFT JOIN #__community_fields_values AS cfv ON cfv.field_id=cf.id\n\t\t\t\t\t\t\t\t\tWHERE cf.name like '%About me%' AND cfv.user_id=" . $id;
$db->setQuery($query);
$fieldid = $db->loadresult();
$query = "SELECT u.name AS title, cu.avatar AS image, cfv.value AS bodytext\n\t\t\t\t\t\t\t\t\tFROM #__users AS u\n\t\t\t\t\t\t\t\t\tLEFT JOIN #__community_users AS cu ON u.id=cu.userid\n\t\t\t\t\t\t\t\t\tLEFT JOIN #__community_fields_values AS cfv ON cu.userid=cfv.user_id\n\t\t\t\t\t\t\t\t\tLEFT JOIN #__community_fields AS cf ON cfv.field_id=cf.id\n\t\t\t\t\t\t\t\t\tWHERE cu.userid =" . $id;
if ($fieldid) {
$query .= " AND cfv.field_id=" . $fieldid;
}
$db->setQuery($query);
$previewdata = $db->loadObjectlist();
if (!$fieldid) {
$previewdata[0]->bodytext = '';
}
// Include Jomsocial core
$jspath = JPATH_ROOT . DS . 'components' . DS . 'com_community';
include_once $jspath . DS . 'libraries' . DS . 'core.php';
$previewdata[0]->url = JUri::root() . substr(CRoute::_('index.php?option=com_community&view=profile&userid=' . $id), strlen(JUri::base(true)) + 1);
if ($previewdata[0]->image == '') {
$previewdata[0]->image = 'components/com_community/assets/user-Male.png';
}
return $previewdata;
} else {
return '';
}
}
示例5: getProfileLink
public function getProfileLink($user_id, &$object, &$attribs = array())
{
$user = CFactory::getUser($user_id);
//parameters
$params = $this->params;
if (!$user || $params->get('view_individual_link', '1') == 0) {
return true;
}
JHTML::_('behavior.tooltip');
$name = $user->getDisplayName();
$url = CRoute::_('index.php?option=com_community&view=profile&userid=' . $user_id);
switch ($params->get('view_individual_link', '1')) {
case 2:
$avatar = $user->getThumbAvatar();
$text = '<img class="hasTip" src="' . $avatar . '" title="' . $name . '"/>';
break;
case 1:
default:
$text = JText::_('PLG_TRACKS_JOMSOCIAL_VIEW_USER_PROFILE');
break;
}
$attribs = array_merge($attribs, array('alt' => $user->get('username')));
$object->text = JHTML::link($url, $text, $attribs);
return true;
}
示例6: getRegistrationURL
public function getRegistrationURL()
{
$usersConfig = JComponentHelper::getParams('com_users');
if ($usersConfig->get('allowUserRegistration')) {
return CRoute::_('index.php?option=com_community&view=register');
}
}
示例7: getInboxLink
public function getInboxLink($text)
{
if (!$text) {
$text = JText::_('COM_KUNENA_PMS_INBOX');
}
return CKunenaLink::GetHrefLink(CRoute::_('index.php?option=com_community&view=inbox'), $text, '', 'follow');
}
示例8: getProfileURL
public function getProfileURL($userid, $task='', $xhtml = true) {
// Make sure that user profile exist.
if (!$userid || CFactory::getUser($userid) === null) {
return false;
}
return CRoute::_('index.php?option=com_community&view=profile&userid=' . (int) $userid, $xhtml);
}
示例9: getLink
/**
* Retrieves the profile link
*
* @since 5.0
* @access public
* @param string
* @return
*/
public function getLink()
{
if (!EB::jomsocial()->exists()) {
return parent::getLink();
}
$link = CRoute::_('index.php?option=com_community&view=profile&userid=' . $this->profile->id);
return $link;
}
示例10: eventLink
/**
* Create a link to a event page
*
* @param id integer ther user id
* @param route bool do we want to wrap it with Jroute func ?
*/
public static function eventLink($id, $route = true)
{
$url = 'index.php?option=com_community&view=events&task=viewevent&eventid=' . $id;
if ($route) {
$url = CRoute::_($url);
}
return $url;
}
示例11: getProfileURL
public function getProfileURL($userid, $task='', $xhtml = true)
{
if ($userid == 0) return false;
// Get CUser object
$user = CFactory::getUser($userid);
if($user === null) return false;
return CRoute::_('index.php?option=com_community&view=profile&userid='.$userid, $xhtml);
}
示例12: profile
/**
* Displays the viewing profile page.
*
* @access public
* @param array An associative array to display the fields
*/
public function profile(&$data)
{
$mainframe = JFactory::getApplication();
$friendsModel = CFactory::getModel('friends');
$showfriends = JRequest::getVar('showfriends', false);
$userid = JRequest::getVar('userid', '');
$user = CFactory::getUser($userid);
$linkUrl = CRoute::_('index.php?option=com_community&view=profile&userid=' . $user->id);
$document = JFactory::getDocument();
$document->setTitle(JText::sprintf('COM_COMMUNITY_USERS_FEED_TITLE', $user->getDisplayName()));
$document->setDescription(JText::sprintf('COM_COMMUNITY_USERS_FEED_DESCRIPTION', $user->getDisplayName(), $user->lastvisitDate));
$document->setLink($linkUrl);
include_once JPATH_COMPONENT . '/libraries/activities.php';
$act = new CActivityStream();
$friendIds = $friendsModel->getFriendIds($user->id);
$friendIds = $showfriends ? $friendIds : null;
$rows = $act->getFEED($user->id, $friendIds, null, $mainframe->getCfg('feed_limit'));
// add the avatar image
$rssImage = new JFeedImage();
$rssImage->url = $user->getThumbAvatar();
$rssImage->link = $linkUrl;
$rssImage->width = 64;
$rssImage->height = 64;
$document->image = $rssImage;
//CFactory::load( 'helpers' , 'string' );
//CFactory::load( 'helpers' , 'time' );
foreach ($rows->data as $row) {
if ($row->type != 'title') {
// Get activities link
$pattern = '/<a href=\\"(.*?)\\"/';
preg_match_all($pattern, $row->title, $matches);
// Use activity owner link when activity link is not available
if (!empty($matches[1][1])) {
$linkUrl = $matches[1][1];
} else {
if (!empty($matches[1][0])) {
$linkUrl = $matches[1][0];
}
}
// load individual item creator class
$item = new JFeedItem();
$item->title = $row->title;
$item->link = $linkUrl;
$item->description = "<img src=\"{$row->favicon}\" alt=\"\" /> " . $row->title;
$item->date = CTimeHelper::getDate($row->createdDateRaw)->toRFC822();
$item->category = '';
//$row->category;
$item->description = CString::str_ireplace('_QQQ_', '"', $item->description);
// Make sure url is absolute
$pattern = '/href="(.*?)index.php/';
$replace = 'href="' . JURI::base() . 'index.php';
$string = $item->description;
$item->description = preg_replace($pattern, $replace, $string);
// loads item info into rss array
$document->addItem($item);
}
}
}
示例13: getUserProfileUrl
function getUserProfileUrl($integration_option, $userid)
{
//$cominvitexHelper=new cominvitexHelper();
//$invitex_settings=$cominvitexHelper->getconfigData();
//$params=JComponentHelper::getParams('com_jlike');
//$integration_option=$invitex_settings['reg_direct'];
//$integration_option='JomSocial'
$link = '';
if ($integration_option == 'Joomla') {
//$itemid=jgiveFrontendHelper::getItemId('option=com_users');
$link = '';
} else {
if ($integration_option == 'Community Builder') {
$cbpath = JPATH_ROOT . DS . 'components' . DS . 'com_community';
if ($cbpath) {
//$itemid=$cominvitexHelper->getItemId('option=com_comprofiler');
$link = JUri::root() . substr(JRoute::_('index.php?option=com_comprofiler&task=userprofile&user=' . $userid . '&Itemid=' . $itemid), strlen(JUri::base(true)) + 1);
}
} else {
if ($integration_option == 'JomSocial') {
$jspath = JPATH_ROOT . DS . 'components' . DS . 'com_community';
if ($jspath) {
$link = '';
if (file_exists($jspath)) {
include_once $jspath . DS . 'libraries' . DS . 'core.php';
$link = JUri::root() . substr(CRoute::_('index.php?option=com_community&view=profile&userid=' . $userid), strlen(JUri::base(true)) + 1);
}
}
} else {
if ($integration_option == 'Jomwall') {
$awdpath = JPATH_ROOT . DS . 'components' . DS . 'com_awdwall';
if ($awdpath) {
if (!class_exists('AwdwallHelperUser')) {
require_once JPATH_SITE . DS . 'components' . DS . 'com_awdwall' . DS . 'helpers' . DS . 'user.php';
}
$awduser = new AwdwallHelperUser();
$Itemid = $awduser->getComItemId();
$link = JRoute::_('index.php?option=com_awdwall&view=awdwall&layout=mywall&wuid=' . $userid . '&Itemid=' . $Itemid);
}
} else {
if ($integration_option == 'EasySocial') {
$espath = JPATH_ROOT . DS . 'components' . DS . 'com_easysocial';
if ($espath) {
$link = '';
if (file_exists($espath)) {
require_once JPATH_ADMINISTRATOR . '/components/com_easysocial/includes/foundry.php';
$user = Foundry::user($userid);
$link = JRoute::_($user->getPermalink());
}
}
}
}
}
}
}
return $link;
}
示例14: add_stream
function add_stream($listing_id, $cids, $ctype = '')
{
include_once JPATH_BASE . DS . 'components' . DS . 'com_community' . DS . 'libraries' . DS . 'core.php';
// load language strings for this component so we get translated activity stream messages
$lang =& JFactory::getLanguage();
$lang->load('com_relate');
$sql = "SELECT id, title, catid FROM #__content WHERE id = '{$listing_id}'";
$this->_db->setQuery($sql);
$listing = $this->_db->loadObject();
$listing_title = $listing->title;
$listing_href = CRoute::_('index.php?option=com_content&view=article&catid=' . $listing->catid . '&id=' . $listing->id);
$listing_link = '<a href="' . $listing_href . '">' . $listing_title . '</a>';
if ($ctype != '') {
$content_type = $ctype;
$category_id = 1;
$is_listing = false;
} else {
$sql = "SELECT l.id, l.catid, l.title, c.title AS cat_title FROM #__categories c, #__content l " . "WHERE c.id = l.catid AND l.id IN (" . implode(",", $cids) . ")";
$this->_db->setQuery($sql);
$content = $this->_db->loadObjectList('id');
$is_listing = true;
}
foreach ($cids as $cid) {
if ($is_listing) {
$content_title = $content[$cid]->title;
$content_type = $content[$cid]->cat_title;
$category_id = $content[$cid]->catid;
$content_id = $content[$cid]->id;
$href = CRoute::_('index.php?option=com_content&view=article&catid=' . $category_id . '&id=' . $content_id);
$content_link = '<a href="' . $href . '">' . $content_title . '</a>';
$content_info = $content_link . ' (' . $content_type . ')';
} else {
$content_id = $cid;
$tab = '';
if ($content_type == "photo") {
$tab = '#bilder';
} else {
if ($content_type == "video") {
$tab = '#video';
}
}
$content_link = '<a href="' . $listing_href . $tab . '">' . JText::_("a {$content_type}") . '</a>';
$content_info = $content_link;
}
$act = new stdClass();
$act->cmd = 'wall.write';
$act->actor = JFactory::getUser()->id;
$act->target = 0;
$act->title = JText::sprintf('RELATION ADDED', $content_info, $listing_link);
$act->content = '';
$act->app = 'wall';
$act->cid = $content_id;
CFactory::load('libraries', 'activities');
CActivityStream::add($act);
}
}
示例15: friends
public function friends($data = null)
{
$mainframe = JFactory::getApplication();
$jinput = $mainframe->input;
$document = JFactory::getDocument();
$id = JRequest::getCmd('userid', 0);
$sorted = $jinput->get->get('sort', 'latest', 'STRING');
//JRequest::getVar( 'sort' , 'latest' , 'GET' );
$filter = JRequest::getWord('filter', 'all', 'GET');
$isMine = $id == $my->id && $my->id != 0;
$my = CFactory::getUser();
$id = $id == 0 ? $my->id : $id;
$user = CFactory::getUser($id);
$friends = CFactory::getModel('friends');
$blockModel = CFactory::getModel('block');
$document->setLink(CRoute::_('index.php?option=com_community'));
$rows = $friends->getFriends($id, $sorted, true, $filter);
// Hide submenu if we are viewing other's friends
if ($isMine) {
$document->setTitle(JText::_('COM_COMMUNITY_FRIENDS_MY_FRIENDS'));
} else {
$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'));
$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);
foreach ($resultRows as $row) {
if (!$row->isBlocked) {
// load individual item creator class
$item = new JFeedItem();
$item->title = strip_tags($row->name);
$item->link = CRoute::_('index.php?option=com_community&view=profile&userid=' . $row->id);
$item->description = '<img src="' . JURI::base() . $row->_thumb . '" alt="" /> ' . $row->_status;
$item->date = $row->lastvisitDate;
$item->category = '';
//$row->category;
$item->description = CString::str_ireplace('_QQQ_', '"', $item->description);
// Make sure url is absolute
$item->description = CString::str_ireplace('href="/', 'href="' . JURI::base(), $item->description);
// loads item info into rss array
$document->addItem($item);
}
}
}