本文整理汇总了PHP中get_entities函数的典型用法代码示例。如果您正苦于以下问题:PHP get_entities函数的具体用法?PHP get_entities怎么用?PHP get_entities使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_entities函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: openid_server_delete_entities
function openid_server_delete_entities($type = "", $subtype = "", $owner_guid = 0)
{
$entities = get_entities($type, $subtype, $owner_guid, "time_created desc", 0);
foreach ($entities as $entity) {
openid_server_delete_entity($entity);
}
return true;
}
示例2: form_set_group_profile_categories
function form_set_group_profile_categories($group_profile_categories)
{
$form_config = get_entities('object', 'form:config');
if (!$form_config) {
$form_config = new ElggObject();
$form_config->subtype = 'form:config';
$form_config->owner_guid = $_SESSION['user']->getGUID();
$form_config->access_id = ACCESS_PUBLIC;
} else {
$form_config = $form_config[0];
}
$form_config->group_profile_categories = $group_profile_categories;
$form_config->save();
}
示例3: get_entities
<?php
/**
* Elgg thewire view page
*
* @package ElggTheWire
* @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
* @author Curverider <info@elgg.com>
* @copyright Curverider Ltd 2008-2009
* @link http://elgg.com/
*
*/
//grab the current site message
$site_message = get_entities("object", "sitemessage", 0, "", 1);
foreach ($site_message as $mes) {
$message = $mes->description;
$dateStamp = friendly_time($mes->time_created);
$delete = elgg_view("output/confirmlink", array('href' => $vars['url'] . "action/riverdashboard/delete?message=" . $mes->guid, 'text' => elgg_echo('delete'), 'confirm' => elgg_echo('deleteconfirm')));
}
?>
<div class="sidebarBox">
<?php
//if there is a site message
if ($site_message) {
?>
<?php
echo "<h3>" . elgg_echo("sitemessages:announcements") . "</h3>";
echo "<p><small>" . elgg_echo("sitemessages:posted") . ": " . $dateStamp;
示例4: setSWTimestampForUser
/**
* Set the last-checked value for this context to npw.
*
* @param unknown_type $guid
* @param unknown_type $context
* @return unknown
*/
function setSWTimestampForUser($guid, $context)
{
$timestamps = get_entities("object", "sw_timestamp", $guid);
$timestamp = "";
if (!empty($timestamps)) {
foreach ($timestamps as $t) {
if ($t->description == $context) {
$timestamp = $t;
break;
}
}
}
if (empty($timestamp)) {
$timestamp = new ElggObject();
$timestamp->owner_guid = $guid;
$timestamp->container_guid = $guid;
$timestamp->subtype = 'sw_timestamp';
$timestamp->access_id = 2;
$timestamp->title = "SW Timestamp";
$timestamp->description = $context;
}
$ctx = get_context();
set_context('add_sticky_widgets');
$timestamp->save();
set_context($ctx);
// $timestamp->description = time();
return $timestamp->time_updated;
}
示例5: count_user_friends_objects
/**
* Counts the number of objects owned by a user's friends
*
* @param int $user_guid The GUID of the user to get the friends of
* @param string $subtype Optionally, the subtype of objects
* @return int The number of objects
*/
function count_user_friends_objects($user_guid, $subtype = "")
{
if ($friends = get_user_friends($user_guid, $subtype, 999999, 0)) {
$friendguids = array();
foreach ($friends as $friend) {
$friendguids[] = $friend->getGUID();
}
return get_entities('object', $subtype, $friendguids, "time_created desc", $limit, $offset, true, 0, $friendguids);
}
return 0;
}
示例6: unset
if (!empty($object)) {
$object->metadata_name = $name;
if (!empty($label)) {
$object->metadata_label = $label;
} else {
unset($object->metadata_label);
}
// add relationship
remove_entity_relationships($object->guid, CUSTOM_PROFILE_FIELDS_PROFILE_TYPE_CATEGORY_RELATIONSHIP);
if (!empty($profile_types) && is_array($profile_types)) {
foreach ($profile_types as $type) {
add_entity_relationship($type, CUSTOM_PROFILE_FIELDS_PROFILE_TYPE_CATEGORY_RELATIONSHIP, $object->guid);
}
}
// add correct order
$count = get_entities("object", CUSTOM_PROFILE_FIELDS_CATEGORY_SUBTYPE, null, null, null, null, true);
if ($add) {
$object->order = $count;
}
if ($object->save()) {
system_message(elgg_echo("profile_manager:action:category:add:succes"));
} else {
register_error(elgg_echo("profile_manager:action:category:add:error:save"));
}
} else {
register_error(elgg_echo("profile_manager:action:category:add:error:object"));
}
} else {
register_error(elgg_echo("profile_manager:action:category:add:error:name"));
}
forward($_SERVER["HTTP_REFERER"]);
示例7: dirname
<?php
require_once dirname(dirname(dirname(dirname(__FILE__)))) . "/thickboxlibraries.php";
//set owner to site admin.
$owner = VAZCO_AVATAR_ADMIN;
$limit = 100;
$avatars = get_entities("object", "avatar", $owner, "", $limit, 0, false);
?>
<div class="contentWrapper">
<div id="profile_picture_croppingtool">
<label><?php
echo elgg_echo('vazco_avatar:select:description');
?>
</label>
<br/>
<?php
echo elgg_echo('vazco_avatar:select:clicktochose');
?>
<div id="tidypics_album_widget_container">
<div class="avatar_container">
<?php
$counter = -1;
echo '<div class="avatar_wrapper">';
foreach ($avatars as $avatar) {
$counter++;
if ($counter == 5) {
echo '</div><div class="avatar_wrapper">';
$counter = 0;
}
echo '<div class="avatar_box">';
echo '<div class="avatar_icon_container"><a class="thickbox" href="' . $vars['url'] . 'mod/vazco_avatar/avatar.php?file_guid=' . $avatar->guid . '&size=large"><img class="avatar_icon" src="' . $vars['url'] . 'mod/vazco_avatar/avatar.php?file_guid=' . $avatar->guid . '" border="0" class="tidypics_album_cover" alt="avatar' . $avatar->guid . '"/></a></div>';
示例8: get_input
<?php
// This page can only be run from within the Elgg framework
if (!is_callable('elgg_view')) {
exit;
}
// Get the name of the form field we need to inject into
$internalname = get_input('internalname');
if (!isloggedin()) {
exit;
}
global $SESSION;
$offset = (int) get_input('offset', 0);
$simpletype = get_input('simpletype');
$entity_types = array('object' => array('file'));
if (empty($simpletype)) {
$count = get_entities('object', 'file', $SESSION['user']->guid, '', null, null, true);
$entities = get_entities('object', 'file', $SESSION['user']->guid, '', 6, $offset);
} else {
$count = get_entities_from_metadata('simpletype', $simpletype, 'object', 'file', $SESSION['user']->guid, 6, $offset, '', 0, true);
$entities = get_entities_from_metadata('simpletype', $simpletype, 'object', 'file', $SESSION['user']->guid, 6, $offset, '', 0, false);
}
$types = get_tags(0, 10, 'simpletype', 'object', 'file', $SESSION['user']->guid);
// Echo the embed view
echo elgg_view('embed/media', array('entities' => $entities, 'internalname' => $internalname, 'offset' => $offset, 'count' => $count, 'simpletype' => $simpletype, 'limit' => 6, 'simpletypes' => $types));
示例9: get_entities
<?php
/**
* Profile Manager
*
* Group Fields list view
*
* @package profile_manager
* @author ColdTrick IT Solutions
* @copyright Coldtrick IT Solutions 2009
* @link http://www.coldtrick.com/
*/
$count = get_entities("object", CUSTOM_PROFILE_FIELDS_GROUP_SUBTYPE, 0, "", null, null, true);
$fields = get_entities("object", CUSTOM_PROFILE_FIELDS_GROUP_SUBTYPE, 0, "", $count, 0);
$ordered = array();
if ($count > 0) {
foreach ($fields as $field) {
$ordered[$field->order] = $field;
}
ksort($ordered);
}
$list = elgg_view_entity_list($ordered, $count, 0, $count, false, false, false);
?>
<div id="custom_fields_ordering" class="custom_fields_ordering_group">
<?php
echo $list;
?>
</div>
示例10: page_owner_entity
*
* @package Elgg videotizer, by iZAP Web Solutions.
* @license GNU Public License version 3
* @Contact iZAP Team "<support@izap.in>"
* @Founder Tarun Jangra "<tarun@izap.in>"
* @link http://www.izap.in/
*
*/
global $CONFIG;
$page_owner = page_owner_entity();
if ($vars['entity']->izap_videos_enable != 'no') {
echo '<div id="izap_widget_layout">';
echo '<h2>' . elgg_echo('izap_videos:groupvideos') . '</h2>';
$options['type'] = 'object';
$options['subtype'] = 'izap_videos';
$options['container_guid'] = $page_owner->guid;
if (is_old_elgg()) {
$videos = get_entities('object', 'izap_videos', $page_owner->guid);
} else {
$videos = elgg_get_entities($options);
}
if ($videos) {
echo '<div class="group_video_wrap">';
echo elgg_view('izap_videos/videos_bunch', array('videos' => $videos, 'title_length' => 30, 'wrap' => FALSE));
echo '<div class="view_all"><a href="' . $CONFIG->wwwroot . 'pg/videos/list/' . $page_owner->username . '">' . elgg_echo('izap_videos:view_all') . '</a></div>';
echo '</div>';
} else {
echo '<div class="forum_latest">' . elgg_echo('izap_videos:notfound') . '</div>';
}
echo '<div class="clearfloat"></div></div>';
}
示例11: find_plugin_settings
/**
* Shorthand function for finding the plugin settings.
*
* @param string $plugin_name Optional plugin name, if not specified then it is detected from where you
* are calling from.
*/
function find_plugin_settings($plugin_name = "")
{
$plugins = get_entities('object', 'plugin');
$plugin_name = sanitise_string($plugin_name);
if (!$plugin_name) {
$plugin_name = get_plugin_name();
}
if ($plugins) {
foreach ($plugins as $plugin) {
if (strcmp($plugin->title, $plugin_name) == 0) {
return $plugin;
}
}
}
return false;
}
示例12: list_registered_entities
/**
* Returns a viewable list of entities based on the registered types
*
* @see elgg_view_entity_list
*
* @param string $type The type of entity (eg "user", "object" etc)
* @param string $subtype The arbitrary subtype of the entity
* @param int $owner_guid The GUID of the owning user
* @param int $limit The number of entities to display per page (default: 10)
* @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
* @return string A viewable list of entities
*/
function list_registered_entities($owner_guid = 0, $limit = 10, $fullview = true, $viewtypetoggle = false, $allowedtypes = true)
{
$typearray = array();
if ($object_types = get_registered_entity_types()) {
foreach ($object_types as $object_type => $subtype_array) {
if (is_array($subtype_array) && sizeof($subtype_array) && (in_array($object_type, $allowedtypes) || $allowedtypes === true)) {
foreach ($subtype_array as $object_subtype) {
$typearray[$object_type][] = $object_subtype;
}
}
}
}
$offset = (int) get_input('offset');
$count = get_entities('', $typearray, $owner_guid, "", $limit, $offset, true);
$entities = get_entities('', $typearray, $owner_guid, "", $limit, $offset);
return elgg_view_entity_list($entities, $count, $offset, $limit, $fullview, $viewtypetoggle);
}
示例13: foreach
if ($fieldtype == CUSTOM_PROFILE_FIELDS_PROFILE_SUBTYPE || $fieldtype == CUSTOM_PROFILE_FIELDS_GROUP_SUBTYPE) {
$headers = "";
foreach ($fields as $field) {
if (!empty($headers)) {
$headers .= $fielddelimiter . " ";
}
$headers .= $field;
}
echo $headers . PHP_EOL;
if ($fieldtype == CUSTOM_PROFILE_FIELDS_PROFILE_SUBTYPE) {
$type = "user";
} else {
$type = "group";
}
$entities_count = get_entities($type, "", null, null, null, null, true);
$entities = get_entities($type, "", null, null, $entities_count);
foreach ($entities as $entity) {
$row = "";
foreach ($fields as $field) {
if (!empty($row)) {
$row .= $fielddelimiter . " ";
}
$field_data = $entity->{$field};
if (is_array($field_data)) {
$field_data = implode(",", $field_data);
}
$row .= utf8_decode($field_data);
}
echo $row . PHP_EOL;
}
}
示例14: action_gatekeeper
*
* Action to import from default
*
* @package profile_manager
* @author ColdTrick IT Solutions
* @copyright Coldtrick IT Solutions 2009
* @link http://www.coldtrick.com/
*/
global $CONFIG;
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";
示例15: defaultwidgets_reset_access
function defaultwidgets_reset_access($event, $object_type, $object)
{
global $defaultwidget_access;
// turn on permissions override
$defaultwidget_access = true;
// the widgets are disabled, so turn on the ability to see disabled entities
$access_status = access_get_show_hidden_status();
access_show_hidden_entities(true);
$widgets = get_entities('object', 'widget', $object->getGUID());
if ($widgets) {
foreach ($widgets as $widget) {
$widget->access_id = get_default_access();
$widget->save();
}
}
access_show_hidden_entities($access_status);
// turn off permissions override
$defaultwidget_access = false;
return true;
}