当前位置: 首页>>代码示例>>PHP>>正文


PHP get_entities_from_relationship函数代码示例

本文整理汇总了PHP中get_entities_from_relationship函数的典型用法代码示例。如果您正苦于以下问题:PHP get_entities_from_relationship函数的具体用法?PHP get_entities_from_relationship怎么用?PHP get_entities_from_relationship使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了get_entities_from_relationship函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: insertReplinks

 public function insertReplinks($entity, $lr)
 {
     $rep_from = get_entities_from_relationship('friend', $entity->getGUID(), false, 'user', '', 0, 10, 10);
     //array which contains the resources
     if (is_array($rep_from)) {
         foreach ($rep_from as $i => $resource) {
             $this->replinks["from"][$i] = $resource->guid;
         }
     } else {
         $this->replinks["from"] = array();
     }
     $rep_to = get_entities_from_relationship('friend', $entity->getGUID(), true, 'user', '', 0, 10, 10);
     //array which contains the resources
     if (is_array($rep_to)) {
         foreach ($rep_to as $i => $resource) {
             $this->replinks["to"][$i] = $resource->guid;
         }
     } else {
         $this->replinks["to"] = array();
     }
 }
开发者ID:portokallidis,项目名称:Metamorphosis-Meducator,代码行数:21,代码来源:classes.php

示例2: get_attachments

/**
 * Function to get all objects attached to a particular object
 * @param int $guid
 * @param string $type - the type of object to return e.g. 'file', 'friend_of' etc
 * @return an array of objects
 **/
function get_attachments($guid, $type = "")
{
    $attached = get_entities_from_relationship("attached", $guid, $inverse_relationship = false, $type, $subtype = "", $owner_guid = 0, $order_by = "time_created desc", $limit = 10, $offset = 0, $count = false, $site_guid = 0);
    return $attached;
}
开发者ID:jricher,项目名称:Elgg,代码行数:11,代码来源:relationships.php

