本文整理汇总了PHP中get_entities_from_metadata函数的典型用法代码示例。如果您正苦于以下问题:PHP get_entities_from_metadata函数的具体用法?PHP get_entities_from_metadata怎么用?PHP get_entities_from_metadata使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_entities_from_metadata函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testElggGetEntitiesFromMetadata
public function testElggGetEntitiesFromMetadata()
{
global $CONFIG, $METASTRINGS_CACHE, $METASTRINGS_DEADNAME_CACHE;
$METASTRINGS_CACHE = $METASTRINGS_DEADNAME_CACHE = array();
$this->object->title = 'Meta Unit Test';
$this->object->save();
$this->create_metastring('metaUnitTest');
$this->create_metastring('tested');
// create_metadata returns id of metadata on success
$this->assertTrue(create_metadata($this->object->guid, 'metaUnitTest', 'tested'));
// check value with improper case
$options = array('metadata_names' => 'metaUnitTest', 'metadata_values' => 'Tested', 'limit' => 10, 'metadata_case_sensitive' => TRUE);
$this->assertFalse(elgg_get_entities_from_metadata($options));
// compare forced case with ignored case
$options = array('metadata_names' => 'metaUnitTest', 'metadata_values' => 'tested', 'limit' => 10, 'metadata_case_sensitive' => TRUE);
$case_true = elgg_get_entities_from_metadata($options);
$this->assertIsA($case_true, 'array');
$options = array('metadata_names' => 'metaUnitTest', 'metadata_values' => 'Tested', 'limit' => 10, 'metadata_case_sensitive' => FALSE);
$case_false = elgg_get_entities_from_metadata($options);
$this->assertIsA($case_false, 'array');
$this->assertIdentical($case_true, $case_false);
// check deprecated get_entities_from_metadata() function
$deprecated = get_entities_from_metadata('metaUnitTest', 'tested', '', '', 0, 10, 0, '', 0, FALSE, TRUE);
$this->assertIdentical($deprecated, $case_true);
// check entity list
//$this->dump(list_entities_from_metadata('metaUnitTest', 'Tested', '', '', 0, 10, TRUE, TRUE, TRUE, FALSE));
// clean up
$this->delete_metastrings();
$this->object->delete();
}
示例2: pages_draw_child
function pages_draw_child($childentity, $path)
{
$child = "\n\t\t{\n";
$child .= "\t\t\t\"text\": \"<a href=\\\"{$childentity->getURL()}\\\">" . addslashes($childentity->title) . "</a>\"\n";
$extras = "";
$haschild = get_entities_from_metadata('parent_guid', $childentity->guid, '', '', 0, 9999);
if ($haschild) {
if (in_array($childentity->guid, $path)) {
$extras .= "\t\t\t,\"expanded\": true";
$extras .= "\t\t\t,\"children\": [\n";
$childstring = "";
foreach ($haschild as $subchild) {
$childstringtemp = pages_draw_child($subchild, $path);
if (!empty($childstringtemp)) {
if (!empty($childstring)) {
$childstring .= ", ";
}
$childstring .= $childstringtemp;
}
}
$extras .= $childstring . "\n\t\t\t]\n";
} else {
$extras .= ",\t\t\t\"id\": \"{$childentity->getGUID()}\",\n\t\t\t\"hasChildren\": true\n";
}
}
$child .= $extras . "\t\t}";
return $child;
}
示例3: get_entities_from_metadata
$lc++;
} */
}
}
}
?>
</div> </div> </div> </div>
<div class="clearfloat"></div>
</div>
</td>
<td id="RightPane" valign="top" width="22%" style="padding:20px 20px 10px 20px;height:100%;">
<!-- RightPane -->
<?php
$profs = get_entities_from_metadata('issimpleuser', 'yes', 'user', '', '', 5);
?>
<div class="index_box2">
<h2><?php
echo "Latest Users";
?>
</h2>
<div class="contentWrapper">
<?php
echo "<b><font color=\"gray\">There are currently " . $user_count . " registered users</font></b>";
?>
</div>
示例4: elgg_echo
* http://radagast.biz
*
* Displays existing search definitions
*
*/
$edit_msg = elgg_echo('form:edit');
$delete_msg = elgg_echo('form:delete');
$delete_confirm_msg = elgg_echo('form:search_definition_delete_confirm');
$search_page = elgg_echo('form:search_page_link');
$img_template = '<img border="0" width="16" height="16" alt="%s" title="%s" src="' . $CONFIG->wwwroot . 'mod/form/images/%s" />';
$edit_img = sprintf($img_template, $edit_msg, $edit_msg, "16-em-pencil.png");
$delete_img = sprintf($img_template, $delete_msg, $delete_msg, "16-em-cross.png");
$sd_template = <<<END
<a href="{$CONFIG->wwwroot}mod/form/manage_search_definition.php?sid=%s">{$edit_img}</a> |
<a onclick="return confirm('{$delete_confirm_msg}')" href="{$CONFIG->wwwroot}action/form/manage_search_definition?form_action=delete&sid=%s">{$delete_img}</a> |
<a href="{$CONFIG->wwwroot}mod/form/search.php?sid=%s">{$search_page}</a> %s (%s)
<br />
END;
$body = '<div class="contentWrapper">';
$form_id = get_input('form_id', 0);
$sds = get_entities_from_metadata('form_id', $form_id, 'object', 'form:search_definition');
if ($sds) {
foreach ($sds as $sd) {
$ident = $sd->getGUID();
$body .= sprintf($sd_template, $ident, $ident, $ident, $sd->title, $sd->internalname);
}
} else {
$body .= '<p>' . elgg_echo('form:no_search_definitions') . '</p>';
}
$body .= '</div>';
print $body;
示例5: get_input
<?php
$page = get_input('page');
if ($page = get_entity($page)) {
if ($page->canEdit()) {
// Bring all child elements forward
$parent = $page->parent_guid;
if ($children = get_entities_from_metadata('parent_guid', $page->getGUID())) {
foreach ($children as $child) {
$child->parent_guid = $parent;
}
}
if ($page->delete()) {
system_message(elgg_echo('pages:delete:success'));
if ($parent) {
if ($parent = get_entity($parent)) {
forward($parent->getURL());
exit;
}
}
forward('pg/pages/owned/' . $_SESSION['user']->username);
exit;
}
}
}
register_error(elgg_echo('pages:delete:failure'));
forward($_SERVER['HTTP_REFERER']);
示例6: form_get_profile_config
function form_get_profile_config($category, $type = 'group')
{
if ($category) {
$profile_config = get_entities_from_metadata('category', $category, 'object', 'form:profile_config');
if ($profile_config) {
return $profile_config[0];
} else {
$profile_config = new ElggObject();
$profile_config->subtype = 'form:profile_config';
$profile_config->owner_guid = 0;
$profile_config->access_id = ACCESS_PUBLIC;
$profile_config->category = $category;
if ($profile_config->save()) {
return $profile_config;
}
}
}
return null;
}
示例7: elgg_view_title
// admin_gatekeeper();
// set the title
$title = "CREATE AND DISPLAY CSV";
// start building the main column of the page
$area2 = elgg_view_title($title);
// Add the form to this section
global $CONFIG;
/*
$area2 .="<div class=\"filerepo_download\"><p><a href=\"";
$area2 .=$vars['url'];
$area2 .=$ourFileName;
$area2 .="\">";
$area2 .=elgg_echo("file:download");
$area2 .="</a></p></div>";
*/
$members = get_entities_from_metadata('issimpleuser', 'no', 'user', '', '', 10000);
set_time_limit(360000);
$stats_single = "GUID|SESAME|CREATOR|AFFILIATION|TITLE|RESOURCE LANGUAGE|METADATA LANGUAGE|DATE|CITATION|EDUCATIONAL DESCRIPTION|TECHNICAL DESCRIPTION|EDUCATIONAL CONTEXT|EDUCATIONAL INSTRUCTIONS|EDUCATIONAL OBJECTIVES|ASSESSMENT METHODS|EDUCATIONAL PREREQUISITES\r\n";
$stats_ident = "GUID|COUNT|Description1|Description2|Description3|Description4|Description5|Description6|Description7|Description8|Description9|Description10 \r\n";
$stats_rights = "GUID|IPR1|IPR2 \r\n";
$stats_qual = "GUID|COUNT|VALUE1|VALUE2|VALUE3 \r\n";
$stats_auth = "GUID|COUNT|NAME1|AFFIL1|FOAF1|NAME2|AFFIL2|FOAF2|NAME3|AFFIL3|FOAF3|NAME4|AFFIL4|FOAF4|NAME5|AFFIL5|FOAF5 \r\n ";
$stats_media = "GUID|COUNT|VALUE1|VALUE2|VALUE3|VALUE4|VALUE5|VALUE6|VALUE7|VALUE8|VALUE9|VALUE10 \r\n";
$stats_outc = "GUID|COUNT|VALUE1|VALUE2|VALUE3|VALUE4|VALUE5|VALUE6|VALUE7|VALUE8|VALUE9|VALUE10 \r\n";
$stats_res = "GUID|COUNT|VALUE1|VALUE2|VALUE3|VALUE4|VALUE5|VALUE6|VALUE7|VALUE8|VALUE9|VALUE10 \r\n";
$stats_edulev = "GUID|COUNT|VALUE1|VALUE2|VALUE3|VALUE4|VALUE5|VALUE6|VALUE7|VALUE8|VALUE9|VALUE10 \r\n";
$stats_compan = "GUID|COUNT|VALUE1|VALUE2|VALUE3|VALUE4|VALUE5|VALUE6|VALUE7|VALUE8|VALUE9|VALUE10 \r\n";
$stats_key = "GUID|COUNT|VALUE1|ONTOLOGY1|VALUE2|ONTOLOGY2|VALUE3|ONTOLOGY3|VALUE4|ONTOLOGY4|VALUE5|ONTOLOGY5|VALUE6|ONTOLOGY6|VALUE7|ONTOLOGY7|VALUE8|ONTOLOGY8|VALUE9|ONTOLOGY9|VALUE10|ONTOLOGY10|VALUE11|ONTOLOGY11|VALUE12|ONTOLOGY12 \r\n";
$stats_disc = "GUID|COUNT|VALUE1|ONTOLOGY1|VALUE2|ONTOLOGY2|VALUE3|ONTOLOGY3|VALUE4|ONTOLOGY4|VALUE5|ONTOLOGY5|VALUE6|ONTOLOGY6|VALUE7|ONTOLOGY7|VALUE8|ONTOLOGY8|VALUE9|ONTOLOGY9|VALUE10|ONTOLOGY10 \r\n";
$stats_spec = "GUID|COUNT|VALUE1|ONTOLOGY1|VALUE2|ONTOLOGY2|VALUE3|ONTOLOGY3|VALUE4|ONTOLOGY4|VALUE5|ONTOLOGY5|VALUE6|ONTOLOGY6|VALUE7|ONTOLOGY7|VALUE8|ONTOLOGY8|VALUE9|ONTOLOGY9|VALUE10|ONTOLOGY10 \r\n";
$stats_par = "GUID|COUNT|PARENT1|PARENT2|PARENT3|PARENT4|PARENT5|PARENT6|PARENT7|PARENT8|PARENT9|PARENT10 \r\n";
示例8: action_gatekeeper
action_gatekeeper();
admin_gatekeeper();
$type = get_input("type", "profile");
if ($type == "profile" || $type == "group") {
$added = 0;
$defaults = array();
$max_fields = get_entities("object", "custom_" . $type . "_field", $CONFIG->site_guid, null, null, null, true) + 1;
if ($type == "profile") {
// Profile defaults
$defaults = array('description' => 'longtext', 'briefdescription' => 'text', 'location' => 'tags', 'interests' => 'tags', 'skills' => 'tags', 'contactemail' => 'email', 'phone' => 'text', 'mobile' => 'text', 'website' => 'url');
} elseif ($type == "group") {
// Group defaults
$defaults = array('description' => 'longtext', 'briefdescription' => 'text', 'interests' => 'tags', 'website' => 'url');
}
foreach ($defaults as $metadata_name => $metadata_type) {
$count = get_entities_from_metadata("metadata_name", $metadata_name, "object", "custom_" . $type . "_field", $CONFIG->site_guid, "", null, null, null, true);
if ($count == 0) {
$field = new ElggObject();
$field->owner_guid = $CONFIG->site_guid;
$field->container_guid = $CONFIG->site_guid;
$field->access_id = ACCESS_PUBLIC;
$field->subtype = "custom_" . $type . "_field";
$field->save();
$field->metadata_name = $metadata_name;
$field->metadata_type = $metadata_type;
if ($type == "profile") {
$field->show_on_register = "no";
$field->mandatory = "no";
$field->user_editable = "yes";
}
$field->order = $max_fields;
示例9: action_gatekeeper
* @package profile_manager
* @author ColdTrick IT Solutions
* @copyright Coldtrick IT Solutions 2009
* @link http://www.coldtrick.com/
*/
action_gatekeeper();
admin_gatekeeper();
$guid = get_input("guid");
if (!empty($guid)) {
$entity = get_entity($guid);
if ($entity->getSubtype() == CUSTOM_PROFILE_FIELDS_PROFILE_TYPE_SUBTYPE) {
if ($entity->delete()) {
$meta_name = "custom_profile_type";
// remove corresponding profile type metadata from userobjects
$entities_count = get_entities_from_metadata($meta_name, $guid, "user", "", null, null, null, null, null, true);
$entities = get_entities_from_metadata($meta_name, $guid, "user", "", null, $entities_count);
foreach ($entities as $entity) {
// unset currently deleted profile type for user
unset($entity->{$meta_name});
}
system_message(elgg_echo("profile_manager:action:profile_types:delete:succes"));
} else {
register_error(elgg_echo("profile_manager:action:profile_types:delete:error:delete"));
}
} else {
register_error(elgg_echo("profile_manager:action:profile_types:delete:error:type"));
}
} else {
register_error(elgg_echo("profile_manager:action:profile_types:delete:error:guid"));
}
forward($_SERVER["HTTP_REFERER"]);
示例10: array
} else {
if ($form_view == 'mine') {
$user_guid = $user->getGUID();
} else {
if ($form_view == 'friends') {
// handles up to 5000 friends
$friends = $user->getFriends("", 5000);
$user_guid = array();
if ($friends) {
foreach ($friends as $friend) {
$user_guid[] = $friend->getGUID();
}
}
} else {
if ($form_view == 'all') {
$user_guid = 0;
}
}
}
if (!is_array($user_guid) || count($user_guid) > 0) {
$count = get_entities_from_metadata('form_id', $form_id, 'object', 'form_data', $user_guid, $limit, $offset, "", 0, true);
$entities = get_entities_from_metadata('form_id', $form_id, 'object', 'form_data', $user_guid, $limit, $offset, "", 0, false);
}
}
if ($entities) {
echo '<div class="form_listing">';
echo form_view_entity_list($entities, $form, $count, $offset, $limit, false, true);
echo '</div>';
} else {
echo elgg_echo('form:no_search_results');
}
示例11: siteaccess_users
function siteaccess_users($meta_name, $meta_value, $limit = 10, $offset = 0)
{
if (isset($meta_name) && isset($meta_value)) {
$entities = get_entities_from_metadata($meta_name, $meta_value, 'user', '', 0, $limit, $offset, '', 0);
}
return $entities;
}
示例12: list_entities_from_metadata
/**
* Return a list of entities suitable for display based on the given search criteria.
*
* @see elgg_view_entity_list
*
* @param mixed $meta_name Metadata name to search on
* @param mixed $meta_value The value to match, optionally
* @param string $entity_type The type of entity to look for, eg 'site' or 'object'
* @param string $entity_subtype The subtype of the entity
* @param int $limit Number of entities to display per page
* @param true|false $fullview Whether or not to display the full view (default: true)
* @param true|false $viewtypetoggle Whether or not to allow users to toggle to the gallery view. Default: true
* @param true|false $pagination Display pagination? Default: true
*
* @return string A list of entities suitable for display
*/
function list_entities_from_metadata($meta_name, $meta_value = "", $entity_type = "", $entity_subtype = "", $owner_guid = 0, $limit = 10, $fullview = true, $viewtypetoggle = true, $pagination = true)
{
$offset = (int) get_input('offset');
$limit = (int) $limit;
$count = get_entities_from_metadata($meta_name, $meta_value, $entity_type, $entity_subtype, $owner_guid, $limit, $offset, "", 0, true);
$entities = get_entities_from_metadata($meta_name, $meta_value, $entity_type, $entity_subtype, $owner_guid, $limit, $offset, "", 0, false);
return elgg_view_entity_list($entities, $count, $offset, $limit, $fullview, $viewtypetoggle, $pagination);
}
示例13: action_gatekeeper
*/
global $CONFIG;
action_gatekeeper();
admin_gatekeeper();
$n = 0;
$skipped = 0;
$max_fields = get_entities("object", CUSTOM_PROFILE_FIELDS_PROFILE_SUBTYPE, $CONFIG->site_guid, null, null, null, true) + 1;
while ($translation = get_plugin_setting("admin_defined_profile_{$n}", 'profile')) {
$metadata_name = "admin_defined_profile_{$n}";
$metadata_label = $translation;
$type = get_plugin_setting("admin_defined_profile_type_{$n}", 'profile');
if (empty($type)) {
$type = 'text';
}
$metadata_type = $type;
$count = get_entities_from_metadata("metadata_name", $metadata_name, "object", CUSTOM_PROFILE_FIELDS_PROFILE_SUBTYPE, $CONFIG->site_guid, "", null, null, null, true);
if ($count == 0) {
$field = new ProfileManagerCustomProfileField();
$field->save();
$field->metadata_name = $metadata_name;
$field->metadata_label = $metadata_label;
$field->metadata_type = $metadata_type;
$field->show_on_register = "no";
$field->mandatory = "no";
$field->order = $max_fields;
$field->save();
$max_fields++;
} else {
$skipped++;
}
$n++;
示例14: header
* Beechat
*
* @package beechat
* @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
* @author Beechannels <contact@beechannels.com>
* @copyright Beechannels 2007-2010
* @link http://beechannels.com/
*/
header('Content-type: application/json');
gatekeeper();
error_log("beechat:get_statuses");
$usernames = get_input('beechat_roster_items_usernames');
if (!empty($usernames)) {
$iconSize = 'small';
$rosterItemsUsernames = explode(',', $usernames);
$userFriendsEntities = $_SESSION['user']->getFriends('', 1000000000, 0);
$res = array();
foreach ($rosterItemsUsernames as $value) {
foreach ($userFriendsEntities as $friend) {
if (strtolower($friend->username) == strtolower($value)) {
$status = get_entities_from_metadata("state", "current", "object", "status", $friend->get('guid'));
$res[$value] = $status != false ? $status[0]->description : '';
break;
}
}
}
echo json_encode($res);
} else {
echo json_encode(null);
}
exit;
示例15: get_entities
/**
* Profile Manager
*
* Admin stats view
*
* @package profile_manager
* @author ColdTrick IT Solutions
* @copyright Coldtrick IT Solutions 2009
* @link http://www.coldtrick.com/
*/
$total_users = get_entities("user", "", null, null, null, null, true);
$profile_types_count = get_entities("object", CUSTOM_PROFILE_FIELDS_PROFILE_TYPE_SUBTYPE, null, null, null, null, true);
$profile_entities = get_entities("object", CUSTOM_PROFILE_FIELDS_PROFILE_TYPE_SUBTYPE, null, null, $profile_types_count);
$profile_listing = "";
foreach ($profile_entities as $profile_type) {
$count = get_entities_from_metadata("custom_profile_type", $profile_type->guid, "user", "", null, null, null, null, null, true);
$profile_listing .= "<b>" . $profile_type->metadata_name . "</b>: " . $count . "<br />";
}
?>
<div class='contentWrapper'>
<h3 class='settings'><?php
echo elgg_echo("profile_manager:admin_stats:title");
?>
</h3>
<?php
echo elgg_echo("profile_manager:admin_stats:total");
?>
: <?php
echo $total_users;
?>