本文整理汇总了PHP中elgg_list_entities_from_relationship函数的典型用法代码示例。如果您正苦于以下问题:PHP elgg_list_entities_from_relationship函数的具体用法?PHP elgg_list_entities_from_relationship怎么用?PHP elgg_list_entities_from_relationship使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了elgg_list_entities_from_relationship函数的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: show_friends_php
function show_friends_php($username, $limit = 10, $offset = 0)
{
if ($username) {
$user = get_user_by_username($username);
} else {
$user = elgg_get_logged_in_user_entity();
}
if (!$user) {
throw new InvalidParameterException(elgg_echo('registration:usernamenotvalid'));
}
$options = array('relationship' => 'friend', 'relationship_guid' => $user->guid, 'inverse_relationship' => false, 'type' => 'user', 'full_view' => false, 'no_results' => elgg_echo('friends:none'));
echo elgg_list_entities_from_relationship($options);
}
示例3: list_relatedgroups
function list_relatedgroups($group, $options = array())
{
if ($group instanceof ElggGroup) {
$defaults = array('full_view' => false, 'pagination' => true);
$options = array_merge($defaults, $options);
$options['relationship'] = 'related';
$options['relationship_guid'] = $group->guid;
elgg_push_context('relatedgroups');
$list = elgg_list_entities_from_relationship($options);
elgg_pop_context();
return $list;
} else {
return "";
}
}
示例4: list_entities_from_relationship
/**
* Returns a viewable list of entities by relationship
*
* @see elgg_view_entity_list
*
* @deprecated 1.8 Use elgg_list_entities_from_relationship()
*
* @param string $relationship The relationship eg "friends_of"
* @param int $relationship_guid The guid of the entity to use query
* @param bool $inverse_relationship Reverse the normal function of the query to instead say "give me all entities for whome $relationship_guid is a $relationship of"
* @param string $type The type of entity (eg 'object')
* @param string $subtype The entity subtype
* @param int $owner_guid The owner (default: all)
* @param int $limit The number of entities to display on a page
* @param true|false $fullview Whether or not to display the full view (default: true)
* @param true|false $viewtypetoggle Whether or not to allow gallery view
* @param true|false $pagination Whether to display pagination (default: true)
* @param bool $order_by SQL order by clause
* @return string The viewable list of entities
*/
function list_entities_from_relationship($relationship, $relationship_guid, $inverse_relationship = false, $type = ELGG_ENTITIES_ANY_VALUE, $subtype = ELGG_ENTITIES_ANY_VALUE, $owner_guid = 0, $limit = 10, $fullview = true, $listtypetoggle = false, $pagination = true, $order_by = '')
{
elgg_deprecated_notice("list_entities_from_relationship was deprecated by elgg_list_entities_from_relationship()!", 1.8);
return elgg_list_entities_from_relationship(array('relationship' => $relationship, 'relationship_guid' => $relationship_guid, 'inverse_relationship' => $inverse_relationship, 'type' => $type, 'subtype' => $subtype, 'owner_guid' => $owner_guid, 'order_by' => $order_by, 'limit' => $limit, 'full_view' => $fullview, 'list_type_toggle' => $listtypetoggle, 'pagination' => $pagination));
}
示例5: get_input
<?php
$guid = get_input('guid');
elgg_entity_gatekeeper($guid, 'group');
$group = get_entity($guid);
elgg_set_page_owner_guid($guid);
elgg_group_gatekeeper();
$title = elgg_echo('groups:members:title', array($group->name));
elgg_push_breadcrumb($group->name, $group->getURL());
elgg_push_breadcrumb(elgg_echo('groups:members'));
$db_prefix = elgg_get_config('dbprefix');
$content = elgg_list_entities_from_relationship(array('relationship' => 'member', 'relationship_guid' => $group->guid, 'inverse_relationship' => true, 'type' => 'user', 'limit' => (int) get_input('limit', max(20, elgg_get_config('default_limit')), false), 'joins' => array("JOIN {$db_prefix}users_entity u ON e.guid=u.guid"), 'order_by' => 'u.name ASC'));
$params = array('content' => $content, 'title' => $title, 'filter' => '');
$body = elgg_view_layout('content', $params);
echo elgg_view_page($title, $body);
示例6: elgg_get_page_owner_entity
<?php
/**
* Friends Files
*
* @package ElggFile
*/
$owner = elgg_get_page_owner_entity();
if (!$owner) {
forward('', '404');
}
elgg_push_breadcrumb(elgg_echo('file'), "file/all");
elgg_push_breadcrumb($owner->name, "file/owner/{$owner->username}");
elgg_push_breadcrumb(elgg_echo('friends'));
elgg_register_title_button('file', 'add', 'object', 'file');
$title = elgg_echo("file:friends");
$content = elgg_list_entities_from_relationship(array('type' => 'object', 'subtype' => 'file', 'full_view' => false, 'relationship' => 'friend', 'relationship_guid' => $owner->guid, 'relationship_join_on' => 'owner_guid', 'no_results' => elgg_echo("file:none"), 'preload_owners' => true, 'preload_containers' => true));
$sidebar = file_get_type_cloud($owner->guid, true);
$body = elgg_view_layout('content', array('filter_context' => 'friends', 'content' => $content, 'title' => $title, 'sidebar' => $sidebar));
echo elgg_view_page($title, $body);
示例7: groups_handle_members_page
/**
* Group members page
*
* @param int $guid Group entity GUID
*/
function groups_handle_members_page($guid)
{
elgg_entity_gatekeeper($guid, 'group');
$group = get_entity($guid);
elgg_set_page_owner_guid($guid);
elgg_group_gatekeeper();
$title = elgg_echo('groups:members:title', array($group->name));
elgg_push_breadcrumb($group->name, $group->getURL());
elgg_push_breadcrumb(elgg_echo('groups:members'));
$db_prefix = elgg_get_config('dbprefix');
$content = elgg_list_entities_from_relationship(array('relationship' => 'member', 'relationship_guid' => $group->guid, 'inverse_relationship' => true, 'type' => 'user', 'limit' => (int) get_input('limit', max(20, elgg_get_config('default_limit')), false), 'joins' => array("JOIN {$db_prefix}users_entity u ON e.guid=u.guid"), 'order_by' => 'u.name ASC'));
$params = array('content' => $content, 'title' => $title, 'filter' => '');
$body = elgg_view_layout('content', $params);
echo elgg_view_page($title, $body);
}
示例8: elgg_extract
<?php
/**
* Friend widget display view
*/
$widget = elgg_extract('entity', $vars);
$owner = $widget->getOwnerEntity();
if (!$owner instanceof \ElggUser) {
return;
}
$num_display = sanitize_int($widget->num_display, false);
// set default value for display number
if (!$num_display) {
$num_display = 12;
}
echo elgg_list_entities_from_relationship(['type' => 'user', 'relationship' => 'friend', 'relationship_guid' => $owner->guid, 'limit' => $num_display, 'size' => $widget->icon_size, 'list_type' => 'gallery', 'pagination' => false, 'no_results' => elgg_echo('friends:none')]);
示例9: elgg_extract
<?php
/**
* Group members sidebar
*
* @package ElggGroups
*
* @uses $vars["entity"] Group entity
* @uses $vars["limit"] The number of members to display
*/
$group = elgg_extract("entity", $vars);
if (!empty($group) && elgg_instanceof($group, "group")) {
if ($group->getPrivateSetting("group_tools:cleanup:members") != "yes") {
$limit = elgg_extract("limit", $vars, 14);
$all_link = elgg_view("output/url", array("href" => "groups/members/" . $group->getGUID(), "text" => elgg_echo("groups:members:more"), "is_trusted" => true));
$body = elgg_list_entities_from_relationship(array("relationship" => "member", "relationship_guid" => $group->getGUID(), "inverse_relationship" => true, "types" => "user", "limit" => $limit, "list_type" => "gallery", "gallery_class" => "elgg-gallery-users", "pagination" => false));
$body .= "<div class='center mts'>{$all_link}</div>";
echo elgg_view_module("aside", elgg_echo("groups:members"), $body);
}
}
示例10: get_input
<?php
$guid = (int) get_input('group_guid');
$members_search = sanitise_string(get_input('members_search'));
elgg_entity_gatekeeper($guid, 'group');
$group = get_entity($guid);
elgg_set_page_owner_guid($guid);
elgg_group_gatekeeper();
$title = elgg_echo('groups:members:title', array($group->name));
elgg_push_breadcrumb($group->name, $group->getURL());
elgg_push_breadcrumb(elgg_echo('groups:members'));
$db_prefix = elgg_get_config('dbprefix');
$options = ['relationship' => 'member', 'relationship_guid' => $group->guid, 'inverse_relationship' => true, 'type' => 'user', 'limit' => (int) get_input('limit', max(20, elgg_get_config('default_limit')), false), 'joins' => array("JOIN {$db_prefix}users_entity ue ON e.guid = ue.guid"), 'order_by' => 'ue.name ASC', 'no_results' => elgg_format_element('div', ['class' => 'elgg-list'], elgg_echo('notfound'))];
if (!empty($members_search)) {
$options['base_url'] = "groups/members/{$guid}?members_search={$members_search}";
$options['wheres'][] = "(ue.name LIKE '%{$members_search}%' OR ue.username LIKE '%{$members_search}%')";
}
$user_list = elgg_list_entities_from_relationship($options);
if (elgg_is_xhr()) {
echo $user_list;
return;
}
$content = elgg_view_form('group_tools/members_search', ['action' => "groups/members/{$guid}", 'disable_security' => true]);
$content .= $user_list;
$params = array('content' => $content, 'title' => $title, 'filter' => '');
$body = elgg_view_layout('content', $params);
echo elgg_view_page($title, $body);
示例11: forward
<?php
forward('', '404');
$page_type = elgg_extract('page_type', $vars);
$username = elgg_extract('username', $vars);
$user = get_user_by_username($username);
if (!$user) {
forward('', '404');
}
$params = ['filter_context' => 'friends', 'title' => elgg_echo('blog:title:friends')];
$crumbs_title = $user->name;
elgg_push_breadcrumb($crumbs_title, "blog/owner/{$user->username}");
elgg_push_breadcrumb(elgg_echo('friends'));
elgg_register_title_button('blog', 'add', 'object', 'blog');
$options = ['type' => 'object', 'subtype' => 'blog', 'full_view' => false, 'relationship' => 'friend', 'relationship_guid' => $user->getGUID(), 'relationship_join_on' => 'owner_guid', 'no_results' => elgg_echo('blog:none'), 'preload_owners' => true, 'preload_containers' => true];
$params['content'] = elgg_list_entities_from_relationship($options);
$params['sidebar'] = elgg_view('blog/sidebar', ['page' => $page_type]);
$body = elgg_view_layout('content', $params);
echo elgg_view_page($params['title'], $body);
示例12: listMembers
/**
* List the members of this site
*
* @param array $options An associative array for key => value parameters
* accepted by elgg_list_entities(). Common parameters
* include 'full_view', 'limit', and 'offset'.
*
* @return string
* @since 1.8.0
*/
public function listMembers($options = array())
{
$defaults = array('relationship' => 'member_of_site', 'relationship_guid' => $this->getGUID(), 'inverse_relationship' => TRUE, 'type' => 'user');
$options = array_merge($defaults, $options);
return elgg_list_entities_from_relationship($options);
}
示例13: elgg_echo
// 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);
$limit = elgg_get_config('default_limit');
if ($listtype == "gallery") {
$limit = 12;
}
$params = array('type' => 'object', 'subtype' => 'file', 'limit' => $limit, 'full_view' => false, 'preload_owners' => true);
if ($owner instanceof ElggUser) {
if ($friends) {
$params['relationship'] = 'friend';
$params['relationship_guid'] = $user->guid;
$params['relationship_join_on'] = 'owner_guid';
} else {
$params['owner_guid'] = $page_owner_guid;
}
} else {
$params['container_guid'] = $page_owner_guid;
}
if ($file_type) {
$params['metadata_name'] = $md_type;
$params['metadata_value'] = $file_type;
}
$content = elgg_list_entities_from_relationship($params);
$body = elgg_view_layout('content', array('filter' => '', 'content' => $content, 'title' => $title, 'sidebar' => $sidebar));
echo elgg_view_page($title, $body);
示例14: elgg_get_page_owner_entity
<?php
$page_owner = elgg_get_page_owner_entity();
if ($page_owner->guid == elgg_get_logged_in_user_guid()) {
$title = elgg_echo('groups:yours');
} else {
$title = elgg_echo('groups:user', array($page_owner->name));
}
elgg_push_breadcrumb($title);
if (elgg_get_plugin_setting('limited_groups', 'groups') != 'yes' || elgg_is_admin_logged_in()) {
elgg_register_title_button();
}
$dbprefix = elgg_get_config('dbprefix');
$content = elgg_list_entities_from_relationship(array('type' => 'group', 'relationship' => 'member', 'relationship_guid' => elgg_get_page_owner_guid(), 'inverse_relationship' => false, 'full_view' => false, 'joins' => array("JOIN {$dbprefix}groups_entity ge ON e.guid = ge.guid"), 'order_by' => 'ge.name ASC', 'no_results' => elgg_echo('groups:none')));
$params = array('content' => $content, 'title' => $title, 'filter' => '');
$body = elgg_view_layout('content', $params);
echo elgg_view_page($title, $body);
示例15: elgg_get_page_owner_entity
<?php
$user = elgg_get_page_owner_entity();
if (!$user instanceof \ElggUser) {
forward('', '404');
}
$filter_context = '';
$title = elgg_echo('event_manager:attending:title', [$user->name]);
if ($user->guid === elgg_get_logged_in_user_guid()) {
$filter_context = 'attending';
}
$content = elgg_list_entities_from_relationship(['type' => 'object', 'subtype' => \Event::SUBTYPE, 'relationship' => EVENT_MANAGER_RELATION_ATTENDING, 'relationship_guid' => $user->guid, 'inverse_relationship' => true, 'no_results' => elgg_echo('notfound')]);
$body = elgg_view_layout('content', ['content' => $content, 'title' => $title, 'filter_context' => $filter_context]);
echo elgg_view_page($title, $body);