本文整理汇总了PHP中CFriendsHelper::getUserFriendDropdown方法的典型用法代码示例。如果您正苦于以下问题:PHP CFriendsHelper::getUserFriendDropdown方法的具体用法?PHP CFriendsHelper::getUserFriendDropdown怎么用?PHP CFriendsHelper::getUserFriendDropdown使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CFriendsHelper
的用法示例。
在下文中一共展示了CFriendsHelper::getUserFriendDropdown方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _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;
}
示例2:
<div class="joms-list__body">
<a href="<?php
echo $user->profileLink;
?>
"><h4 class="joms-text--username"><?php
echo $user->getDisplayName();
?>
</h4></a>
<span class="joms-text--title"><?php
echo JText::sprintf('COM_COMMUNITY_TOTAL_MUTUAL_FRIENDS', CFriendsHelper::getTotalMutualFriends($user->id));
?>
</span>
</div>
<div class="joms-list__actions">
<?php
echo CFriendsHelper::getUserCog($user->id, null, null, true);
?>
<?php
echo CFriendsHelper::getUserFriendDropdown($user->id);
?>
</div>
</li>
<?php
}
?>
</ul>
</div>
<?php
}
示例3: ajaxApproveRequest
/**
* Ajax function to approve a friend request
**/
public function ajaxApproveRequest($requestId)
{
$filter = JFilterInput::getInstance();
$my = CFactory::getUser();
$friendsModel = CFactory::getModel('friends');
$requestId = $filter->clean($requestId, 'int');
$json = array();
if ($my->id == 0) {
return $this->ajaxBlockUnregister();
}
if ($friendsModel->isMyRequest($requestId, $my->id)) {
$connected = $friendsModel->approveRequest($requestId);
if ($connected) {
$act = new stdClass();
$act->cmd = 'friends.request.approve';
$act->actor = $connected[0];
$act->target = $connected[1];
$act->title = '';
//JText::_('COM_COMMUNITY_ACTIVITY_FRIENDS_NOW');
$act->content = '';
$act->app = 'friends.connect';
$act->cid = 0;
//add user points - give points to both parties
//CFactory::load( 'libraries' , 'userpoints' );
if (CUserPoints::assignPoint('friends.request.approve')) {
CActivityStream::add($act);
}
$friendId = $connected[0] == $my->id ? $connected[1] : $connected[0];
$friend = CFactory::getUser($friendId);
$friendUrl = CRoute::_('index.php?option=com_community&view=profile&userid=' . $friendId);
CUserPoints::assignPoint('friends.request.approve', $friendId);
// need to both user's friend list
$friendsModel->updateFriendCount($my->id);
$friendsModel->updateFriendCount($friendId);
$params = new CParameter('');
$params->set('url', 'index.php?option=com_community&view=profile&userid=' . $my->id);
$params->set('friend', $my->getDisplayName());
$params->set('friend_url', 'index.php?option=com_community&view=profile&userid=' . $my->id);
CNotificationLibrary::add('friends_create_connection', $my->id, $friend->id, JText::_('COM_COMMUNITY_FRIEND_REQUEST_APPROVED'), '', 'friends.approve', $params);
$json['success'] = true;
$json['message'] = JText::sprintf('COM_COMMUNITY_FRIEND_REQUEST_ACCEPTED', $friend->getDisplayName(), $friendUrl);
$json['display'] = CFriendsHelper::getUserFriendDropdown($friendId);
//trigger for onFriendApprove
$eventObject = new stdClass();
$eventObject->profileOwnerId = $my->id;
$eventObject->friendId = $friendId;
$this->triggerFriendEvents('onFriendApprove', $eventObject);
unset($eventObject);
}
} else {
$json['error'] = JText::_('COM_COMMUNITY_FRIENDS_NOT_YOUR_REQUEST');
}
$this->cacheClean(array(COMMUNITY_CACHE_TAG_ACTIVITIES));
die(json_encode($json));
}