示例3: method_getElggData

 function method_getElggData($params, $error)
 {
     global $CONFIG;
     if (!$this->is_loggedin()) {
         return array("err" => SESSION_ERROR);
     }
     $owner = $_SESSION['user'];
     $request = $params[0];
     // erlaubte Abfragen: friends, contacs, user
     $filter = $params[1];
     $friendselect = $params[2];
     //    $firstRow = $params[3];
     //    $lastRow = $params[3];
     $entry["data"] = array();
     $entry["colnames"] = array();
     $entry["colwidths"] = array();
     if ($request == "demo" && $friendselect == elgg_echo('ElggMan:rb:view:user') && $this->is_admin()) {
         $varColumns = $this->getVarColumnsUser();
     } else {
         $varColumns = $this->getVarColumns();
     }
     $limit = MAXENTRIES;
     switch ($request) {
         case "friends":
             switch ($friendselect) {
                 case elgg_echo('ElggMan:friends'):
                     $users = $owner->getFriends("", MAXENTRIES, $offset = 0);
                     break;
                 case elgg_echo('ElggMan:friends:incoming'):
                     $in_count = get_entities_from_relationship('friendrequest', $owner->guid, true, "", "", 0, "", 0, 0, true);
                     $users = get_entities_from_relationship("friendrequest", $owner->guid, true, "", "", 0, "", $in_count);
                     break;
                 case elgg_echo('ElggMan:friends:outgoing'):
                     $sent_count = get_entities_from_relationship("friendrequest", $owner->guid, false, "user", "", 0, "", 0, 0, true);
                     $users = get_entities_from_relationship("friendrequest", $owner->guid, false, "user", "", 0, "", $sent_count);
             }
             // switch
             break;
         case "contacts":
             $users = $owner->getObjects("PrivateContact", MAXENTRIES, $offset = 0);
             break;
         case "notActivatedUsers":
             access_show_hidden_entities(true);
             $prefix = $CONFIG->dbprefix;
             $sql = "SELECT guid  FROM {$prefix}entities WHERE type = 'user' and enabled <> 'yes'";
             $result = get_data($sql);
             if (is_array($result)) {
                 foreach ($result as $row) {
                     $users[] = westorElggMan_get_entity($row->guid);
                 }
             }
             break;
         case "usersOnline":
             $users = find_active_users(600, MAXENTRIES);
             break;
         case "demo":
             $limit = 2;
             $entry["helpTxt"] = elgg_echo('ElggMan:helpTableColumns');
         default:
             // "users" || "blockedUsers":
             $users = westorElggMan_get_entities($type = "user", $subtype = "", $owner_guid = 0, $order_by = "", $limit);
             break;
     }
     // switch
     if (is_array($users)) {
         foreach ($users as $user) {
             if ($request == "users" && $user->isBanned()) {
                 continue;
             }
             if ($request == "blockedUsers" && !$user->isBanned()) {
                 continue;
             }
             $name = $this->getEntityProperty($user, elgg_echo('ElggMan:displayname'));
             if ($filter) {
                 // Filter angegeben
                 if (stripos($name, $filter) === false) {
                     continue;
                 }
             }
             $line = array($user->getGUID(), false, $this->getEntityProperty($user, 'userIcon'), $name);
             if (is_array($varColumns)) {
                 foreach ($varColumns as $varColumn) {
                     if ($varColumn == elgg_echo('ElggMan_:cMobile')) {
                         $line[] = $this->getEntityProperty($user, 'smsIcon');
                     } else {
                         $line[] = $this->getEntityProperty($user, $varColumn);
                     }
                 }
             }
             $entry["data"][] = $line;
             // f = friend
             // a = admin
             // s = self
             $entry["metadata"][$user->getGUID()] = array('f' => is_object($owner->isFriendsWith($user->guid)), 'a' => westorElggMan_isAdmin($user), 's' => $owner->getGUID() == $user->getGUID(), 'u' => $user->getURL());
         }
     }
     $entry["colnames"] = array('', '', '', elgg_echo("ElggMan:displayname"));
     $entry["colnames"] = array_merge($entry["colnames"], $varColumns);
     if (!$this->is_admin() || $request == "demo" && $friendselect == elgg_echo('ElggMan:rb:view:user')) {
         $entry["colwidths"] = $this->getAllColumnWidths("user");
//.........这里部分代码省略.........
开发者ID:rijojoy,项目名称:MyIceBerg,代码行数:101,代码来源:elggMan.php

示例4: elgg_view

    $iconsize = "medium";
}
?>

<div id="groups_info_column_right"><!-- start of groups_info_column_right -->
    <div id="groups_icon_wrapper"><!-- start of groups_icon_wrapper -->
        <?php 
echo elgg_view("groups/icon", array('entity' => $vars['entity'], 'size' => $iconsize));
?>
    </div><!-- end of groups_icon_wrapper -->
	<div id="group_stats"><!-- start of group_stats -->
	    <?php 
echo "<p><b>" . elgg_echo("groups:owner") . ": </b><a href=\"" . get_user($vars['entity']->owner_guid)->getURL() . "\">" . get_user($vars['entity']->owner_guid)->name . "</a></p>";
?>
	    <p><?php 
echo elgg_echo('groups:members') . ": " . get_entities_from_relationship('member', $vars['entity']->guid, true, 'user', '', 0, '', 9999, 0, true);
?>
</p>
    </div><!-- end of group_stats -->
</div><!-- end of groups_info_column_right -->

<div id="groups_info_column_left"><!-- start of groups_info_column_left --> 
    <?php 
if ($vars['full'] == true) {
    $group_fields = profile_manager_get_categorized_group_fields();
    if (count($group_fields["fields"]) > 0) {
        $group_fields = $group_fields["fields"];
        foreach ($group_fields as $field) {
            $metadata_name = $field->metadata_name;
            $value = $vars['entity']->{$metadata_name};
            // make title
开发者ID:portokallidis,项目名称:Metamorphosis-Meducator,代码行数:31,代码来源:groupprofile.php

示例5: get_user_friends_of

/**
 * Obtains the people who have made a given user a friend
 *
 * @param int $user_guid The user's GUID
 * @param string $subtype The subtype of users, if any
 * @param int $limit Number of results to return (default 10)
 * @param int $offset Indexing offset, if any
 * @return false|array Either an array of ElggUsers or false, depending on success
 */
function get_user_friends_of($user_guid, $subtype = "", $limit = 10, $offset = 0)
{
    return get_entities_from_relationship("friend", $user_guid, true, "user", $subtype, 0, "time_created desc", $limit, $offset);
}
开发者ID:portokallidis,项目名称:Metamorphosis-Meducator,代码行数:13,代码来源:users.php

示例6: get_entity

 * @author Curverider Ltd
 * @copyright Curverider Ltd 2008-2009
 * @link http://elgg.com/
 */
$group = $vars['entity'];
$owner = get_entity($vars['entity']->owner_guid);
$forward_url = $group->getURL();
?>
<div class="contentWrapper">
<form action="<?php 
echo $vars['url'];
?>
action/groups/invite" method="post">

	<?php 
if ($friends = get_entities_from_relationship('friend', $_SESSION['guid'], false, 'user', '', 0, '', 9999)) {
    echo elgg_view('friends/picker', array('entities' => $friends, 'internalname' => 'user_guid', 'highlight' => 'all'));
}
// echo elgg_view('sharing/invite',array('shares' => $shares, 'owner' => $owner, 'group' => $group));
?>
	<input type="hidden" name="forward_url" value="<?php 
echo $forward_url;
?>
" />
	<input type="hidden" name="group_guid" value="<?php 
echo $group->guid;
?>
" />
	<input type="submit" value="<?php 
echo elgg_echo('invite');
?>
开发者ID:portokallidis,项目名称:Metamorphosis-Meducator,代码行数:31,代码来源:invite.php

示例7: get_entities_from_relationship

 * 
 * Object view of a custom profile field category
 * 
 * @package profile_manager
 * @author ColdTrick IT Solutions
 * @copyright Coldtrick IT Solutions 2009
 * @link http://www.coldtrick.com/
 */
if (get_context() != "search") {
    $object = $vars["entity"];
    // get title
    $title = $object->getTitle();
    $rels = "";
    $rel_count = get_entities_from_relationship(CUSTOM_PROFILE_FIELDS_PROFILE_TYPE_CATEGORY_RELATIONSHIP, $object->guid, true, "object", CUSTOM_PROFILE_FIELDS_PROFILE_TYPE_SUBTYPE, null, null, null, null, true);
    if ($rel_count > 0) {
        $cats = get_entities_from_relationship(CUSTOM_PROFILE_FIELDS_PROFILE_TYPE_CATEGORY_RELATIONSHIP, $object->guid, true, "object", CUSTOM_PROFILE_FIELDS_PROFILE_TYPE_SUBTYPE, null, null, $rel_count);
        $guids = array();
        foreach ($cats as $cat) {
            $guids[] = $cat->guid;
        }
        $rels = implode(",", $guids);
    }
    ?>
	<div class="custom_fields_category" id="custom_profile_field_category_<?php 
    echo $object->guid;
    ?>
">
		<div class="custom_fields_category_edit" onclick="editCategory('<?php 
    echo $object->guid;
    ?>
','<?php 
开发者ID:eokyere,项目名称:elgg,代码行数:31,代码来源:custom_profile_field_category.php

示例8: get_river_items

/**
 * Retrieves items from the river. All parameters are optional.
 *
 * @param int|array $subject_guid Acting entity to restrict to. Default: all
 * @param int|array $object_guid Entity being acted on to restrict to. Default: all
 * @param string $subject_relationship If set to a relationship type, this will use $subject_guid as the starting point and set the subjects to be all users this entity has this relationship with (eg 'friend'). Default: blank
 * @param string $type The type of entity to restrict to. Default: all
 * @param string $subtype The subtype of entity to restrict to. Default: all
 * @param string $action_type The type of river action to restrict to. Default: all
 * @param int $limit The number of items to retrieve. Default: 20
 * @param int $offset The page offset. Default: 0
 * @param int $posted_min The minimum time period to look at. Default: none
 * @param int $posted_max The maximum time period to look at. Default: none
 * @return array|false Depending on success
 */
function get_river_items($subject_guid = 0, $object_guid = 0, $subject_relationship = '', $type = '', $subtype = '', $action_type = '', $limit = 20, $offset = 0, $posted_min = 0, $posted_max = 0)
{
    // Get config
    global $CONFIG;
    // Sanitise variables
    if (!is_array($subject_guid)) {
        $subject_guid = (int) $subject_guid;
    } else {
        foreach ($subject_guid as $key => $temp) {
            $subject_guid[$key] = (int) $temp;
        }
    }
    if (!is_array($object_guid)) {
        $object_guid = (int) $object_guid;
    } else {
        foreach ($object_guid as $key => $temp) {
            $object_guid[$key] = (int) $temp;
        }
    }
    if (!empty($type)) {
        $type = sanitise_string($type);
    }
    if (!empty($subtype)) {
        $subtype = sanitise_string($subtype);
    }
    if (!empty($action_type)) {
        $action_type = sanitise_string($action_type);
    }
    $limit = (int) $limit;
    $offset = (int) $offset;
    $posted_min = (int) $posted_min;
    $posted_max = (int) $posted_max;
    // Construct 'where' clauses for the river
    $where = array();
    $where[] = str_replace("and enabled='yes'", '', str_replace('owner_guid', 'subject_guid', get_access_sql_suffix()));
    if (empty($subject_relationship)) {
        if (!empty($subject_guid)) {
            if (!is_array($subject_guid)) {
                $where[] = " subject_guid = {$subject_guid} ";
            } else {
                $where[] = " subject_guid in (" . implode(',', $subject_guid) . ") ";
            }
        }
    } else {
        if (!is_array($subject_guid)) {
            if ($entities = get_entities_from_relationship($subject_relationship, $subject_guid, false, '', '', 0, '', 9999)) {
                $guids = array();
                foreach ($entities as $entity) {
                    $guids[] = (int) $entity->guid;
                }
                // $guids[] = $subject_guid;
                $where[] = " subject_guid in (" . implode(',', $guids) . ") ";
            } else {
                return array();
            }
        }
    }
    if (!empty($object_guid)) {
        if (!is_array($object_guid)) {
            $where[] = " object_guid = {$object_guid} ";
        } else {
            $where[] = " object_guid in (" . implode(',', $object_guid) . ") ";
        }
    }
    if (!empty($type)) {
        $where[] = " type = '{$type}' ";
    }
    if (!empty($subtype)) {
        $where[] = " subtype = '{$subtype}' ";
    }
    if (!empty($action_type)) {
        $where[] = " action_type = '{$action_type}' ";
    }
    if (!empty($posted_min)) {
        $where[] = " posted > {$posted_min} ";
    }
    if (!empty($posted_max)) {
        $where[] = " posted < {$posted_max} ";
    }
    $whereclause = implode(' and ', $where);
    // Construct main SQL
    $sql = "select id,type,subtype,action_type,access_id,view,subject_guid,object_guid,posted from {$CONFIG->dbprefix}river where {$whereclause} order by posted desc limit {$offset},{$limit}";
    // Get data
    return get_data($sql);
}
开发者ID:portokallidis,项目名称:Metamorphosis-Meducator,代码行数:100,代码来源:river2.php

示例9: get_entities_from_relationship

<?php

/** 
 *  Group profile widget - this displays a users groups on their profile
 **/
//the number of groups to display
$number = (int) $vars['entity']->num_display;
if (!$number) {
    $number = 4;
}
//the page owner
$owner = $vars['entity']->owner_guid;
//$groups = get_users_membership($owner);
//$groups = list_entities_from_relationship('member',$owner,false,'group','',0,$number,false,false,false);
$groups = get_entities_from_relationship('member', $owner, false, "group", "", 0, "", $number, 0, false, 0);
if ($groups) {
    echo "<div class=\"groupmembershipwidget\">";
    foreach ($groups as $group) {
        $icon = elgg_view("groups/icon", array('entity' => $group, 'size' => 'small'));
        echo "<div class=\"contentWrapper\">" . $icon . " <div class='search_listing_info'><p><span>" . $group->name . "</span><br />";
        echo $group->briefdescription . "</p></div><div class=\"clearfloat\"></div></div>";
    }
    echo "</div>";
}
// echo $groups;
开发者ID:portokallidis,项目名称:Metamorphosis-Meducator,代码行数:25,代码来源:view.php

示例10: dirname

<?php

/**
 * Elgg notifications plugin group index
 * 
 * @package ElggNotifications
 * @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.com/
 */
// Load Elgg framework
require_once dirname(dirname(dirname(__FILE__))) . '/engine/start.php';
// Ensure only logged-in users can see this page
gatekeeper();
// Set the context to settings
set_context('settings');
// Get the form
global $SESSION, $CONFIG;
$people = array();
$groupmemberships = get_entities_from_relationship('member', $_SESSION['user']->guid, false, 'group', '', 0, '', 9999);
$body = elgg_view('input/form', array('body' => elgg_view('notifications/subscriptions/groupsform', array('groups' => $groupmemberships)), 'method' => 'post', 'action' => $CONFIG->wwwroot . 'action/notificationsettings/groupsave'));
// Insert it into the correct canvas layout
$body = elgg_view_layout('two_column_left_sidebar', '', $body);
// Draw the page
page_draw(elgg_echo('notifications:subscriptions:changesettings:groups'), $body);
开发者ID:portokallidis,项目名称:Metamorphosis-Meducator,代码行数:26,代码来源:groups.php

示例11: object_notifications

/**
 * Automatically triggered notification on 'create' events that looks at registered
 * objects and attempts to send notifications to anybody who's interested
 *
 * @see register_notification_object
 */
function object_notifications($event, $object_type, $object)
{
    // We only want to trigger notification events for ElggEntities
    if ($object instanceof ElggEntity) {
        // Get config data
        global $CONFIG, $SESSION, $NOTIFICATION_HANDLERS;
        $hookresult = trigger_plugin_hook('object:notifications', $object_type, array('event' => $event, 'object_type' => $object_type, 'object' => $object), false);
        if ($hookresult === true) {
            return true;
        }
        // Have we registered notifications for this type of entity?
        $object_type = $object->getType();
        if (empty($object_type)) {
            $object_type = '__BLANK__';
        }
        $object_subtype = $object->getSubtype();
        if (empty($object_subtype)) {
            $object_subtype = '__BLANK__';
        }
        if (isset($CONFIG->register_objects[$object_type][$object_subtype])) {
            $descr = $CONFIG->register_objects[$object_type][$object_subtype];
            $string = $descr . ": " . $object->getURL();
            // Get users interested in content from this person and notify them
            // (Person defined by container_guid so we can also subscribe to groups if we want)
            foreach ($NOTIFICATION_HANDLERS as $method => $foo) {
                if ($interested_users = get_entities_from_relationship('notify' . $method, $object->container_guid, true, 'user', '', 0, '', 99999)) {
                    if (is_array($interested_users)) {
                        foreach ($interested_users as $user) {
                            if ($user instanceof ElggUser) {
                                if (!$user->isBanned()) {
                                    if ($user->guid != $SESSION['user']->guid && has_access_to_entity($object, $user) && $object->access_id != ACCESS_PRIVATE) {
                                        $methodstring = trigger_plugin_hook('notify:entity:message', $object->getType(), array('entity' => $object, 'to_entity' => $user, 'method' => $method), $string);
                                        if (empty($methodstring) && $methodstring !== false) {
                                            $methodstring = $string;
                                        }
                                        if ($methodstring !== false) {
                                            notify_user($user->guid, $object->container_guid, $descr, $methodstring, NULL, array($method));
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
开发者ID:eokyere,项目名称:elgg,代码行数:54,代码来源:notification.php

示例12: get_site_collections

/**
 * Get the collections belonging to a site.
 * 
 * @param int $site_guid
 * @param string $subtype
 * @param int $limit 
 * @param int $offset
 */
function get_site_collections($site_guid, $subtype = "", $limit = 10, $offset = 0)
{
    $site_guid = (int) $site_guid;
    $subtype = sanitise_string($subtype);
    $limit = (int) $limit;
    $offset = (int) $offset;
    return get_entities_from_relationship("member_of_site", $site_guid, true, "collection", $subtype, 0, "time_created desc", $limit, $offset);
}
开发者ID:eokyere,项目名称:elgg,代码行数:16,代码来源:sites.php

示例13: get_activity_stream_data


//.........这里部分代码省略.........
                $subtype[$k] = sanitise_string($v);
            }
        }
    }
    if ($owner_guid) {
        if (is_array($owner_guid)) {
            foreach ($owner_guid as $k => $v) {
                $owner_guid[$k] = (int) $v;
            }
        } else {
            $owner_guid = array((int) $owner_guid);
        }
    }
    $owner_relationship = sanitise_string($owner_relationship);
    // Get a list of possible views
    $activity_events = array();
    $activity_views = array_merge(elgg_view_tree('activity', 'default'), elgg_view_tree('river', 'default'));
    // Join activity with river
    $done = array();
    foreach ($activity_views as $view) {
        $fragments = explode('/', $view);
        $tmp = explode('/', $view, 2);
        $tmp = $tmp[1];
        if (isset($fragments[0]) && ($fragments[0] == 'river' || $fragments[0] == 'activity') && !in_array($tmp, $done)) {
            if (isset($fragments[1])) {
                $f = array();
                for ($n = 1; $n < count($fragments); $n++) {
                    $val = sanitise_string($fragments[$n]);
                    switch ($n) {
                        case 1:
                            $key = 'type';
                            break;
                        case 2:
                            $key = 'subtype';
                            break;
                        case 3:
                            $key = 'event';
                            break;
                    }
                    $f[$key] = $val;
                }
                // Filter result based on parameters
                $add = true;
                if ($type) {
                    if (!in_array($f['type'], $type)) {
                        $add = false;
                    }
                }
                if ($add && $subtype) {
                    if (!in_array($f['subtype'], $subtype)) {
                        $add = false;
                    }
                }
                if ($add && $event) {
                    if (!in_array($f['event'], $event)) {
                        $add = false;
                    }
                }
                if ($add) {
                    $activity_events[] = $f;
                }
            }
            $done[] = $tmp;
        }
    }
    $n = 0;
    foreach ($activity_events as $details) {
        // Get what we're talking about
        if ($details['subtype'] == 'default') {
            $details['subtype'] = '';
        }
        if ($details['type'] && $details['event']) {
            if ($n > 0) {
                $obj_query .= " or ";
            }
            $access = "";
            if ($details['type'] != 'relationship') {
                $access = " and " . get_access_sql_suffix('sl');
            }
            $obj_query .= "( sl.object_type='{$details['type']}' and sl.object_subtype='{$details['subtype']}' and sl.event='{$details['event']}' {$access} )";
            $n++;
        }
    }
    // User
    if (count($owner_guid) && $owner_guid[0] != 0) {
        $user = " and sl.performed_by_guid in (" . implode(',', $owner_guid) . ")";
        if ($owner_relationship) {
            $friendsarray = "";
            if ($friends = get_entities_from_relationship($owner_relationship, $owner_guid[0], false, "user", $subtype, 0, "time_created desc", 9999)) {
                $friendsarray = array();
                foreach ($friends as $friend) {
                    $friendsarray[] = $friend->getGUID();
                }
                $user = " and sl.performed_by_guid in (" . implode(',', $friendsarray) . ")";
            }
        }
    }
    $query = "SELECT sl.* from {$CONFIG->dbprefix}system_log sl  where 1 {$user} and ({$obj_query}) order by sl.time_created desc  limit {$offset}, {$limit}";
    return get_data($query);
}
开发者ID:portokallidis,项目名称:Metamorphosis-Meducator,代码行数:101,代码来源:activity.php

示例14: friends_of_friends_get_list

/**
 * Friends of friends.
 * 
 * @package friends_of_friends
 * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
 * @author Pedro Prez
 * @copyright 2009
 * @link http://www.pedroprez.com.ar/
 */
function friends_of_friends_get_list($user_guid, $order_by = "", $limit = 10, $offset = 0, $count = false, $site_guid = 0)
{
    global $CONFIG;
    $user_guid = (int) $user_guid;
    $friends = get_entities_from_relationship('friend', $user_guid, false, 'user', '', 0, $limit);
    $friends_aux = array();
    if (is_array($friends)) {
        foreach ($friends as $friend) {
            $friends_aux[] = $friend->getGUID();
        }
    }
    $list_friends = 0;
    if (!empty($friends_aux)) {
        $list_friends = implode(',', $friends_aux);
    }
    if ($order_by == "") {
        $order_by = "time_created desc";
    }
    $order_by = sanitise_string($order_by);
    $limit = (int) $limit;
    $offset = (int) $offset;
    $site_guid = (int) $site_guid;
    if ($site_guid == 0) {
        $site_guid = $CONFIG->site_guid;
    }
    $where = array();
    $where[] = "r.relationship='friend'";
    if ($user_guid) {
        $where[] = "r.guid_one IN ({$list_friends})";
    }
    if ($site_guid > 0) {
        $where[] = "e.site_guid = {$site_guid}";
    }
    // Select what we're joining based on the options
    $joinon = "e.guid = r.guid_two";
    if ($count) {
        $query = "SELECT count(distinct e.guid) as total ";
    } else {
        $query = "SELECT distinct e.* ";
    }
    $query .= " from {$CONFIG->dbprefix}entity_relationships r JOIN {$CONFIG->dbprefix}entities e on {$joinon} where ";
    foreach ($where as $w) {
        $query .= " {$w} and ";
    }
    $query .= get_access_sql_suffix("e");
    // Add access controls
    if (!$count) {
        $query .= " order by {$order_by} limit {$offset}, {$limit}";
        // Add order and limit
        $data = get_data($query, "entity_row_to_elggstar");
        if ($data) {
            foreach ($data as $id => $row) {
                if ($row->getGUID() == $user_guid) {
                    unset($data[$id]);
                }
            }
        }
        return $data;
    } else {
        if ($count = get_data_row($query)) {
            return $count->total;
        }
    }
    return false;
}
开发者ID:portokallidis,项目名称:Metamorphosis-Meducator,代码行数:74,代码来源:functions_friends_to_friends.php

示例15: elgg_echo

 * @author Diego Andrés Ramírez Aragón <diego@somosmas.org>
 * @copyright Corporación Somos más - 2009
 * @link http://www.somosmas.org
 *
 */
if (get_plugin_setting("groupcontents", "blogextended") == "yes") {
    $field_label = elgg_echo("content:owner");
    if (isset($vars["label"])) {
        $field_label = $vars["label"];
    }
    $value = "";
    if (isset($vars["entity"])) {
        $value = $vars["entity"]->content_owner;
    }
    $options = array("" => elgg_echo("my:profile"));
    $objects = get_entities_from_relationship("member", page_owner(), false, "group");
    if (!empty($objects)) {
        foreach ($objects as $object) {
            $options["{$object->guid}"] = $object->name;
        }
    }
    if (isset($vars["assign_to"])) {
        $options = array();
        $value = $vars["assign_to"];
        $group = get_entity($value);
        $options[$value] = $group->name;
    }
    ?>

<p><label><?php 
    echo $field_label;
开发者ID:eokyere,项目名称:elgg,代码行数:31,代码来源:groupselector.php


注:本文中的get_entities_from_relationship函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。