本文整理汇总了PHP中get_members_of_access_collection函数的典型用法代码示例。如果您正苦于以下问题:PHP get_members_of_access_collection函数的具体用法?PHP get_members_of_access_collection怎么用?PHP get_members_of_access_collection使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_members_of_access_collection函数的16个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: friend_collections_message_picker_callback
function friend_collections_message_picker_callback($query, $options = array())
{
$id = sanitize_int(get_input('id'));
$guids = get_members_of_access_collection($id, true);
// replace mysql vars with escaped strings
$q = str_replace(array('_', '%'), array('\\_', '\\%'), $query);
if (!$guids || !$id) {
return array();
}
$dbprefix = elgg_get_config('dbprefix');
return elgg_get_entities(array('type' => 'user', 'joins' => array("JOIN {$dbprefix}users_entity ue ON ue.guid = e.guid", "JOIN {$dbprefix}access_collection_membership acm ON acm.user_guid = e.guid"), 'wheres' => array("ue.username LIKE '%{$q}%' OR ue.name LIKE '%{$q}%'", "acm.access_collection_id = {$id}"), 'order_by' => 'ue.name ASC'));
}
开发者ID:arckinteractive,项目名称:friend_collections_message,代码行数:12,代码来源:start.php
示例2: ws_pack_created_river_event_handler
/**
* Send push notifications if event is added to the activity river
*
* @param string $event name of the event
* @param string $type type of the event
* @param ElggRiverItem $river_item river item object
*
* @return void
*/
function ws_pack_created_river_event_handler($event, $type, $river_item)
{
if (!empty($river_item) && $river_item instanceof ElggRiverItem) {
if (!function_exists('str_get_html')) {
elgg_load_library("simple_html_dom");
}
$message = "";
$html_view = elgg_view_river_item($river_item);
if ($res = str_get_html($html_view)) {
// get the river summary
if ($summary_element = $res->find("div.elgg-river-summary")) {
$summary_element = $summary_element[0];
$text = $summary_element->innertext();
list($left, $right) = explode("<span class=\"elgg-river-timestamp\">", $text);
$message = trim(elgg_strip_tags($left));
}
}
if (!empty($message)) {
$user_guids = false;
switch ($river_item->access_id) {
case ACCESS_PRIVATE:
// do nothing
break;
case ACCESS_PUBLIC:
case ACCESS_LOGGED_IN:
// notify everyone
$site_user_options = array("type" => "user", "limit" => false, "relationship" => "member_of_site", "relationship_guid" => elgg_get_site_entity()->getGUID(), "inverse_relationship" => true, "callback" => "ws_pack_row_to_guid");
$user_guids = elgg_get_entities_from_relationship($site_user_options);
break;
case ACCESS_FRIENDS:
// notify friends of subject_guid
$friends_options = array("type" => "user", "limit" => false, "relationship" => "friend", "relationship_guid" => $river_item->subject_guid, "callback" => "ws_pack_row_to_guid", "joins" => array("JOIN " . elgg_get_config("dbprefix") . "entity_relationships r2 ON e.guid = r2.guid_one"), "wheres" => array("(r2.relationship = 'member_of_site' AND r2.guid_two = " . elgg_get_site_entity()->getGUID() . ")"));
$user_guids = elgg_get_entities_from_relationship($friends_options);
break;
default:
// probably some acl, so notify members of the acl
$user_guids = get_members_of_access_collection($river_item->access_id, true);
break;
}
// we found potential interested users, so push
if (!empty($user_guids) && is_array($user_guids)) {
$api_application_options = array("type" => "object", "subtype" => APIApplication::SUBTYPE, "limit" => false, "annotation_name" => "push_notification_service");
if ($api_applications = elgg_get_entities_from_annotations($api_application_options)) {
foreach ($api_applications as $api_application) {
$api_application->sendPushNotification($message, $user_guids);
}
}
}
}
}
}
开发者ID:lorea,项目名称:Hydra-dev,代码行数:60,代码来源:events.php
示例3: groups_read_acl_plugin_hook
/**
* Hook to listen to read access control requests and return all the groups you are a member of.
*/
function groups_read_acl_plugin_hook($hook, $entity_type, $returnvalue, $params)
{
//error_log("READ: " . var_export($returnvalue));
$user = elgg_get_logged_in_user_entity();
if ($user) {
// Not using this because of recursion.
// Joining a group automatically add user to ACL,
// So just see if they're a member of the ACL.
//$membership = get_users_membership($user->guid);
$members = get_members_of_access_collection($group->group_acl);
print_r($members);
exit;
if ($membership) {
foreach ($membership as $group) {
$returnvalue[$user->guid][$group->group_acl] = elgg_echo('groups:group') . ": " . $group->name;
}
return $returnvalue;
}
}
}
开发者ID:duanhv,项目名称:mdg-social,代码行数:23,代码来源:start.php
示例4: dirname
<?php
/**
* Elgg add a collection of friends
*
* @package Elgg
* @subpackage Core
* @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
* @author Curverider Ltd
* @copyright Curverider Ltd 2008-2009
* @link http://elgg.org/
*/
// Start engine
require_once dirname(dirname(__FILE__)) . "/engine/start.php";
// You need to be logged in for this one
gatekeeper();
//set the title
$area1 = elgg_view_title(elgg_echo('friends:collectionedit'), false);
//grab the collection id passed to the edit form
$collection_id = get_input('collection');
//get the full collection
$collection = get_access_collection($collection_id);
//get all members of the collection
$collection_members = get_members_of_access_collection($collection_id);
$area2 = elgg_view('friends/forms/edit', array('collection' => $collection, 'collection_members' => $collection_members));
// Format page
$body = elgg_view_layout('two_column_left_sidebar', $area1 . $area2);
// Draw it
page_draw(elgg_echo('friends:add'), $body);
开发者ID:eokyere,项目名称:elgg,代码行数:29,代码来源:edit.php
示例5: foreach
foreach ($NOTIFICATION_HANDLERS as $method => $foo) {
$notify = "notify{$method}";
$metaname = "collections_notifications_preferences_{$method}";
$collections_preferences = $user->{$metaname};
if (!$collections_preferences) {
continue;
}
if (!is_array($collections_preferences)) {
$collections_preferences = array($collections_preferences);
}
foreach ($collections_preferences as $collection_id) {
// check the all friends notifications
if ($collection_id == -1) {
$options = array('relationship' => 'friend', 'relationship_guid' => $user->guid, 'limit' => 0);
$friends = elgg_get_entities_from_relationship($options);
foreach ($friends as $friend) {
if (!check_entity_relationship($user->guid, $notify, $friend->guid)) {
add_entity_relationship($user->guid, $notify, $friend->guid);
}
}
} else {
$members = get_members_of_access_collection($collection_id, TRUE);
foreach ($members as $member) {
if (!check_entity_relationship($user->guid, $notify, $members)) {
add_entity_relationship($user->guid, $notify, $member);
}
}
}
}
}
}
开发者ID:duanhv,项目名称:mdg-social,代码行数:31,代码来源:2010071002.php
示例6: dirname
* @link http://elgg.org/
*/
// Load Elgg engine
require_once dirname(dirname(__FILE__)) . "/engine/start.php";
global $CONFIG;
// Get callback type (list or picker)
$type = get_input('type', 'picker');
// Get list of members if applicable
/*$members = get_input('members','');
if (!empty($members)) {
$members = explode(',',$members);
} else {
$members = array();
}*/
$collection = (int) get_input('collection', 0);
$members = get_members_of_access_collection($collection, true);
if (!$members) {
$members = array();
}
$friendspicker = (int) get_input('friendspicker', 0);
// Get page owner (bomb out if there isn't one)
$pageowner = page_owner_entity();
if (!$pageowner) {
forward();
exit;
}
// Depending on the view type, launch a different view
switch ($type) {
case 'list':
$js_segment = elgg_view('friends/tablelistcountupdate', array('friendspicker' => $friendspicker, 'count' => sizeof($members)));
$content = elgg_view('friends/tablelist', array('entities' => $members, 'content' => $js_segment));
开发者ID:eokyere,项目名称:elgg,代码行数:31,代码来源:pickercallback.php
示例7: elgg_view_access_collections
/**
* Displays a user's access collections, using the core/friends/collections view
*
* @param int $owner_guid The GUID of the owning user
*
* @return string A formatted rendition of the collections
* @todo Move to the friends/collection.php page.
* @access private
*/
function elgg_view_access_collections($owner_guid)
{
if ($collections = get_user_access_collections($owner_guid)) {
$user = get_user($owner_guid);
if ($user) {
$entities = $user->getFriends(array('limit' => 0));
} else {
$entities = array();
}
foreach ($collections as $key => $collection) {
$collections[$key]->members = get_members_of_access_collection($collection->id, true);
$collections[$key]->entities = $entities;
}
}
return elgg_view('core/friends/collections', array('collections' => $collections));
}
开发者ID:gzachos,项目名称:elgg_ellak,代码行数:25,代码来源:views.php
示例8: elgg_view
if (elgg_is_admin_logged_in()) {
$form_data .= elgg_view("input/checkbox", array("name" => "all_users", "value" => "yes"));
$form_data .= elgg_echo("group_tools:group:invite:users:all");
}
$form_data .= "</div>";
}
if ($invite_circle == "yes") {
$tabs["circle"] = array("text" => elgg_echo("friends:collections"), "href" => "#", "rel" => "users", "priority" => 400, "onclick" => "group_tools_group_invite_switch_tab(\"circle\");");
$form_data .= "<div id='group_tools_group_invite_circle' class='mbm'>";
$form_data .= "<p>" . elgg_echo("collections_circle_selection") . "</p>";
$content = get_user_access_collections(elgg_get_logged_in_user_guid());
$collection_id = get_user_access_collections(elgg_get_logged_in_user_guid());
$form_data .= '<select class="form-control" id="user_guid[]" name="user_guid[]">
<option value="">---</option>';
foreach ($content as $key => $collection) {
$collections = get_members_of_access_collection($collection->id, true);
$form_data .= "<option value=";
$coll_members = array();
foreach ($collections as $key => $value) {
$name = get_user($value);
$coll_members[] = $name->guid;
}
$form_data .= implode(',', $coll_members);
if ($collection->id == $collection_id) {
$form_data .= ' selected="selected"';
}
$form_data .= '> ';
$form_data .= ' ' . $collection->name . '</option>';
$form_data .= '<br>';
}
$form_data .= '</select>';
开发者ID:smellems,项目名称:wet4,代码行数:31,代码来源:invite.php
示例9: update_access_collection
/**
* Updates the membership in an access collection.
*
* @warning Expects a full list of all members that should
* be part of the access collection
*
* @note This will run all hooks associated with adding or removing
* members to access collections.
*
* @param int $collection_id The ID of the collection.
* @param array $members Array of member GUIDs
*
* @return bool
* @link http://docs.elgg.org/Access/Collections
* @see add_user_to_access_collection()
* @see remove_user_from_access_collection()
*/
function update_access_collection($collection_id, $members)
{
global $CONFIG;
$acl = get_access_collection($collection_id);
if (!$acl) {
return false;
}
$members = is_array($members) ? $members : array();
$cur_members = get_members_of_access_collection($collection_id, true);
$cur_members = is_array($cur_members) ? $cur_members : array();
$remove_members = array_diff($cur_members, $members);
$add_members = array_diff($members, $cur_members);
$result = true;
foreach ($add_members as $guid) {
$result = $result && add_user_to_access_collection($guid, $collection_id);
}
foreach ($remove_members as $guid) {
$result = $result && remove_user_from_access_collection($guid, $collection_id);
}
return $result;
}
开发者ID:remy40,项目名称:gvrs,代码行数:38,代码来源:access.php
示例10: aga_page_handler
/**
* main page handler
*/
function aga_page_handler($page, $handler)
{
if ($page[0] == 'group') {
$guid = $page[1];
$db_prefix = elgg_get_config('dbprefix');
//username
if ($page[3]) {
$person = get_user_by_username($page[3]);
if (elgg_instanceof($person, 'user')) {
$persons = array($person->guid);
$membername = $person->name;
}
}
$group = get_entity($guid);
if (elgg_instanceof($group, 'group')) {
$addtitle = "";
switch ($page[2]) {
case 'ingroup':
aga_tabs($handler, $guid, 'ingroup');
$options['joins'] = array("JOIN {$db_prefix}entities e ON e.guid = rv.object_guid");
$options['wheres'] = array("e.container_guid = {$guid}");
$options['selected'] = 'ingroup';
if ($persons) {
$options['subject_guids'] = $persons;
$addtitle = " (" . elgg_echo('aga:member') . ": {$membername})";
}
$titlepart = elgg_echo('aga:ingroupactivities') . $addtitle;
//sort order, used by member stats page
if ($page[4] == 'asc') {
$options['order_by'] = 'rv.posted ASC';
}
aga_handle_activity_page($group, $page[2], $options, $titlepart);
break;
case 'outgroup':
aga_tabs($handler, $guid, 'outgroup');
$id = $group->group_acl;
$members = get_members_of_access_collection($id, TRUE);
if (!$persons) {
$options['subject_guids'] = $members;
} else {
$options['subject_guids'] = $persons;
$addtitle = " (" . elgg_echo('aga:member') . ": {$membername})";
}
//sort order, used by member stats page
if ($page[4] == 'asc') {
$options['order_by'] = 'rv.posted ASC';
}
$titlepart = elgg_echo('aga:outgroupactivities') . $addtitle;
$options['selected'] = 'outgroup';
aga_handle_activity_page($group, $page[2], $options, $titlepart);
break;
case 'members':
aga_tabs($handler, $guid, 'members');
aga_handle_members_page($group, $page[3]);
break;
case 'stats':
aga_tabs($handler, $guid, 'stats');
aga_handle_stats_page($group);
break;
default:
return false;
}
return true;
} else {
//this is not an actual group - stop right here
return false;
}
} else {
//it never even claimed to be a group so why are we even here?
return false;
}
}
开发者ID:epsylon,项目名称:Hydra-dev,代码行数:75,代码来源:functions.php
示例11: elgg_view_access_collections
/**
* Displays a user's access collections, using the friends/collections view
*
* @param int $owner_guid The GUID of the owning user
* @return string A formatted rendition of the collections
*/
function elgg_view_access_collections($owner_guid)
{
if ($collections = get_user_access_collections($owner_guid)) {
foreach ($collections as $key => $collection) {
$collections[$key]->members = get_members_of_access_collection($collection->id, true);
$collections[$key]->entities = get_user_friends($owner_guid, "", 9999);
}
}
return elgg_view('friends/collections', array('collections' => $collections));
}
开发者ID:jricher,项目名称:Elgg,代码行数:16,代码来源:access.php
示例12: register_error
if ($siteadmin_guid && elgg_is_admin_logged_in()) {
$from = $siteadmin_guid;
}
if (!$recipient_guid && !$collection_guid) {
register_error(elgg_echo("messages:user:blank"));
forward("messages/compose");
}
// Make sure the message field, send to field and title are not blank
if (!$body || !$subject) {
register_error(elgg_echo("messages:blank"));
forward("messages/compose");
}
elgg_make_sticky_form('messages');
// Send to collection of friends
if (!empty($collection_guid)) {
$collection = get_members_of_access_collection($collection_guid, false);
foreach ($collection as $member) {
if (!$member->isBanned()) {
$result += messages_send($subject, $body, $member->guid, $from, $reply, true, true);
}
}
}
if (!empty($recipient_guid)) {
$user = get_user($recipient_guid);
if (!$user) {
register_error(elgg_echo("messages:user:nonexist"));
forward("messages/compose");
}
$result = messages_send($subject, $body, $recipient_guid, $from, $reply, true, true);
}
// Save 'send' the message
开发者ID:lorea,项目名称:Hydra-dev,代码行数:31,代码来源:send.php
示例13: elgg_echo
$title = $vars['collection']->name;
$highlight = 'default';
} else {
$title = "";
$highlight = 'all';
}
echo "<div class=\"mtm\"><label>" . elgg_echo("friends:collectionname") . "<br/>";
echo elgg_view("input/text", array("name" => "collection_name", "value" => $title));
echo "</label></div>";
echo "<div>";
if ($vars['collection_members']) {
echo elgg_echo("friends:collectionfriends") . "<br />";
foreach ($vars['collection_members'] as $mem) {
echo elgg_view_entity_icon($mem, 'tiny');
echo $mem->name;
}
}
echo "</div>";
$members = get_members_of_access_collection($vars['collection']->id, true);
if (!$members) {
$members = array();
}
echo "<div><label>" . elgg_echo("friends:addfriends") . "</label>";
echo elgg_view('input/friendspicker', array('entities' => $vars['friends'], 'name' => 'friends_collection', 'value' => $members, 'highlight' => $highlight, 'collection_id' => $vars['collection']->id, 'formtarget' => $site_url . 'action/friends/collections/edit'));
echo "</div>";
echo '<div class="elgg-foot">';
if (isset($vars['collection'])) {
echo elgg_view('input/hidden', array('name' => 'collection_id', 'value' => $vars['collection']->id));
}
//echo elgg_view('input/submit', array('name' => 'submit', 'value' => elgg_echo('save'), 'class' => 'btn btn-primary'));
echo '</div>';
开发者ID:smellems,项目名称:wet4,代码行数:31,代码来源:edit.php
示例14: testAddMemberToACLRemoveMember
public function testAddMemberToACLRemoveMember()
{
// create a new user to check against
$user = new \ElggUser();
$user->username = 'access_test_user';
$user->save();
$acl_id = create_access_collection('test acl');
$result = add_user_to_access_collection($user->guid, $acl_id);
$this->assertTrue($result);
if ($result) {
$this->assertTrue($user->delete());
// since there are no more members this should return false
$acl_members = get_members_of_access_collection($acl_id, true);
$this->assertFalse($acl_members);
}
delete_access_collection($acl_id);
}
开发者ID:elgg,项目名称:elgg,代码行数:17,代码来源:ElggCoreAccessCollectionsTest.php
示例15: elgg_solr_collection_delete
/**
* Delete access collection hook
*
* @param string $hook 'access:collections:deletecollection'
* @param string $type 'collection'
* @param mixed $return Hook result
* @param array $params Hook params
* @return void
*/
function elgg_solr_collection_delete($hook, $type, $return, $params)
{
$collection_id = elgg_extract('collection_id', $params);
$members = get_members_of_access_collection($collection_id, true);
foreach ($members as $member_guid) {
elgg_solr_defer_index_update($member_guid);
}
}
开发者ID:arckinteractive,项目名称:elgg_solr,代码行数:17,代码来源:hooks.php
示例16: pleio_api_users_with_access_device_token
function pleio_api_users_with_access_device_token($river)
{
$list = array();
$subject = get_entity($river->subject_guid);
$object = get_entity($river->object_guid);
$wheres = array();
$joins = array();
// don't return same object or subject
$wheres[] = sprintf("e.guid NOT IN (%d, %d, %d, %d)", $object->guid, $object->owner_guid, $subject->guid, $subject->owner_guid);
$site_guid = $object->site_guid;
// override site_guid if object is site_guid
if ($object instanceof Subsite || $object instanceof ElggSite) {
$site_guid = $object->guid;
}
// add access_id specific wheres to determine possible receivers
$more = false;
switch ($object->access_id) {
case ACCESS_DEFAULT:
case ACCESS_LOGGED_IN:
case ACCESS_PUBLIC:
if ($object->type == "user") {
//only friends $object->guid
$more = elgg_get_entity_relationship_where_sql('e.guid', 'friend', $object->guid, 1);
} elseif ($object && $object->container_guid && $object->container_guid != $object->owner_guid && ($container = get_entity($object->container_guid) && $container instanceof ElggGroup)) {
// only group $object->container_guid
$more = elgg_get_entity_relationship_where_sql('e.guid', 'member', $object->container_guid, 1);
} elseif ($site_guid > 1) {
//only subsite $site_guid
$more = elgg_get_entity_relationship_where_sql('e.guid', 'member_of_site', $site_guid, 1);
} else {
// pleio has too many users to update everyone, so only friends $object->owner_guid
$more = elgg_get_entity_relationship_where_sql('e.guid', 'friend', $object->owner_guid, 1);
}
break;
case ACCESS_FRIENDS:
//only friends $object->owner_guid
$more = elgg_get_entity_relationship_where_sql('e.guid', 'friend', $object->owner_guid, 1);
break;
case ACCESS_PRIVATE:
return array();
default:
$users = get_members_of_access_collection($object->access_id, 1);
$wheres[] = "e.guid IN (" . implode(", ", $users) . ")";
}
if ($more) {
$wheres = array_merge($wheres, $more["wheres"]);
$joins = array_merge($joins, $more["joins"]);
}
// only select users that have a device_token
$more = elgg_get_entity_private_settings_where_sql('e', array(), array(), array(array('name' => 'device_token', 'value' => 1, 'operand' => 'IS NOT NULL AND 1 = ')));
$wheres = array_merge($wheres, $more["wheres"]);
$joins = array_merge($joins, $more["joins"]);
$options = array('type' => 'user', 'limit' => 100, 'wheres' => $wheres, 'joins' => $joins, 'site_guid' => ELGG_ENTITIES_ANY_VALUE);
$users = elgg_get_entities($options);
foreach ($users as $user) {
$list[$user->guid] = array("device_token" => $user->getPrivateSetting('device_token'), "device" => $user->getPrivateSetting('device'));
}
return $list;
}
开发者ID:appstaat,项目名称:pleio_api,代码行数:59,代码来源:helpers.php
注:本文中的get_members_of_access_collection函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论