本文整理汇总了PHP中elgg_list_entities函数的典型用法代码示例。如果您正苦于以下问题:PHP elgg_list_entities函数的具体用法?PHP elgg_list_entities怎么用?PHP elgg_list_entities使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了elgg_list_entities函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: groups_handle_owned_page
/**
* List owned groups
*/
function groups_handle_owned_page()
{
$db_prefix = elgg_get_config('dbprefix');
$page_owner = elgg_get_page_owner_entity();
if ($page_owner->guid == elgg_get_logged_in_user_guid()) {
$title = elgg_echo('groups:owned');
} else {
$title = elgg_echo('groups:owned: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');
$options = array('type' => 'group', 'owner_guid' => elgg_get_page_owner_guid(), 'joins' => array("JOIN {$dbprefix}groups_entity ge ON e.guid = ge.guid"), 'order_by' => 'ge.name ASC', 'full_view' => false, 'no_results' => elgg_echo('groups:none'));
$options['joins'] = array("JOIN {$db_prefix}groups_entity ge ON e.guid = ge.guid");
$options['order_by'] = 'ge.name asc';
$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);
$sidebar = '';
$display_sidebar = elgg_get_plugin_setting('display_featured', 'au_subgroups');
if ($display_sidebar == 'yes') {
$sidebar = elgg_view('groups/sidebar/featured');
}
$params = array('content' => $content, 'title' => $title, 'sidebar' => $sidebar, 'filter' => '');
$body = elgg_view_layout('content', $params);
echo elgg_view_page($title, $body);
}
示例2: members_list_newest
/**
* Returns content for the "newest" page
*
* @param string $hook "members:list"
* @param string $type "newest"
* @param string|null $returnvalue list content (null if not set)
* @param array $params array with key "options"
* @return string
*/
function members_list_newest($hook, $type, $returnvalue, $params)
{
if ($returnvalue !== null) {
return;
}
return elgg_list_entities($params['options']);
}
示例3: elgg_echo
/**
* Get images for display on front page
*
* @param int number of images
* @param int (optional) guid of owner
* @return string of html for display
*
* To use with the custom index plugin, use something like this:
if (is_plugin_enabled('tidypics')) {
?>
<!-- display latest photos -->
<div class="index_box">
<h2><a href="<?php echo $vars['url']; ?>pg/photos/world/"><?php echo elgg_echo("tidypics:mostrecent"); ?></a></h2>
<div class="contentWrapper">
<?php
echo tp_get_latest_photos(5);
?>
</div>
</div>
<?php
}
?>
* Good luck
*/
function tp_get_latest_photos($num_images, $owner_guid = 0, $context = 'front')
{
$prev_context = get_context();
set_context($context);
$image_html = elgg_list_entities(array('type' => 'object', 'subtype' => 'image', 'owner_guid' => $owner_guid, 'limit' => $num_images, 'full_view' => false, 'pagination' => false));
set_context($prev_context);
return $image_html;
}
示例4: tp_get_latest_albums
/**
* Get albums for display on front page
*
* @param int number of albums
* @param array (optional) array of container_guids
* @param string (optional) context of view to display
* @return string of html for display
*/
function tp_get_latest_albums($num_albums, array $container_guids = NULL, $context = 'front')
{
$prev_context = elgg_get_context();
elgg_set_context($context);
$image_html = elgg_list_entities(array('type' => 'object', 'subtype' => 'album', 'container_guids' => $container_guids, 'limit' => $num_albums, 'full_view' => false, 'pagination' => false));
elgg_set_context($prev_context);
return $image_html;
}
示例5: groups_handle_owned_page
/**
* List owned groups
*/
function groups_handle_owned_page()
{
$page_owner = elgg_get_page_owner_entity();
$title = elgg_echo('groups:owned');
elgg_push_breadcrumb($title);
$content = elgg_list_entities(array('type' => 'group', 'owner_guid' => elgg_get_page_owner_guid(), 'full_view' => false));
$params = array('content' => $content, 'title' => $title, 'filter' => '');
$body = elgg_view_layout('content', $params);
echo elgg_view_page($title, $body);
}
示例6: 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();
}
$selected_tab = get_input('filter', 'newest');
switch ($selected_tab) {
case 'popular':
$options = array('type' => 'group', 'relationship' => 'member', 'inverse_relationship' => false, 'full_view' => false);
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);
if (!$content) {
$content = 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));
if (!$content) {
$content = elgg_echo('discussion:none');
}
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:
$options = array('type' => 'group', 'full_view' => false);
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);
if (!$content) {
$content = elgg_echo('groups:none');
}
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);
}
示例7: izap_video_get_page_content_list
/**
* Get page components to list a user's or all izap-videos.
*
* @param integer $container_guid
*
* @return array array of content for rendering video list
*
* @version 5.0
*/
function izap_video_get_page_content_list($container_guid = NULL)
{
$return = array();
$return['filter_context'] = $container_guid ? 'mine' : 'all';
$options = array('type' => 'object', 'subtype' => GLOBAL_IZAP_VIDEOS_SUBTYPE, 'full_view' => false, 'no_results' => elgg_echo('izap-videos:none'));
$url_id = elgg_get_logged_in_user_guid();
$current_user = elgg_get_logged_in_user_entity();
if ($container_guid) {
$url_id = $container_guid;
// access check for closed groups
izap_group_gatekeeper();
$options['container_guid'] = $container_guid;
$container = get_entity($container_guid);
$return['title'] = elgg_echo('izap-videos:title:user_videos', array($container->name));
$crumbs_title = $container->name;
elgg_push_breadcrumb($crumbs_title);
if ($current_user && $container_guid == $current_user->guid) {
$return['filter_context'] = 'mine';
} else {
if (elgg_instanceof($container, 'group')) {
$return['filter'] = false;
} else {
// do not show button or select a tab when viewing someone else's posts
$return['filter_context'] = 'none';
}
}
} else {
$return['filter_context'] = 'all';
$return['title'] = elgg_echo('izap-videos:title:all_videos');
elgg_pop_breadcrumb();
elgg_push_breadcrumb(elgg_echo('izap-videos'));
}
if (elgg_is_logged_in()) {
$title = 'Add New Video';
}
$url = GLOBAL_IZAP_VIDEOS_PAGEHANDLER . '/add/';
if (izap_is_onserver_enabled_izap_videos() == 'yes') {
$url .= $url_id . '/onserver';
} elseif (izap_is_onserver_enabled_izap_videos() == 'youtube') {
$url .= $url_id . '/youtube';
} elseif (izap_is_offserver_enabled_izap_videos() == 'yes') {
$url .= $url_id . '/offserver';
} else {
$url .= $url_id . '/offserver';
}
elgg_register_menu_item('title', array('name' => elgg_get_friendly_title($title), 'href' => $url, 'text' => $title, 'link_class' => 'elgg-button elgg-button-action'));
$return['content'] = elgg_list_entities($options);
return $return;
}
示例8: groups_handle_owned_page
/**
* List owned groups
*/
function groups_handle_owned_page()
{
$page_owner = elgg_get_page_owner_entity();
if ($page_owner->guid == elgg_get_logged_in_user_guid()) {
$title = elgg_echo('groups:owned');
} else {
$title = elgg_echo('groups:owned:user', array($page_owner->name));
}
elgg_push_breadcrumb($title);
elgg_register_title_button();
$content = elgg_list_entities(array('type' => 'group', 'owner_guid' => elgg_get_page_owner_guid(), 'full_view' => false, '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);
}
示例9: list_subgroups
function list_subgroups($group, $options = array())
{
if ($group instanceof ElggGroup) {
$defaults = array('full_view' => false, 'pagination' => true);
$options = array_merge($defaults, $options);
$options['type'] = 'group';
$options['container_guid'] = $group->guid;
elgg_push_context('subgroups');
$list = elgg_list_entities($options);
elgg_pop_context();
return $list;
} else {
return "";
}
}
示例10: discussion_handle_list_page
/**
* List discussion topics in a group
*
* @param int $guid Group entity GUID
*/
function discussion_handle_list_page($guid)
{
elgg_set_page_owner_guid($guid);
elgg_group_gatekeeper();
$group = get_entity($guid);
if (!elgg_instanceof($group, 'group')) {
forward('', '404');
}
elgg_push_breadcrumb($group->name);
elgg_register_title_button();
$title = elgg_echo('item:object:groupforumtopic');
$options = array('type' => 'object', 'subtype' => 'groupforumtopic', 'limit' => 20, 'order_by' => 'e.last_action desc', 'container_guid' => $guid, 'full_view' => false, 'no_results' => elgg_echo('discussion:none'));
$content = elgg_list_entities($options);
$params = array('content' => $content, 'title' => $title, 'filter' => '');
$body = elgg_view_layout('content', $params);
echo elgg_view_page($title, $body);
}
示例11: discussion_handle_list_page
/**
* List discussion topics in a trip
*
* @param int $guid trip entity GUID
*/
function discussion_handle_list_page($guid)
{
elgg_set_page_owner_guid($guid);
elgg_trip_gatekeeper();
$trip = get_entity($guid);
if (!elgg_instanceof($trip, 'trip')) {
forward('', '404');
}
elgg_push_breadcrumb($trip->name, $trip->getURL());
elgg_push_breadcrumb(elgg_echo('item:object:tripforumtopic'));
elgg_register_title_button();
$title = elgg_echo('item:object:tripforumtopic');
$options = array('type' => 'object', 'subtype' => 'tripforumtopic', 'limit' => max(20, elgg_get_config('default_limit')), 'order_by' => 'e.last_action desc', 'container_guid' => $guid, 'full_view' => false, 'no_results' => elgg_echo('discussion:none'), 'preload_owners' => true);
$content = elgg_list_entities($options);
$params = array('content' => $content, 'title' => $title, 'sidebar' => elgg_view('discussion/sidebar'), 'filter' => '');
$body = elgg_view_layout('content', $params);
echo elgg_view_page($title, $body);
}
示例12: groups_handle_owned_page
/**
* List owned groups
*/
function groups_handle_owned_page()
{
$page_owner = elgg_get_page_owner_entity();
if ($page_owner->guid == elgg_get_logged_in_user_guid()) {
$title = elgg_echo('groups:owned');
} else {
$title = elgg_echo('groups:owned: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(array('type' => 'group', 'owner_guid' => elgg_get_page_owner_guid(), 'joins' => array("JOIN {$dbprefix}groups_entity ge ON e.guid = ge.guid"), 'order_by' => 'ge.name ASC', 'full_view' => false, 'no_results' => elgg_echo('groups:none'), 'distinct' => false));
$params = array('content' => $content, 'title' => $title, 'filter' => '');
$body = elgg_view_layout('content', $params);
echo elgg_view_page($title, $body);
}
示例13: blog_get_posts_php
function blog_get_posts_php($context, $limit = 30, $offset = 0, $group_guid, $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 == "all") {
$params = array('types' => 'object', 'subtypes' => 'blog', 'limit' => $limit, 'full_view' => FALSE, 'no_results' => elgg_echo('blog:noblogs'));
echo elgg_list_entities($params);
}
if ($context == "mine" || $context == "user") {
$params = array('types' => 'object', 'subtypes' => 'blog', 'owner_guid' => $user->guid, 'limit' => $limit, 'full_view' => FALSE, 'no_results' => elgg_echo('blog:noblogs'));
echo elgg_list_entities($params);
}
}
示例14: chat_all
/**
* Get page components to list all chats the user is participating.
*
* @return array
*/
function chat_all($container_guid = null)
{
elgg_register_title_button();
$user_guid = elgg_get_logged_in_user_guid();
if ($container_guid == $user_guid) {
// Chats started by the user
$params['filter_context'] = 'mine';
$chats = elgg_list_entities(array('type' => 'object', 'subtype' => 'chat', 'limit' => 10, 'pagination' => true, 'full_view' => false, 'container_guid' => $user_guid));
} else {
// All chats that the user is participating
$chats = elgg_list_entities_from_relationship(array('type' => 'object', 'subtype' => 'chat', 'relationship' => 'member', 'relationship_guid' => $user_guid, 'inverse_relationship' => false, 'limit' => 10, 'pagination' => true, 'full_view' => false));
}
if (empty($chats)) {
$chats = elgg_echo('chat:none');
}
$params['title'] = elgg_echo('chat');
$params['content'] = $chats;
return $params;
}
示例15: groups_handle_owned_page
/**
* List owned groups
*/
function groups_handle_owned_page()
{
$page_owner = elgg_get_page_owner_entity();
if ($page_owner->guid == elgg_get_logged_in_user_guid()) {
$title = elgg_echo('groups:owned');
} else {
$title = elgg_echo('groups:owned: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();
}
$content = elgg_list_entities(array('type' => 'group', 'owner_guid' => elgg_get_page_owner_guid(), '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);
}