本文整理汇总了PHP中SocialManager::get_friends方法的典型用法代码示例。如果您正苦于以下问题:PHP SocialManager::get_friends方法的具体用法?PHP SocialManager::get_friends怎么用?PHP SocialManager::get_friends使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SocialManager
的用法示例。
在下文中一共展示了SocialManager::get_friends方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
} else {
$Users[$friend['friend_user_id']] = array('user_id' => $friend['friend_user_id'], 'firstname' => $friend['firstName'], 'lastname' => $friend['lastName'], 'username' => $friend['username'], 'group_id' => null);
}
}
}
if (is_array($Users) && count($Users) > 0) {
foreach ($Users as $user) {
if ($user['group_id'] != $group_id) {
$nosessionUsersList[$user['user_id']] = api_get_person_name($user['firstname'], $user['lastname']);
}
}
}
$social_left_content = SocialManager::show_social_menu('invite_friends', $group_id);
$social_right_content = '<h2>' . Security::remove_XSS($group_info['name'], STUDENT, true) . '</h2>';
if (count($nosessionUsersList) == 0) {
$friends = SocialManager::get_friends(api_get_user_id());
if ($friends == 0) {
$social_right_content .= get_lang('YouNeedToHaveFriendsInYourSocialNetwork');
} else {
$social_right_content .= get_lang('YouAlreadyInviteAllYourContacts');
}
$social_right_content .= '<div>';
$social_right_content .= '<a href="search.php">' . get_lang('TryAndFindSomeFriends') . '</a>';
$social_right_content .= '</div>';
}
$form = new FormValidator('invitation', 'post', api_get_self() . '?id=' . $group_id);
$form->addHidden('form_sent', 1);
$form->addHidden('id', $group_id);
$group_members_element = $form->addElement('advmultiselect', 'invitation', get_lang('Friends'), $nosessionUsersList, 'style="width: 280px;"');
$form->addButtonSave(get_lang('InviteUsersToGroup'));
$social_right_content .= $form->returnForm();
示例2: listMyFriendsBlock
/**
* @param int $user_id
* @param $link_shared
* @param $show_full_profile
* @return string
*/
public static function listMyFriendsBlock($user_id, $link_shared, $show_full_profile)
{
//SOCIALGOODFRIEND , USER_RELATION_TYPE_FRIEND, USER_RELATION_TYPE_PARENT
$friends = SocialManager::get_friends($user_id, USER_RELATION_TYPE_FRIEND);
$number_of_images = 30;
$number_friends = count($friends);
$friendHtml = '';
if ($number_friends != 0) {
$friendHtml .= '<div class="list-group">';
$j = 1;
for ($k = 0; $k < $number_friends; $k++) {
if ($j > $number_of_images) {
break;
}
if (isset($friends[$k])) {
$friend = $friends[$k];
$name_user = api_get_person_name($friend['firstName'], $friend['lastName']);
$user_info_friend = api_get_user_info($friend['friend_user_id'], true);
if ($user_info_friend['user_is_online']) {
$statusIcon = Display::return_icon('statusonline.png', get_lang('Online'));
$status = 1;
} else {
$statusIcon = Display::return_icon('statusoffline.png', get_lang('Offline'));
$status = 0;
}
$friendAvatarMedium = UserManager::getUserPicture($friend['friend_user_id'], USER_IMAGE_SIZE_MEDIUM);
$friendAvatarSmall = UserManager::getUserPicture($friend['friend_user_id'], USER_IMAGE_SIZE_SMALL);
$friend_avatar = '<img src="' . $friendAvatarMedium . '" id="imgfriend_' . $friend['friend_user_id'] . '" title="' . $name_user . '" class="user-image"/>';
$showLinkToChat = api_is_global_chat_enabled() && $friend['friend_user_id'] != api_get_user_id();
if ($showLinkToChat) {
$friendHtml .= '<a onclick="javascript:chatWith(\'' . $friend['friend_user_id'] . '\', \'' . $name_user . '\', \'' . $status . '\',\'' . $friendAvatarSmall . '\')" href="javascript:void(0);" class="list-group-item">';
$friendHtml .= $friend_avatar . ' <span class="username">' . $name_user . '</span>';
$friendHtml .= '<span class="status">' . $statusIcon . '</span>';
} else {
$link_shared = empty($link_shared) ? '' : '&' . $link_shared;
$friendHtml .= '<a href="profile.php?' . 'u=' . $friend['friend_user_id'] . $link_shared . '" class="list-group-item">';
$friendHtml .= $friend_avatar . ' <span class="username-all">' . $name_user . '</span>';
}
$friendHtml .= '</a>';
}
$j++;
}
$friendHtml .= '</div>';
} else {
$friendHtml .= '<div class="help">' . get_lang('NoFriendsInYourContactList') . ' ' . '<a href="' . api_get_path(WEB_PATH) . 'whoisonline.php"><em class="fa fa-search"></em> ' . get_lang('TryAndFindSomeFriends') . '</a></div>';
}
return $friendHtml;
}
示例3: array
$language_file = array('registration', 'messages', 'userInfo', 'admin');
$cidReset = true;
require_once '../inc/global.inc.php';
api_block_anonymous_users();
if (api_get_setting('allow_social_tool') != 'true') {
api_not_allowed();
}
$views = array('friends', 'mygroups');
$user_id = intval($_GET['user_id']);
if (isset($_GET['view']) && in_array($_GET['view'], $views)) {
// show all friends by user_id
if ($_GET['view'] == 'friends') {
echo '<div style="margin-top:20px;">';
$list_path_friends = $list_path_normal_friends = $list_path_parents = array();
//SOCIALGOODFRIEND , USER_RELATION_TYPE_FRIEND, SOCIALPARENT
$friends = SocialManager::get_friends($user_id, USER_RELATION_TYPE_FRIEND);
$number_friends = count($friends);
$friend_html = '';
$friend_html .= '<div><h3>' . get_lang('SocialFriend') . '</h3></div>';
$friend_html .= '<div id="friend-container" class="social-friend-container">';
$friend_html .= '<div id="friend-header" >';
if ($number_friends == 1) {
$friend_html .= '<div style="float:left;width:80%">' . $number_friends . ' ' . get_lang('Friend') . '</div>';
} else {
$friend_html .= '<div style="float:left;width:80%">' . $number_friends . ' ' . get_lang('Friends') . '</div>';
}
$friend_html .= '</div>';
// close div friend-header
for ($k = 0; $k < $number_friends; $k++) {
if (isset($friends[$k])) {
$friend = $friends[$k];
示例4: api_get_user_id
if (isset($_POST['delete_friend_id'])) {
SocialManager::remove_user_rel_user($my_delete_friend);
}
break;
case 'show_my_friends':
if (api_is_anonymous()) {
echo '';
break;
}
$user_id = api_get_user_id();
$name_search = Security::remove_XSS($_POST['search_name_q']);
$number_friends = 0;
if (isset($name_search) && $name_search != 'undefined') {
$friends = SocialManager::get_friends($user_id, null, $name_search);
} else {
$friends = SocialManager::get_friends($user_id);
}
$friend_html = '';
$number_of_images = 8;
$number_friends = count($friends);
if ($number_friends != 0) {
$number_loop = $number_friends / $number_of_images;
$loop_friends = ceil($number_loop);
$j = 0;
$friend_html .= '<ul class="thumbnails">';
for ($k = 0; $k < $loop_friends; $k++) {
if ($j == $number_of_images) {
$number_of_images = $number_of_images * 2;
}
while ($j < $number_of_images) {
if (isset($friends[$j])) {
示例5: listMyFriends
function listMyFriends($user_id, $link_shared, $show_full_profile)
{
//SOCIALGOODFRIEND , USER_RELATION_TYPE_FRIEND, USER_RELATION_TYPE_PARENT
$friends = SocialManager::get_friends($user_id, USER_RELATION_TYPE_FRIEND);
$friendHtml = '';
$number_of_images = 30;
$number_friends = 0;
$number_friends = count($friends);
$friendHtml = '<div class="nav-list"><h3>'.get_lang('SocialFriend').'<span>(' . $number_friends . ')</span></h3></div>';
if ($number_friends != 0) {
if ($number_friends > $number_of_images) {
if (api_get_user_id() == $user_id) {
$friendHtml.= ' : <span><a href="friends.php">'.get_lang('SeeAll').'</a></span>';
} else {
$friendHtml.= ' : <span>'
.'<a href="'.api_get_path(WEB_CODE_PATH).'social/profile_friends_and_groups.inc.php'
.'?view=friends&height=390&width=610&user_id='.$user_id.'"'
.'class="thickbox" title="'.get_lang('SeeAll').'" >'.get_lang('SeeAll').'</a></span>';
}
}
$friendHtml.= '<ul class="nav nav-list">';
$j = 1;
for ($k=0; $k < $number_friends; $k++) {
if ($j > $number_of_images) break;
if (isset($friends[$k])) {
$friend = $friends[$k];
$name_user = api_get_person_name($friend['firstName'], $friend['lastName']);
$user_info_friend = api_get_user_info($friend['friend_user_id'], true);
if ($user_info_friend['user_is_online']) {
$statusIcon = Display::span('', array('class' => 'online_user_in_text'));
} else {
$statusIcon = Display::span('', array('class' => 'offline_user_in_text'));
}
$friendHtml.= '<li class="">';
// the height = 92 must be the sqme in the image_friend_network span style in default.css
$friends_profile = SocialManager::get_picture_user($friend['friend_user_id'], $friend['image'], 20, USER_IMAGE_SIZE_SMALL);
$friendHtml.= '<img src="'.$friends_profile['file'].'" id="imgfriend_'.$friend['friend_user_id'].'" title="'.$name_user.'"/>';
$link_shared = (empty($link_shared)) ? '' : '&'.$link_shared;
$friendHtml.= $statusIcon .'<a href="profile.php?' .'u=' . $friend['friend_user_id'] . $link_shared . '">' . $name_user .'</a>';
$friendHtml.= '</li>';
}
$j++;
}
$friendHtml.='</ul>';
} else {
$friendHtml.= '<div class="">'.get_lang('NoFriendsInYourContactList').'<br />'
.'<a class="btn" href="'.api_get_path(WEB_PATH).'whoisonline.php">'. get_lang('TryAndFindSomeFriends').'</a></div>';
}
return $friendHtml;
}