本文整理汇总了PHP中elgg_list_entities_from_metadata函数的典型用法代码示例。如果您正苦于以下问题:PHP elgg_list_entities_from_metadata函数的具体用法?PHP elgg_list_entities_from_metadata怎么用?PHP elgg_list_entities_from_metadata使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了elgg_list_entities_from_metadata函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: au_group_tag_menu_page_handler
function au_group_tag_menu_page_handler($page, $identifier)
{
//show the page of search results
// assumes url of group/guid/tag
// if the tag is 'all' then will display a tagcloud
switch ($page[0]) {
case 'group':
$entity = get_entity($page[1]);
if (!elgg_instanceof($entity, 'group') || $entity->au_group_tag_menu_enable == 'no') {
return false;
}
elgg_push_breadcrumb($entity->name, $entity->getURL());
//should be OK if this is empty
$tag = $page[2];
elgg_push_breadcrumb($tag);
if ($tag == "all") {
//show a tag cloud for all group tags
//arbitrarily set to a max of 640 tags - should be enough for anyone :-)
$title = elgg_echo("au_group_tag_menu:tagcloud");
$options = array('container_guid' => $entity->getGUID(), 'type' => 'object', 'threshold' => 0, 'limit' => 640, 'tag_names' => array('tags'));
$thetags = elgg_get_tags($options);
//make it an alphabetical tag cloud, not with most popular first
sort($thetags);
//find the highest tag count for scaling the font
$max = 0;
foreach ($thetags as $key) {
if ($key->total > $max) {
$max = $key->total;
}
}
$content = " ";
//loop through and generate tags so they display nicely
//in the group, not as a dumb search page
foreach ($thetags as $key) {
$url = elgg_get_site_url() . "group_tag_menu/group/" . $entity->getGUID() . "/" . urlencode($key->tag);
$taglink = elgg_view('output/url', array('text' => ' ' . $key->tag, 'href' => $url, 'title' => "{$key->tag} ({$key->total})", 'rel' => 'tag'));
// get the font size for the tag (taken from elgg's own tagcloud code - not sure I love this)
$size = round(log($key->total) / log($max + 0.0001) * 100) + 30;
if ($size < 100) {
$size = 100;
}
// generate the link
$content .= " <a href='{$url}' style='font-size:{$size}%'>" . $key->tag . "</a> ";
}
} else {
//show the results for the selected tag
$title = elgg_echo("au_group_tag_menu:title") . "{$tag}";
$options = array('type' => 'object', 'metadata_name' => 'tags', 'metadata_value' => $tag, 'container_guid' => $entity->guid, 'full_view' => false);
$content = elgg_list_entities_from_metadata($options);
}
//display the page
if (!$content) {
$content = elgg_echo('au_group_tag_menu:noresults');
}
$layout = elgg_view_layout('content', array('title' => elgg_view_title($title), 'content' => $content, 'filter' => false));
echo elgg_view_page($title, $layout);
break;
}
return true;
}
示例2: blog_get_page_content_read
/**
* Returns HTML for a blog post.
*
* @param int $guid of a blog entity.
* @return string html
*/
function blog_get_page_content_read($owner_guid = NULL, $guid = NULL)
{
$content = elgg_view('page_elements/content_header', array('context' => $context, 'type' => 'blog'));
if ($guid) {
$blog = get_entity($guid);
if (!elgg_instanceof($blog, 'object', 'blog') && $blog->status == 'final') {
$content .= elgg_echo('blog:error:post_not_found');
} else {
elgg_push_breadcrumb($blog->title, $blog->getURL());
$content .= elgg_view_entity($blog, TRUE);
}
} else {
$options = array('type' => 'object', 'subtype' => 'blog', 'full_view' => FALSE, 'order_by_metadata' => array('name' => 'publish_date', 'direction' => 'DESC', 'as' => 'int'));
if ($owner_guid) {
$options['owner_guid'] = $owner_guid;
}
// show all posts for admin or users looking at their own blogs
// show only published posts for other users.
if (!(isadminloggedin() || isloggedin() && $owner_guid == get_loggedin_userid())) {
$options['metadata_name_value_pairs'] = array(array('name' => 'status', 'value' => 'published'), array('name' => 'publish_date', 'operand' => '<', 'value' => time()));
}
$content .= elgg_list_entities_from_metadata($options);
}
return array('content' => $content);
}
示例3: actionAccepted
/**
* displays the list of accepted challenges
*/
public function actionAccepted()
{
$page_owner = elgg_get_page_owner_entity();
$this->page_elements['title'] = $page_owner->name . '\'s ' . elgg_echo('izap-contest:challenge:accepted');
$list = elgg_list_entities_from_metadata(array('type' => 'object', 'subtype' => GLOBAL_IZAP_CONTEST_CHALLENGE_SUBTYPE, 'metadata_name' => 'accepted_by', 'metadata_value' => $page_owner->guid));
if (empty($list) || $list == '') {
$this->page_elements['content'] = '<div class="contentWrapper">' . elgg_echo('izap-contest:notfound') . '</div>';
} else {
$this->page_elements['content'] = $list;
}
$this->drawpage();
}
示例4: videos_get_page_content_featured
/**
* Prepare the add/edit form variables
*
* @param ElggObject $video A video object.
* @return array
*/
function videos_get_page_content_featured($guid = NULL)
{
$return = array();
$options = array('type' => 'object', 'subtype' => 'videos', 'full_view' => FALSE, 'limit' => 10, 'metadata_name_value_pairs' => array(array("name" => "featured", "value" => true)));
$list = elgg_list_entities_from_metadata($options);
$return['filter_context'] = 'Featured';
$return['content'] = $list;
$return['title'] = elgg_echo('videos:title:featured');
elgg_push_breadcrumb($crumbs_title, "Featured");
elgg_register_title_button();
return $return;
}
示例5: blog_get_page_content_list
function blog_get_page_content_list($offset, $base_url, $container_guid = NULL)
{
$return = array();
$return['filter_context'] = $container_guid ? 'mine' : 'all';
$options = array('base_url' => $base_url, 'type' => 'object', 'subtype' => 'blog', 'full_view' => false, 'offset' => $offset);
$current_user = elgg_get_logged_in_user_entity();
if ($container_guid) {
// access check for closed groups
group_gatekeeper();
$options['container_guid'] = $container_guid;
$container = get_entity($container_guid);
if (!$container) {
}
$return['title'] = elgg_echo('blog:title:user_blogs', 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('blog:title:all_blogs');
elgg_pop_breadcrumb();
elgg_push_breadcrumb(elgg_echo('blog:blogs'));
}
elgg_register_title_button();
// show all posts for admin or users looking at their own blogs
// show only published posts for other users.
$show_only_published = true;
if ($current_user) {
if ($current_user->guid == $container_guid || $current_user->isAdmin()) {
$show_only_published = false;
}
}
if ($show_only_published) {
$options['metadata_name_value_pairs'] = array(array('name' => 'status', 'value' => 'published'));
}
$list = elgg_list_entities_from_metadata($options);
if (!$list) {
$return['content'] = elgg_echo('blog:none');
} else {
$return['content'] = $list;
}
return $return;
}
示例6: groups_search_page
function groups_search_page()
{
elgg_push_breadcrumb(elgg_echo('search'));
$tag = get_input("tag");
$title = elgg_echo('groups:search:title', array($tag));
// groups plugin saves tags as "interests" - see groups_fields_setup() in start.php
$params = array('metadata_name' => 'interests', 'metadata_value' => $tag, 'type' => 'group', 'full_view' => false, 'no_results' => elgg_echo('groups:search:none'));
$content = elgg_list_entities_from_metadata($params);
$sidebar = elgg_view('groups/sidebar/find');
$sidebar .= elgg_view('groups/sidebar/featured');
$params = array('content' => $content, 'sidebar' => $sidebar, 'filter' => false, 'title' => $title);
$body = elgg_view_layout('content', $params);
echo elgg_view_page($title, $body);
}
示例7: am_list_entities_by_container_or_tag
/**
* Custom function to grab entities belonging to a container OR a tag
*/
function am_list_entities_by_container_or_tag($options)
{
if ($options['container_guid']) {
$container_sql = "e.container_guid IN ({$options['container_guid']})";
}
if ($options['tag']) {
$access_sql = get_access_sql_suffix('tag_meta_table');
$tag_sql = "\n\t\t\t(\n\t\t\t\t(tag_msn.string IN ('tags')) AND ( BINARY tag_msv.string IN ('{$options['tag']}')) \n\t\t\t\tAND\n\t\t\t\t{$access_sql}\n\t\t\t)\n\t\t";
}
$subtypes = is_array($options['subtypes']) ? $options['subtypes'] : array();
$limit = $options['limit'] === NULL ? 10 : $options['limit'];
$offset = $options['offset'] === NULL ? 0 : $options['offset'];
$title = $options['title'] === NULL ? 'Custom Module' : $options['title'];
global $CONFIG;
// As long as we have either a container_guid or a tag, use the $wheres
if ($container_sql || $tag_sql) {
$joins[] = "JOIN {$CONFIG->dbprefix}metadata tag_meta_table on e.guid = tag_meta_table.entity_guid";
$joins[] = "JOIN {$CONFIG->dbprefix}metastrings tag_msn on tag_meta_table.name_id = tag_msn.id";
$joins[] = "JOIN {$CONFIG->dbprefix}metastrings tag_msv on tag_meta_table.value_id = tag_msv.id";
// Need to watch the brackets here..
$wheres[] = "\n\t\t\t(\n\t\t\t\t{$container_sql}\n\t\t\t\tOR\n\t\t\t\t{$tag_sql}\n\t\t\t)\n\t\t";
}
// Not sure if I still need this one..
elgg_push_context('search');
// Don't display metadata menu
elgg_push_context('widgets');
$params = array('type' => 'object', 'subtypes' => $subtypes, 'joins' => $joins, 'wheres' => $wheres, 'full_view' => FALSE, 'limit' => $limit, 'offset' => $offset, 'owner_guids' => $options['owner_guids'], 'created_time_upper' => $options['created_time_upper'], 'created_time_lower' => $options['created_time_lower'], 'count' => $options['count']);
if ($options['count']) {
$entities = elgg_get_entities_from_metadata($params);
echo $entities;
} else {
$entities = elgg_list_entities_from_metadata($params);
if ($entities) {
return $entities;
} else {
return "<div style='width: 100%; text-align: center; margin: 10px;'><strong>No results</strong></div>";
}
}
}
示例8: elgg_push_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));
break;
}
$filter = elgg_view('groups/group_sort_menu', array('selected' => $selected_tab));
$sidebar = elgg_view('groups/sidebar/find');
示例9: gatekeeper
<?php
/**
* Elgg sent messages page
*
* @package ElggMessages
*/
gatekeeper();
$page_owner = elgg_get_page_owner_entity();
if (!$page_owner || !$page_owner->canEdit()) {
$guid = 0;
if ($page_owner) {
$guid = $page_owner->getGUID();
}
register_error(elgg_echo("pageownerunavailable", array($guid)));
forward();
}
elgg_push_breadcrumb(elgg_echo('messages:sent'));
elgg_register_title_button();
$title = elgg_echo('messages:sentmessages', array($page_owner->name));
$list = elgg_list_entities_from_metadata(array('type' => 'object', 'subtype' => 'messages', 'metadata_name' => 'fromId', 'metadata_value' => elgg_get_page_owner_guid(), 'owner_guid' => elgg_get_page_owner_guid(), 'full_view' => false));
$body_vars = array('folder' => 'sent', 'list' => $list);
$content = elgg_view_form('messages/process', array(), $body_vars);
$body = elgg_view_layout('content', array('content' => $content, 'title' => $title, 'filter' => ''));
echo elgg_view_page($title, $body);
示例10: ajaxmodule_page_handler
//.........这里部分代码省略.........
}
}
$options = elgg_trigger_plugin_hook('get_options', 'river', '', $options);
// Display river
$river = elgg_list_river($options);
if (!$river) {
echo "<div style='font-weight: bold; margin-top: 10px; margin-bottom: 10px; border-top: 1px solid #aaa; width: 100%; text-align: center;'>" . elgg_echo('river:none') . "</div>";
} else {
//echo $river;
echo elgg_trigger_plugin_hook('output', 'page', array(), $river);
}
break;
case 'loadentities':
// Entity options
$options['container_guid'] = get_input('container_guid');
$options['tag'] = get_input('tag', false);
$options['tags'] = json_decode(get_input('tags', false));
$options['types'] = json_decode(get_input('types'));
$options['subtypes'] = json_decode(get_input('subtypes'));
$options['limit'] = get_input('limit', 10);
$options['offset'] = get_input('offset', 0);
$options['owner_guids'] = json_decode(get_input('owner_guids'));
$options['created_time_upper'] = get_input('created_time_upper');
$options['created_time_lower'] = get_input('created_time_lower');
$options['count'] = get_input('count', FALSE);
// Store access status
$access_status = access_get_show_hidden_status();
// Check if bypassing hidden entities
if (get_input('access_show_hidden_entities')) {
// Override
access_show_hidden_entities(true);
}
// Set 'listing type' for new simple listing if supplied
if ($listing_type = get_input('listing_type', FALSE)) {
set_input('ajaxmodule_listing_type', $listing_type);
}
// Make sure container guid isn't empty
$options['container_guid'] = !empty($options['container_guid']) ? $options['container_guid'] : ELGG_ENTITIES_ANY_VALUE;
if (get_input('restrict_tag')) {
// Grab content with supplied tags ONLY
elgg_set_context('search');
$options['type'] = 'object';
$options['full_view'] = FALSE;
// Multiple tags
if ($options['tags']) {
foreach ($options['tags'] as $tag) {
$options['metadata_name_value_pairs'][] = array('name' => 'tags', 'value' => $tag, 'operand' => '=', 'case_sensitive' => FALSE);
}
} else {
// Just one
$options['metadata_name_value_pairs'] = array(array('name' => 'tags', 'value' => $options['tag'], 'operand' => '=', 'case_sensitive' => FALSE));
unset($options['tag']);
}
unset($options['tags']);
// Let plugins decide if we want to check the container of the container as well (ie photos)
if ($options['container_guid'] && elgg_trigger_plugin_hook('check_parent_container', 'modules', $options['subtypes'], FALSE)) {
$dbprefix = elgg_get_config('dbprefix');
$cont = sanitise_int($options['container_guid']);
$options['joins'][] = "JOIN {$dbprefix}entities container_e on e.container_guid = container_e.guid";
$options['wheres'][] = "(e.container_guid in ({$cont}) OR container_e.container_guid in ({$cont}))";
unset($options['container_guid']);
}
if ($options['count']) {
$entities = elgg_get_entities_from_metadata($options);
echo $entities;
break;
} else {
$content = elgg_list_entities_from_metadata($options);
}
} else {
if (get_input('albums_images')) {
// Grab photos with tag, including photos in albums with tag
$options['full_view'] = FALSE;
$options['list_type'] = 'gallery';
$content = elgg_list_entities($options, 'am_get_entities_from_tag_and_container_tag');
} else {
if (!get_input('restrict_tag') && $options['container_guid'] != ELGG_ENTITIES_ANY_VALUE) {
// Container supplied, and not restricting tags
$options['full_view'] = FALSE;
$content = elgg_list_entities($options);
} else {
// Default to container or tag
$content = am_list_entities_by_container_or_tag($options);
}
}
}
// Display friendly message if there is no content
if (!$content) {
echo "<div style='width: 100%; text-align: center; margin: 10px;'><strong>No results</strong></div>";
} else {
echo $content;
}
break;
default:
access_show_hidden_entities($access_status);
return FALSE;
}
access_show_hidden_entities($access_status);
return TRUE;
}
示例11: elgg_extract
$widget = elgg_extract("entity", $vars);
$num_display = (int) $widget->num_display;
if ($num_display < 1) {
$num_display = 5;
}
$show_random = $widget->show_random;
$featured_options = array("type" => "group", "limit" => $num_display, "full_view" => false, "pagination" => false, "metadata_name_value_pairs" => array("featured_group" => "yes"), "order_by" => "RAND()");
if ($widget->show_members == "yes") {
$show_members = true;
} else {
$show_members = false;
}
if ($show_members) {
elgg_push_context("widgets_groups_show_members");
}
$featured = elgg_list_entities_from_metadata($featured_options);
if ($show_members) {
elgg_pop_context();
}
$random = "";
if ($show_random == "yes") {
$dbprefix = elgg_get_config("dbprefix");
$featured_id = add_metastring("featured_group");
$yes_id = add_metastring("yes");
$random_options = array("type" => "group", "limit" => 1, "order_by" => "RAND()", "wheres" => array("NOT EXISTS (\n\t\t\t\tSELECT 1 FROM {$dbprefix}metadata md\n\t\t\t\tWHERE md.entity_guid = e.guid\n\t\t\t\t\tAND md.name_id = {$featured_id}\n\t\t\t\t\tAND md.value_id = {$yes_id})"));
if ($random_groups = elgg_get_entities($random_options)) {
$group = $random_groups[0];
$title = elgg_view("output/url", array("text" => $group->name, "href" => $group->getURL()));
$icon = elgg_view_entity_icon($group, "large");
$random = elgg_view_module("main", $title, $icon, array("class" => "center"));
}
示例12: array
<?php
$options = array('type' => 'object', 'subtype' => 'showcase', 'metadata_name_value_pairs' => array('name' => 'featured', 'value' => 1), 'count' => true);
$count = elgg_get_entities_from_metadata($options);
if ($count) {
unset($options['count']);
echo elgg_list_entities_from_metadata($options);
} else {
echo elgg_echo('showcase:noresults');
}
示例13: elgg_push_context
<?php
elgg_push_context('widgets');
echo elgg_list_entities_from_metadata(array('type' => 'object', 'subtype' => 'notification', 'owner_guid' => (int) elgg_get_logged_in_user_guid(), 'order_by_metadata' => array('name' => 'status', 'direction' => 'DESC'), 'list_class' => 'elgg-list-notifier', 'full_view' => false, 'pagination' => !elgg_is_xhr()));
elgg_pop_context();
示例14: elgg_list_entities_from_relationship
$group_options['inverse_relationship'] = false;
break;
case 'featured':
$group_options['metadata_names'] = ['name' => 'featured'];
break;
case 'open':
$group_options['metadata_name_value_pairs'] = ['name' => 'membership', 'value' => ACCESS_PUBLIC];
break;
case 'closed':
$group_options['metadata_name_value_pairs'] = ['name' => 'membership', 'value' => ACCESS_PUBLIC, 'operand' => '<>'];
break;
case 'alpha':
$group_options['joins'] = ["JOIN {$dbprefix}groups_entity ge ON e.guid = ge.guid"];
$group_options['order_by'] = 'ge.name ASC';
break;
}
if (isset($group_options['relationship'])) {
$content = elgg_list_entities_from_relationship($group_options);
} else {
$content = elgg_list_entities_from_metadata($group_options);
}
if (empty($content)) {
$content = elgg_echo('groups:none');
}
$filter = elgg_view('groups/group_sort_menu', ['selected' => $selected_tab]);
$sidebar = elgg_view('groups/sidebar/find');
$sidebar .= elgg_view('groups/sidebar/featured');
// build page
$body = elgg_view_layout('content', ['content' => $content, 'sidebar' => $sidebar, 'filter' => $filter]);
// draw page
echo elgg_view_page(elgg_echo('groups:all'), $body);
示例15: elgg_view_form
}
if (elgg_is_active_plugin('messages')) {
$forms .= elgg_view_form('faker/gen_messages');
}
if (elgg_is_active_plugin('discussions')) {
$forms .= elgg_view_form('faker/gen_discussions');
}
$forms .= elgg_view_form('faker/gen_comments');
if (elgg_is_active_plugin('likes')) {
$forms .= elgg_view_form('faker/gen_likes');
}
if (elgg_is_active_plugin('countries')) {
$forms .= elgg_view_form('faker/gen_location');
}
}
$fakes = elgg_list_entities_from_metadata(array('metadata_names' => '__faker'));
$content = '<div id="faker-log">' . $fakes . '</div>';
$delete = elgg_view('output/url', array('text' => elgg_echo('faker:delete'), 'href' => 'action/faker/delete', 'confirm' => true, 'class' => 'elgg-button elgg-button-action'));
echo '<div class="clearfix">';
echo '<div class="elgg-col elgg-col-1of2">';
echo '<div class="pam">';
echo $forms;
echo '</div>';
echo '</div>';
echo '<div class="elgg-col elgg-col-1of2">';
echo '<div class="pam">';
echo elgg_view_module('aside', elgg_echo('faker:data'), $content, array('footer' => $delete));
echo '</div>';
echo '</div>';
echo '</div>';
?>