本文整理汇总了PHP中elgg_list_entities_from_relationship_count函数的典型用法代码示例。如果您正苦于以下问题:PHP elgg_list_entities_from_relationship_count函数的具体用法?PHP elgg_list_entities_from_relationship_count怎么用?PHP elgg_list_entities_from_relationship_count使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了elgg_list_entities_from_relationship_count函数的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: groups_handle_all_page
/**
* List all groups
*/
function groups_handle_all_page()
{
// all groups doesn't get link to self
elgg_pop_breadcrumb();
elgg_push_breadcrumb(elgg_echo('groups'));
if (elgg_get_plugin_setting('limited_groups', 'groups') != 'yes' || elgg_is_admin_logged_in()) {
elgg_register_title_button();
}
$selected_tab = get_input('filter', 'newest');
switch ($selected_tab) {
case 'popular':
$content = elgg_list_entities_from_relationship_count(array('type' => 'group', 'relationship' => 'member', 'inverse_relationship' => false, 'full_view' => false, 'no_results' => elgg_echo('groups:none')));
break;
case 'discussion':
$content = elgg_list_entities(array('type' => 'object', 'subtype' => 'groupforumtopic', 'order_by' => 'e.last_action desc', 'limit' => 40, 'full_view' => false, 'no_results' => elgg_echo('discussion:none'), 'distinct' => false, 'preload_containers' => true));
break;
case 'featured':
$content = elgg_list_entities_from_metadata(array('type' => 'group', 'metadata_name' => 'featured_group', 'metadata_value' => 'yes', 'full_view' => false));
if (!$content) {
$content = elgg_echo('groups:nofeatured');
}
break;
case 'newest':
default:
$content = elgg_list_entities(array('type' => 'group', 'full_view' => false, 'no_results' => elgg_echo('groups:none'), 'distinct' => false));
break;
}
$filter = elgg_view('groups/group_sort_menu', array('selected' => $selected_tab));
$sidebar = elgg_view('groups/sidebar/find');
$sidebar .= elgg_view('groups/sidebar/featured');
$params = array('content' => $content, 'sidebar' => $sidebar, 'filter' => $filter);
$body = elgg_view_layout('content', $params);
echo elgg_view_page(elgg_echo('groups:all'), $body);
}
示例2: show_members_json
function show_members_json($context, $limit = 30, $offset = 0, $username)
{
if (!$username) {
$user = elgg_get_logged_in_user_entity();
} else {
$user = get_user_by_username($username);
if (!$user) {
throw new InvalidParameterException('registration:usernamenotvalid');
}
}
if ($context == "newest") {
$params = array('types' => 'user', 'limit' => $limit, 'full_view' => FALSE);
$latest_member = elgg_get_entities($params);
//return $return;
}
if ($context == "online") {
$latest_member = get_online_users();
}
if ($context == "popular") {
$params = array('types' => 'user', 'relationship' => 'friend', 'inverse_relationship' => false);
$latest_member = elgg_list_entities_from_relationship_count($params);
}
if ($latest_member) {
foreach ($latest_member as $single) {
$member['guid'] = $single->guid;
$member['name'] = $single->name;
//$member['avatar_url'] = get_entity_icon_url($single,'small');
$return[] = $member;
}
}
//return $return;
return json_encode($return, true);
}
示例3: groups_handle_all_page
/**
* List all groups
*/
function groups_handle_all_page()
{
$display_subgroups = elgg_get_plugin_setting('display_subgroups', 'au_subgroups');
$db_prefix = elgg_get_config('dbprefix');
// all groups doesn't get link to self
elgg_pop_breadcrumb();
elgg_push_breadcrumb(elgg_echo('groups'));
if (elgg_get_plugin_setting('limited_groups', 'groups') != 'yes' || elgg_is_admin_logged_in()) {
elgg_register_title_button();
}
$gsa_tab = get_input('gsa');
if ($gsa_tab) {
switch ($gsa_tab) {
case 'discussion':
$options = array('type' => 'object', 'subtype' => 'groupforumtopic', 'no_results' => elgg_echo('discussion:none'));
$content = elgg_list_entities($options);
break;
case 'groups':
$options = array('type' => 'group', 'inverse_relationship' => false, 'no_results' => elgg_echo('groups:none'));
$content = elgg_list_entities($options);
break;
default:
// cyu - in theory this should never invoke
break;
}
} else {
$selected_tab = get_input('filter', 'newest');
switch ($selected_tab) {
case 'popular':
$options = array('type' => 'group', 'relationship' => 'member', 'inverse_relationship' => false, 'full_view' => false, 'no_results' => elgg_echo('groups:none'));
if ($display_subgroups != 'yes') {
$options['wheres'] = array("NOT EXISTS ( SELECT 1 FROM {$db_prefix}entity_relationships WHERE guid_one = e.guid AND relationship = 'au_subgroup_of' )");
}
$content = elgg_list_entities_from_relationship_count($options);
break;
case 'discussion':
$options = array('type' => 'object', 'subtype' => 'groupforumtopic', 'order_by' => 'e.last_action desc', 'limit' => 40, 'full_view' => false, 'no_results' => elgg_echo('discussion:none'));
if ($display_subgroups != 'yes') {
$options['wheres'] = array("NOT EXISTS ( SELECT 1 FROM {$db_prefix}entity_relationships WHERE guid_one = e.guid AND relationship = 'au_subgroup_of' )");
}
$content = elgg_list_entities($options);
break;
case 'newest':
default:
$options = array('type' => 'group', 'full_view' => false, 'no_results' => elgg_echo('groups:none'));
if ($display_subgroups != 'yes') {
$options['wheres'] = array("NOT EXISTS ( SELECT 1 FROM {$db_prefix}entity_relationships WHERE guid_one = e.guid AND relationship = 'au_subgroup_of' )");
}
$content = elgg_list_entities($options);
break;
}
}
// end if clause
$filter = elgg_view('groups/group_sort_menu', array('selected' => $selected_tab));
$sidebar = elgg_view('groups/sidebar/find');
$sidebar .= elgg_view('groups/sidebar/featured');
$params = array('content' => $content, 'sidebar' => $sidebar, 'filter' => $filter);
$body = elgg_view_layout('content', $params);
echo elgg_view_page(elgg_echo('groups:all'), $body);
}
示例4: groups_handle_all_page
/**
* List all groups
*/
function groups_handle_all_page()
{
$display_subgroups = elgg_get_plugin_setting('display_subgroups', 'au_subgroups');
$db_prefix = elgg_get_config('dbprefix');
if (elgg_get_plugin_setting('limited_groups', 'groups') != 'yes' || elgg_is_admin_logged_in()) {
elgg_register_title_button();
}
$selected_tab = get_input('filter', 'newest');
switch ($selected_tab) {
case 'popular':
$options = array('type' => 'group', 'relationship' => 'member', 'inverse_relationship' => false, 'full_view' => false, 'no_results' => elgg_echo('groups:none'));
if ($display_subgroups != 'yes') {
$options['wheres'] = array("NOT EXISTS ( SELECT 1 FROM {$db_prefix}entity_relationships WHERE guid_one = e.guid AND relationship = '" . AU_SUBGROUPS_RELATIONSHIP . "' )");
}
$content = elgg_list_entities_from_relationship_count($options);
break;
case 'discussion':
$content = elgg_list_entities(array('type' => 'object', 'subtype' => 'groupforumtopic', 'order_by' => 'e.last_action desc', 'limit' => 40, 'full_view' => false, 'no_results' => elgg_echo('discussion:none')));
break;
case 'newest':
default:
$options = array('type' => 'group', 'full_view' => false, 'no_results' => elgg_echo('groups:none'));
if ($display_subgroups != 'yes') {
$options['wheres'] = array("NOT EXISTS ( SELECT 1 FROM {$db_prefix}entity_relationships WHERE guid_one = e.guid AND relationship = '" . AU_SUBGROUPS_RELATIONSHIP . "' )");
}
$content = elgg_list_entities($options);
break;
}
$filter = elgg_view('groups/group_sort_menu', array('selected' => $selected_tab));
$sidebar = elgg_view('groups/sidebar/find');
$sidebar .= elgg_view('groups/sidebar/featured');
$params = array('content' => $content, 'sidebar' => $sidebar, 'filter' => $filter);
$body = elgg_view_layout('content', $params);
echo elgg_view_page(elgg_echo('groups:all'), $body);
}
示例5: members_list_popular
/**
* Returns content for the "popular" page
*
* @param string $hook "members:list"
* @param string $type "popular"
* @param string|null $returnvalue list content (null if not set)
* @param array $params array with key "options"
* @return string
*/
function members_list_popular($hook, $type, $returnvalue, $params)
{
if ($returnvalue !== null) {
return;
}
$options = $params['options'];
$options['relationship'] = 'friend';
$options['inverse_relationship'] = false;
return elgg_list_entities_from_relationship_count($options);
}
示例6: groups_handle_mine_page
/**
* List groups the user is memober of
*/
function groups_handle_mine_page()
{
$page_owner = elgg_get_page_owner_entity();
$title = elgg_echo('groups:yours');
elgg_push_breadcrumb($title);
$content = elgg_list_entities_from_relationship_count(array('type' => 'group', 'relationship' => 'member', 'relationship_guid' => elgg_get_page_owner_guid(), 'inverse_relationship' => false, 'full_view' => false));
$params = array('content' => $content, 'title' => $title, 'filter' => '');
$body = elgg_view_layout('content', $params);
echo elgg_view_page($title, $body);
}
示例7: list_entities_by_relationship_count
/**
* Displays a human-readable list of entities
*
* @deprecated 1.8 Use elgg_list_entities_from_relationship_count()
*
* @param string $relationship The relationship eg "friends_of"
* @param bool $inverse_relationship Inverse relationship owners
* @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 bool $fullview Whether or not to display the full view (default: true)
* @param bool $listtypetoggle Whether or not to allow gallery view
* @param bool $pagination Whether to display pagination (default: true)
*
* @return string The viewable list of entities
*/
function list_entities_by_relationship_count($relationship, $inverse_relationship = true, $type = "", $subtype = "", $owner_guid = 0, $limit = 10, $fullview = true, $listtypetoggle = false, $pagination = true)
{
elgg_deprecated_notice('list_entities_by_relationship_count() was deprecated by elgg_list_entities_from_relationship_count()', 1.8);
$options = array();
$options['relationship'] = $relationship;
// this used to default to true, which is wrong.
// flip it for the new function
$options['inverse_relationship'] = !$inverse_relationship;
if ($type) {
$options['types'] = $type;
}
if ($subtype) {
$options['subtypes'] = $subtype;
}
if ($owner_guid) {
$options['owner_guid'] = $owner_guid;
}
$options['limit'] = $limit;
$options['full_view'] = $fullview;
return elgg_list_entities_from_relationship_count($options);
}
示例8: array
if (!elgg_is_admin_logged_in()) {
$params['wheres'] = array("((u.name LIKE \"%{$name}%\" OR u.username LIKE \"%{$name}%\") AND u.banned = 'no')");
} else {
$params['wheres'] = array("((u.name LIKE \"%{$name}%\" OR u.username LIKE \"%{$name}%\"))");
}
$content = elgg_list_entities($params);
break;
case 'popular':
$options['base_url'] = $base_url;
$options['relationship'] = 'friend';
$options['inverse_relationship'] = false;
$options['joins'] = array("JOIN " . $dbprefix . "users_entity u ON e.guid=u.guid");
if (!elgg_is_admin_logged_in()) {
$options['wheres'] = array("(u.banned = 'no')");
}
$content = elgg_list_entities_from_relationship_count($options);
break;
case 'online':
default:
$offset = get_input('offset', 0);
$count = find_active_users(array('seconds' => 600, 'limit' => 10, 'offset' => $offset, 'count' => true));
$objects = gc_find_active_users(600, 10, $offset);
if ($objects) {
$content = elgg_view_entity_list($objects, array('count' => $count, 'offset' => $offset, 'base_url' => $base_url, 'limit' => 10));
}
break;
case 'newest':
$options['base_url'] = $base_url;
$options['joins'] = array("JOIN " . $dbprefix . "users_entity u ON e.guid=u.guid");
if (!elgg_is_admin_logged_in()) {
$options['wheres'] = array("(u.banned = 'no')");
示例9: elgg_pop_breadcrumb
<?php
// all groups doesn't get link to self
elgg_pop_breadcrumb();
elgg_push_breadcrumb(elgg_echo('groups'));
if (elgg_get_plugin_setting('limited_groups', 'groups') != 'yes' || elgg_is_admin_logged_in()) {
elgg_register_title_button();
}
$selected_tab = get_input('filter', 'newest');
switch ($selected_tab) {
case 'popular':
$content = elgg_list_entities_from_relationship_count(array('type' => 'group', 'relationship' => 'member', 'inverse_relationship' => false, 'full_view' => false, 'no_results' => elgg_echo('groups:none')));
break;
case 'discussion':
// Get only the discussions that have been created inside a group
$dbprefix = elgg_get_config('dbprefix');
$content = elgg_list_entities(array('type' => 'object', 'subtype' => 'discussion', 'order_by' => 'e.last_action desc', 'limit' => 40, 'full_view' => false, 'no_results' => elgg_echo('discussion:none'), 'joins' => array("JOIN {$dbprefix}entities ce ON ce.guid = e.container_guid"), 'wheres' => array('ce.type = "group"'), 'distinct' => false, 'preload_containers' => true));
break;
case 'featured':
$content = elgg_list_entities_from_metadata(array('type' => 'group', 'metadata_name' => 'featured_group', 'metadata_value' => 'yes', 'full_view' => false));
if (!$content) {
$content = elgg_echo('groups:nofeatured');
}
break;
case 'alpha':
$dbprefix = elgg_get_config('dbprefix');
$content = elgg_list_entities(array('type' => 'group', 'joins' => ["JOIN {$dbprefix}groups_entity ge ON e.guid = ge.guid"], 'order_by' => 'ge.name', 'full_view' => false, 'no_results' => elgg_echo('groups:none'), 'distinct' => false));
break;
case 'newest':
default:
$content = elgg_list_entities(array('type' => 'group', 'full_view' => false, 'no_results' => elgg_echo('groups:none'), 'distinct' => false));
示例10: groups_handle_mine_page
/**
* List groups the user is memober of
*/
function groups_handle_mine_page()
{
$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);
elgg_register_title_button();
$content = elgg_list_entities_from_relationship_count(array('type' => 'group', 'relationship' => 'member', 'relationship_guid' => elgg_get_page_owner_guid(), 'inverse_relationship' => false, 'full_view' => false));
if (!$content) {
$content = elgg_echo('groups:none');
}
$params = array('content' => $content, 'title' => $title, 'filter' => '');
$body = elgg_view_layout('content', $params);
echo elgg_view_page($title, $body);
}
示例11: elgg_pop_breadcrumb
<?php
/**
* List all groups
*/
// all groups doesn't get link to self
elgg_pop_breadcrumb();
elgg_push_breadcrumb(elgg_echo('groups'));
elgg_register_title_button();
$selected_tab = get_input('filter', 'featured');
switch ($selected_tab) {
case 'popular':
$content = elgg_list_entities_from_relationship_count(array('type' => 'group', 'relationship' => 'member', 'inverse_relationship' => false, 'full_view' => false));
break;
case "language":
$content = elgg_list_entities_from_metadata(array('type' => 'group', 'metadata_name' => 'group_category', 'metadata_value' => 'language', 'limit' => $limit, 'full_view' => false));
break;
case "plugins":
$content = elgg_list_entities_from_metadata(array('type' => 'group', 'metadata_name' => 'group_category', 'metadata_value' => 'plugins', 'limit' => $limit, 'full_view' => false));
break;
case "developers":
$content = elgg_list_entities_from_metadata(array('type' => 'group', 'metadata_name' => 'group_category', 'metadata_value' => 'developers', 'limit' => $limit, 'full_view' => false));
break;
case "support":
$content = elgg_list_entities_from_metadata(array('type' => 'group', 'metadata_name' => 'group_category', 'metadata_value' => 'support', 'limit' => $limit, 'full_view' => false));
break;
case 'featured':
default:
$content = elgg_list_entities_from_metadata(array('type' => 'group', 'metadata_name' => 'featured_group', 'metadata_value' => 'yes', 'limit' => $limit, 'full_view' => false));
break;
}
示例12: groups_handle_mine_page
/**
* List groups the user is memober of
*/
function groups_handle_mine_page()
{
$title = elgg_echo('groups:yours');
$username = get_input('username');
if ($username) {
$user = get_user_by_username($username);
}
if (!$username || !$user) {
$user = elgg_get_logged_in_user_entity();
}
elgg_pop_breadcrumb();
elgg_push_breadcrumb(elgg_echo("menu:home"), "dashboard");
elgg_push_breadcrumb(elgg_get_logged_in_user_entity()->name, "pages/owner/" . $user->guid . "/all");
$group_options["type"] = 'group';
$group_options["relationship"] = 'member';
$group_options["relationship_guid"] = $user->guid;
$group_options["inverse_relationship"] = false;
$group_options["full_view"] = false;
$group_options["limit"] = NULL;
$group_options["joins"] = array("JOIN " . elgg_get_config("dbprefix") . "groups_entity ge ON e.guid = ge.guid");
$group_options["order_by"] = "ge.name ASC";
// first, local groups
$group_options["metadata_name"] = 'grouptype';
$group_options["metadata_value"] = 'local';
$pagecontent = elgg_view('page/elements/subtitle', array('title' => elgg_echo('localgroups:mine'), 'class' => 'elgg-subtitle'));
$content = elgg_list_entities_from_relationship_count($group_options);
if (!$content) {
$content = elgg_echo('groups:none');
}
$pagecontent .= $content;
// then, working groups
$group_options["metadata_name"] = 'grouptype';
$group_options["metadata_value"] = 'working';
$pagecontent .= elgg_view('page/elements/subtitle', array('title' => elgg_echo('workinggroups:mine'), 'class' => 'elgg-subtitle'));
$content = elgg_list_entities_from_relationship_count($group_options);
if (!$content) {
$content = elgg_echo('groups:none');
}
$pagecontent .= $content;
$params = array('content' => $pagecontent, 'title' => $title, 'filter' => '');
$body = elgg_view_layout('content', $params);
echo elgg_view_page($title, $body);
}
示例13: subsite_manager_groups_route_hook
function subsite_manager_groups_route_hook($hook, $entity_type, $return_value, $params)
{
if (!subsite_manager_on_subsite()) {
$page = elgg_extract("segments", $return_value);
switch ($page[0]) {
case "invitations":
gatekeeper();
set_input("username", $page[1]);
$user = elgg_get_page_owner_entity();
if (empty($user)) {
$user = elgg_get_logged_in_user_entity();
}
// set breadcrumb
elgg_push_breadcrumb(elgg_echo("groups"), "groups/all");
$title = elgg_echo("groups:invitations");
elgg_push_breadcrumb($title);
// @todo temporary workaround for exts #287.
$ia = elgg_set_ignore_access(TRUE);
$invitations = elgg_get_entities_from_relationship(array("type" => "group", "limit" => false, "site_guids" => false, "relationship" => "invited", "relationship_guid" => elgg_get_logged_in_user_guid(), "inverse_relationship" => true));
elgg_set_ignore_access($ia);
// get membership requests
$request_options = array("type" => "group", "relationship" => "membership_request", "relationship_guid" => $user->getGUID(), "limit" => false, "full_view" => false, "pagination" => false);
$requests = elgg_get_entities_from_relationship($request_options);
// invite by email allowed
$invite_email = false;
$email_invitations = false;
if (elgg_get_plugin_setting("invite_email", "group_tools") == "yes") {
$invite_email = true;
$email_invitations = group_tools_get_invited_groups_by_email($user->email);
}
$content = elgg_view("groups/invitationrequests", array("user" => $user, "invitations" => $invitations, "requests" => $requests, "invite_email" => $invite_email, "email_invitations" => $email_invitations));
$params = array("content" => $content, "title" => $title, "filter" => "");
$body = elgg_view_layout("content", $params);
echo elgg_view_page($title, $body);
return false;
break;
case "member":
set_input("username", $page[1]);
$page_owner = elgg_get_page_owner_entity();
// set breadcrumb
elgg_push_breadcrumb(elgg_echo("groups"), "groups/all");
$title = elgg_echo("groups:yours");
elgg_push_breadcrumb($title);
elgg_register_title_button();
$options = array("type" => "group", "relationship" => "member", "relationship_guid" => $page_owner->getGUID(), "inverse_relationship" => false, "full_view" => false);
if ($page_owner->getGUID() == elgg_get_logged_in_user_guid()) {
$options["site_guids"] = false;
}
if (!($content = elgg_list_entities_from_relationship_count($options))) {
$content = elgg_echo("groups:none");
}
$params = array("content" => $content, "title" => $title, "filter" => "");
$body = elgg_view_layout("content", $params);
echo elgg_view_page($title, $body);
return false;
break;
}
}
}