本文整理汇总了PHP中get_user_friends函数的典型用法代码示例。如果您正苦于以下问题:PHP get_user_friends函数的具体用法?PHP get_user_friends怎么用?PHP get_user_friends使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_user_friends函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: chat_friends
/**
* List friends' chats that user is member of.
*
* @param int $user_guid GUID of the user
* @return array
*/
function chat_friends($user_guid)
{
$user = get_user($user_guid);
if (!$user) {
forward('chat/all');
}
$params = array();
$params['filter_context'] = 'friends';
$params['title'] = elgg_echo('chat:title:friends');
$crumbs_title = $user->name;
elgg_push_breadcrumb($crumbs_title, "chat/owner/{$user->username}");
elgg_push_breadcrumb(elgg_echo('friends'));
elgg_register_title_button();
$options = array('type' => 'object', 'subtype' => 'chat', 'relationship' => 'member', 'relationship_guid' => $user_guid, 'inverse_relationship' => false, 'limit' => 10, 'pagination' => true, 'full_view' => false);
if ($friends = get_user_friends($user_guid, ELGG_ENTITIES_ANY_VALUE, 0)) {
foreach ($friends as $friend) {
$options['container_guids'][] = $friend->getGUID();
}
$params['content'] = elgg_list_entities_from_relationship($options);
}
if (empty($params['content'])) {
$params['content'] = elgg_echo('chat:none');
}
return $params;
}
示例2: podcasts_get_page_content_friends
/**
* Get page components to list of the user's friends' podcasts.
*
* @param int $user_guid
*
* @return array
*/
function podcasts_get_page_content_friends($user_guid)
{
$user = get_user($user_guid);
if (!$user) {
forward('podcast/all');
}
$return = array();
$return['filter_context'] = 'friends';
$return['title'] = elgg_echo('podcasts:title:friends');
$crumbs_title = $user->name;
elgg_push_breadcrumb($crumbs_title, "podcast/owner/{$user->username}");
elgg_push_breadcrumb(elgg_echo('friends'));
elgg_register_title_button();
set_input('show_podcast_container', 1);
if (!($friends = get_user_friends($user_guid, ELGG_ENTITIES_ANY_VALUE, 0))) {
$return['content'] .= elgg_echo('friends:none:you');
return $return;
} else {
$options = array('type' => 'object', 'subtype' => 'podcast', 'full_view' => FALSE, 'podcast_list_class' => 'elgg-list-podcast-episodes', 'podcast_item_class' => 'elgg-podcast-episode');
foreach ($friends as $friend) {
$options['container_guids'][] = $friend->getGUID();
}
$return['content'] = elgg_list_entities($options, 'elgg_get_entities_from_metadata', 'podcasts_list');
}
return $return;
}
示例3: get_input
$subtype = get_input('subtype');
if (!($objecttype = get_input('object'))) {
$objecttype = "";
}
if (!($md_type = get_input('tagtype'))) {
$md_type = "";
}
$owner_guid = get_input('owner_guid', 0);
if (substr_count($owner_guid, ',')) {
$owner_guid_array = explode(",", $owner_guid);
} else {
$owner_guid_array = $owner_guid;
}
$friends = (int) get_input('friends', 0);
if ($friends > 0) {
if ($friends = get_user_friends($friends, '', 9999)) {
$owner_guid_array = array();
foreach ($friends as $friend) {
$owner_guid_array[] = $friend->guid;
}
} else {
$owner_guid = -1;
}
}
// Set up submenus
if ($object_types = get_registered_entity_types()) {
foreach ($object_types as $object_type => $subtype_array) {
if (is_array($subtype_array) && sizeof($subtype_array)) {
foreach ($subtype_array as $object_subtype) {
$label = 'item:' . $object_type;
if (!empty($object_subtype)) {
示例4: get_filetype_cloud
/**
* Returns a list of filetypes to search specifically on
*
* @param int|array $owner_guid The GUID(s) of the owner(s) of the files
* @param true|false $friends Whether we're looking at the owner or the owner's friends
* @return string The typecloud
*/
function get_filetype_cloud($owner_guid = "", $friends = false)
{
if ($friends) {
if ($friendslist = get_user_friends($user_guid, $subtype, 999999, 0)) {
$friendguids = array();
foreach ($friendslist as $friend) {
$friendguids[] = $friend->getGUID();
}
}
$friendofguid = $owner_guid;
$owner_guid = $friendguids;
} else {
$friendofguid = false;
}
return elgg_view('file/typecloud', array('owner_guid' => $owner_guid, 'friend_guid' => $friendofguid, 'types' => get_tags(0, 10, 'simpletype', 'object', 'file', $owner_guid)));
}
示例5: getFriends
/**
* Retrieves a list of this user's friends
*
* @param string $subtype Optionally, the subtype of user to filter to (leave blank for all)
* @param int $limit The number of users to retrieve
* @param int $offset Indexing offset, if any
* @return array|false Array of ElggUsers, or false, depending on success
*/
function getFriends($subtype = "", $limit = 10, $offset = 0)
{
return get_user_friends($this->getGUID(), $subtype, $limit, $offset);
}
示例6: get_user_services
$service_list = get_user_services($user_id);
// 获取顾客服务记录
$addr_list = get_addr_list($user_id);
// 顾客地址列表
$contact_list = get_contact_list($user_id);
// 顾客联系方式列表
$user_info = get_user_info($user_id);
// 获取顾客基本资料
$mem = new Memcache();
$mem->connect('127.0.0.1', 11211);
if (!$mem->get("freeze_{$_SESSION['admin_id']}")) {
$contact_list = get_contact_list($user_id);
// 顾客联系方式列表
}
//$return_list = get_return_list($user_id); // 获取顾客的退货记录
$user_friends = get_user_friends($user_id);
//$case = get_before_case(); //既往病例
//获取家长成员
if ($user_info['family_id'] != 0) {
$sql_select = 'SELECT u.user_id,u.user_name,u.mobile_phone,u.home_phone,g.grade_name,g.grade_id,f.family_name,m.input_time,m.real_parent FROM ' . $GLOBALS['ecs']->table('user_family_member') . ' AS m LEFT JOIN ' . $GLOBALS['ecs']->table('users') . ' AS u ON u.user_id=m.user_id LEFT JOIN ' . $GLOBALS['ecs']->table('user_family_grade') . ' AS g ON m.grade_id=g.grade_id LEFT JOIN ' . $GLOBALS['ecs']->table('user_family') . ' AS f ON u.family_id=f.family_id ' . 'WHERE m.family_id=' . $user_info['family_id'] . ' AND m.status=0 AND g.type=0';
$family_users = $GLOBALS['db']->getAll($sql_select);
$family = array('family_name' => $family_users[0]['family_name'], 'family_total' => count($family_users));
$smarty->assign('family', $family);
for ($i = 0; $i < count($family_users); $i++) {
//$sql_select = 'SELECT COUNT(*) FROM '.$GLOBALS['ecs']->table('other_examination_test').
// " WHERE user_id={$family_users[$i]['user_id']}";
//$family_users[$i]['healthy_file'] = $GLOBALS['db']->getOne($sql_select);
$family_users[$i]['input_time'] = date('Y-m-d', $family_users[$i]['input_time']);
}
$smarty->assign('family_users', $family_users);
}
示例7: polls_get_page_list
function polls_get_page_list($page_type, $container_guid = NULL)
{
global $autofeed;
$autofeed = TRUE;
$user = elgg_get_logged_in_user_entity();
$params = array();
$options = array('type' => 'object', 'subtype' => 'poll', 'full_view' => FALSE, 'limit' => 15);
if ($page_type == 'group') {
$group = get_entity($container_guid);
if (!elgg_instanceof($group, 'group') || !polls_activated_for_group($group)) {
forward();
}
$params['title'] = elgg_echo('polls:group_polls:listing:title', array(htmlspecialchars($group->name)));
$params['filter'] = "";
// set breadcrumb
elgg_push_breadcrumb(elgg_echo("gvgroups:" . $group->grouptype . "groups"), "groups/" . $group->grouptype);
elgg_push_breadcrumb($group->name, "polls/group/" . $group->guid);
elgg_push_context('groups');
elgg_set_page_owner_guid($container_guid);
group_gatekeeper();
$options['container_guid'] = $container_guid;
$user_guid = elgg_get_logged_in_user_guid();
if (elgg_get_page_owner_entity()->canWriteToContainer($user_guid)) {
elgg_register_menu_item('title', array('name' => 'add', 'href' => "polls/add/" . $container_guid, 'text' => elgg_echo('polls:add'), 'class' => 'elgg-button elgg-button-action'));
}
} else {
switch ($page_type) {
case 'owner':
$options['owner_guid'] = $container_guid;
$container_entity = get_user($container_guid);
elgg_push_breadcrumb(elgg_echo("menu:home"), "dashboard");
elgg_push_breadcrumb($container_entity->name, "polls/owner/" . $container_entity->username);
if ($user->guid == $container_guid) {
$params['title'] = elgg_echo('polls:your');
$params['filter_context'] = 'mine';
} else {
$params['title'] = elgg_echo('polls:not_me', array(htmlspecialchars($container_entity->name)));
$params['filter_context'] = "";
}
break;
case 'friends':
$container_entity = get_user($container_guid);
$friends = get_user_friends($container_guid, ELGG_ENTITIES_ANY_VALUE, 0);
$options['container_guids'] = array();
foreach ($friends as $friend) {
$options['container_guids'][] = $friend->getGUID();
}
$params['filter_context'] = 'friends';
$params['title'] = elgg_echo('polls:friends');
elgg_push_breadcrumb(elgg_echo("menu:home"), "dashboard");
elgg_push_breadcrumb($container_entity->name, "polls/owner/" . $container_entity->username);
elgg_push_breadcrumb(elgg_echo('friends'));
break;
case 'all':
elgg_push_breadcrumb(elgg_echo("menu:home"), "dashboard");
elgg_push_breadcrumb(elgg_echo("polls"));
$params['filter_context'] = 'all';
$params['title'] = elgg_echo('item:object:poll');
break;
}
$polls_site_access = elgg_get_plugin_setting('site_access', 'polls');
if (elgg_is_logged_in() && $polls_site_access != 'admins' || elgg_is_admin_logged_in()) {
elgg_register_menu_item('title', array('name' => 'add', 'href' => "polls/add", 'text' => elgg_echo('polls:add'), 'class' => 'elgg-button elgg-button-action'));
}
}
if ($page_type == 'friends' && count($options['container_guids']) == 0) {
// this person has no friends
$params['content'] = '';
} else {
$params['content'] = elgg_list_entities($options);
}
if (!$params['content']) {
$params['content'] = elgg_echo('polls:none');
}
$params['sidebar'] = elgg_view('polls/sidebar', array('page' => $page_type));
$body = elgg_view_layout("content", $params);
return elgg_view_page($params['title'], $body);
}
示例8: count_user_friends_objects
/**
* Counts the number of objects owned by a user's friends
*
* @param int $user_guid The GUID of the user to get the friends of
* @param string $subtype Optionally, the subtype of objects
* @param int $timelower The earliest time the entity can have been created. Default: all
* @param int $timeupper The latest time the entity can have been created. Default: all
*
* @return int The number of objects
*/
function count_user_friends_objects($user_guid, $subtype = ELGG_ENTITIES_ANY_VALUE, $timelower = 0, $timeupper = 0)
{
if ($friends = get_user_friends($user_guid, "", 999999, 0)) {
$friendguids = array();
foreach ($friends as $friend) {
$friendguids[] = $friend->getGUID();
}
return elgg_get_entities(array('type' => 'object', 'subtype' => $subtype, 'owner_guids' => $friendguids, 'count' => TRUE, 'container_guids' => $friendguids, 'created_time_lower' => $timelower, 'created_time_upper' => $timeupper));
}
return 0;
}
示例9: elgg_echo
<div class="elgg-module elgg-module-info mobilehide">
<div class="elgg-head">
<h3>
<?php
echo elgg_echo('notifications:subscriptions:title');
?>
</h3>
</div>
<p>
<?php
echo elgg_echo('notifications:subscriptions:description');
?>
</p>
<?php
// Get friends and subscriptions
$friends = get_user_friends($user->guid, '', 9999, 0);
global $NOTIFICATION_HANDLERS;
foreach ($NOTIFICATION_HANDLERS as $method => $foo) {
$subsbig[$method] = elgg_get_entities_from_relationship(array('relationship' => 'notify' . $method, 'relationship_guid' => $user->guid, 'type' => 'user', 'limit' => false));
}
$subs = array();
foreach ($subsbig as $method => $big) {
if (is_array($subsbig[$method]) && sizeof($subsbig[$method])) {
foreach ($subsbig[$method] as $u) {
$subs[$method][] = $u->guid;
}
}
}
// Let the system know that the friends picker is in use
global $pickerinuse;
$pickerinuse = true;
示例10: gatekeeper
/**
* List all the albums of someone's friends
*
* @author Cash Costello
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU General Public License v2
*/
gatekeeper();
$owner = elgg_get_page_owner_entity();
elgg_push_breadcrumb(elgg_echo('photos'), 'photos/siteimagesall');
elgg_push_breadcrumb(elgg_echo('tidypics:albums'), 'photos/all');
elgg_push_breadcrumb($owner->name, "photos/friends/{$owner->username}");
elgg_push_breadcrumb(elgg_echo('friends'));
$title = elgg_echo('album:friends');
$offset = (int) get_input('offset', 0);
$limit = (int) get_input('limit', 16);
if ($friends = get_user_friends($owner->guid, "", false, 0)) {
$friendguids = array();
foreach ($friends as $friend) {
$friendguids[] = $friend->getGUID();
}
$result = elgg_list_entities(array('type' => 'object', 'subtype' => 'album', 'owner_guids' => $friendguids, 'limit' => $limit, 'offset' => $offset, 'full_view' => false, 'pagination' => true, 'list_type' => 'gallery', 'list_type_toggle' => false, 'gallery_class' => 'tidypics-gallery'));
if (!empty($result)) {
$area2 = $result;
} else {
$area2 = elgg_echo("tidypics:none");
}
} else {
$area2 = elgg_echo("friends:none:you");
}
$logged_in_guid = elgg_get_logged_in_user_guid();
elgg_register_menu_item('title', array('name' => 'addphotos', 'href' => "ajax/view/photos/selectalbum/?owner_guid=" . $logged_in_guid, 'text' => elgg_echo("photos:addphotos"), 'link_class' => 'elgg-button elgg-button-action elgg-lightbox'));
示例11: gatekeeper
<?php
/**
* Elgg add a collection of friends
*
* @package Elgg.Core
* @subpackage Social.Collections
*/
// You need to be logged in for this one
gatekeeper();
$title = elgg_echo('friends:collections:add');
$content = elgg_view_title($title);
$content .= elgg_view_form('friends/collections/add', array(), array('friends' => get_user_friends(elgg_get_logged_in_user_guid(), "", 9999)));
$body = elgg_view_layout('one_sidebar', array('content' => $content));
echo elgg_view_page(elgg_echo('friends:collections:add'), $body);
示例12: get_input
*
* Elgg-markdown_wiki friend's markdown_wiki page
**/
$offset = (int) get_input('offset', 0);
$timelower = (int) get_input('timelower', 0);
$timeupper = (int) get_input('timeupper', 0);
$owner = elgg_get_logged_in_user_entity();
if (!$owner) {
forward('markdown_wiki/all');
}
elgg_push_breadcrumb($owner->name, "markdown_wiki/owner/{$owner->username}");
elgg_push_breadcrumb(elgg_echo('friends'));
$title = elgg_echo('markdown_wiki:friends');
//$content = list_user_friends_objects($owner->guid, 'markdown_wiki', 10, false);
/* list_user_friends_objects check for friend object with strange config with container_guid.
* We have to rewrite it
*/
if ($friends = get_user_friends($owner->guid, "", 999999, 0)) {
$friendguids = array();
foreach ($friends as $friend) {
$friendguids[] = $friend->getGUID();
}
$content = elgg_list_entities_from_annotations(array('type' => 'object', 'subtype' => 'markdown_wiki', 'annotation_owner_guids' => $friendguids, 'full_view' => false, 'limit' => '20', 'offset' => $offset, 'created_time_lower' => $timelower, 'created_time_upper' => $timeupper));
}
if (!$content) {
$content = elgg_echo('markdown_wiki:none');
}
$sidebar = elgg_view('markdown_wiki/sidebar/sidebar');
$params = array('filter_context' => 'friends', 'content' => $content, 'title' => $title, 'sidebar' => $sidebar);
$body = elgg_view_layout('content', $params);
echo elgg_view_page($title, $body);
示例13: elgg_push_breadcrumb
} else {
elgg_push_breadcrumb(elgg_echo('all'));
}
// title
if (!$owner) {
// world files
$title = elgg_echo('all') . ' ' . elgg_echo("file:type:{$file_type}");
} else {
$friend_string = $friends ? elgg_echo('file:title:friends') : '';
$type_string = elgg_echo("file:type:{$file_type}");
$title = elgg_echo('file:list:title', array($owner->name, $friend_string, $type_string));
}
$sidebar = file_get_type_cloud($page_owner_guid, $friends);
if ($friends) {
// elgg_does not support getting objects that belong to an entity's friends
$friend_entities = get_user_friends($page_owner_guid, "", 999999, 0);
if ($friend_entities) {
$friend_guids = array();
foreach ($friend_entities as $friend) {
$friend_guids[] = $friend->getGUID();
}
}
$page_owner_guid = $friend_guids;
}
$limit = 10;
if ($listtype == "gallery") {
$limit = 12;
}
$params = array('types' => 'object', 'subtypes' => 'file', 'container_guid' => $page_owner_guid, 'limit' => $limit, 'full_view' => false);
if ($file_type) {
$params['metadata_name'] = $md_type;
示例14: tasks_get_json
function tasks_get_json($options)
{
$entities_options = array('type' => 'object', 'subtype' => 'task_top', 'limit' => false, 'metadata_name_value_pairs_operator' => 'OR', 'joins' => array(), 'wheres' => array(), 'order_by_metadata' => array("name" => 'start_date', "direction" => 'ASC', "as" => "text"));
$oEntity = get_entity($options['owner']);
if (elgg_instanceof($oEntity, 'group')) {
$entities_options['container_guid'] = $options['owner'];
} elseif ($options["owner"] && $options['filter'] == 'mine') {
$entities_options['owner_guid'] = $options['owner'];
$entities_options['container_guid'] = $options['owner'];
} elseif ($options["owner"] && $options['filter'] == 'friends') {
$friends = get_user_friends($options["owner"], "", 999999, 0);
$friendguids = array();
foreach ($friends as $friend) {
$friendguids[] = $friend->getGUID();
}
$entities_options['owner_guid'] = $friendguids;
}
if (!empty($options['start_date'])) {
$entities_options['metadata_name_value_pairs'][] = array('name' => 'start_date', 'value' => $options['start_date'], 'operand' => '>=');
}
if (!empty($options['end_date'])) {
$entities_options['metadata_name_value_pairs'][] = array('name' => 'end_date', 'value' => $options['end_date'], 'operand' => '<=');
}
$tasks = elgg_get_entities_from_metadata($entities_options);
$result = array();
foreach ($tasks as $task) {
$oname = $task->getOwnerEntity()->name;
$mine = $task->getOwnerGUID() == elgg_get_logged_in_user_entity()->guid;
$friend = $task->getOwnerEntity()->isFriendsWith(elgg_get_logged_in_user_entity()->guid);
$group = elgg_instanceof($task->getContainerEntity(), 'group');
$tag_string = '';
if (is_array($task->tags)) {
$tags = array();
foreach ($task->tags as $tag) {
if (is_string($tag)) {
$tags[] = $tag;
} else {
$tags[] = $tag->value;
}
}
$tag_string = implode(", ", $tags);
}
$result[] = array("id" => $task->guid, "container_guid" => $task->getContainerGUID(), "parent_guid" => $task->parent_guid, 'title' => $task->title, 'start' => $task->start_date, 'end' => $task->end_date, 'description' => $task->description, 'task_type' => $task->task_type, 'status' => $task->status, 'assigned_to' => $task->assigned_to, 'percent_done' => $task->percent_done, 'work_remaining' => $task->work_remaining, 'tags' => $tag_string, 'access_id' => $task->access_id, 'write_access_id' => $task->write_access_id, "oname" => $oname, "color" => $group ? 'DarkSlateBlue' : ($friend ? 'HotPink' : ($mine ? 'DarkGreen' : '')), "url" => elgg_get_site_url() . 'tasks/view/' . $task->guid, "editable" => $task->canEdit() ? 'true' : 'false');
}
die(json_encode($result));
}
示例15: define
<?php
/**
* @package Elgg
* @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
* @author Roger Curry, Grid Research Centre [curry@cpsc.ucalgary.ca]
* @author Tingxi Tan, Grid Research Centre [txtan@cpsc.ucalgary.ca]
* @link http://grc.ucalgary.ca/
*/
define('everyonepublication', 'true');
require_once dirname(dirname(dirname(__FILE__))) . "/engine/start.php";
$page_owner = page_owner_entity();
if ($page_owner === false || is_null($page_owner)) {
$page_owner = $_SESSION['user'];
set_page_owner($_SESSION['guid']);
}
if (!$page_owner instanceof ElggEntity) {
forward();
}
if ($page_owner == $_SESSION['user']) {
$area2 = elgg_view_title(elgg_echo('publication:friendsselect'));
} else {
$area2 = elgg_view_title($page_owner->username . "'s " . elgg_echo('publication:friends'));
}
$area2 .= '<div class="contentWrapper">';
$friends = get_user_friends($_SESSION['user']->guid, 'user', 9999);
$area2 .= elgg_view('publication/friends_list', array('friends' => $friends, 'baseurl' => $_SERVER['REQUEST_URI']));
$area3 = elgg_view('publication/search');
$body = elgg_view_layout("two_column_left_sidebar", '', $area1 . $area2, $area3);
page_draw(elgg_echo('publication:friends'), $body);