diff options
author | ben <ben@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2008-07-01 10:28:21 +0000 |
---|---|---|
committer | ben <ben@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2008-07-01 10:28:21 +0000 |
commit | 742fc3aacbd5fb8097a18752d25e1b873eb9eaf8 (patch) | |
tree | a5b7f11e3c46a00523ba930ab6e2953dcdd8c39e /engine | |
parent | fb7eae202bae76c7f7b60cd1393fe6994a11b291 (diff) | |
download | elgg-742fc3aacbd5fb8097a18752d25e1b873eb9eaf8.tar.gz elgg-742fc3aacbd5fb8097a18752d25e1b873eb9eaf8.tar.bz2 |
get_annotations can now optionally take an array as owner_guid
git-svn-id: https://code.elgg.org/elgg/trunk@1219 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine')
-rw-r--r-- | engine/lib/annotations.php | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/engine/lib/annotations.php b/engine/lib/annotations.php index 8ae9a9340..192722630 100644 --- a/engine/lib/annotations.php +++ b/engine/lib/annotations.php @@ -244,7 +244,7 @@ * @param string $entity_subtype
* @param string $name
* @param mixed $value
- * @param int $owner_id
+ * @param int|array $owner_guid
* @param int $limit
* @param int $offset
* @param string $order_by
@@ -264,7 +264,17 @@ $name = 0;
}
if ($value != "") $value = get_metastring_id($value);
- $owner_guid = (int)$owner_guid;
+ if (is_array($owner_guid)) {
+ if (sizeof($owner_guid) > 0) {
+ foreach($owner_guid as $key => $val) {
+ $owner_guid[$key] = (int) $val;
+ }
+ } else {
+ $owner_guid = 0;
+ }
+ } else {
+ $owner_guid = (int)$owner_guid;
+ }
$limit = (int)$limit;
$offset = (int)$offset;
if($order_by == 'asc')
@@ -284,8 +294,12 @@ if ($entity_subtype != "")
$where[] = "e.subtype='$entity_subtype'";
- if ($owner_guid != 0)
+ if ($owner_guid != 0 && !is_array($owner_guid)) {
$where[] = "a.owner_guid=$owner_guid";
+ } else {
+ if (is_array($owner_guid))
+ $where[] = "a.owner_guid in (" . implode(",",$owner_guid) . ")";
+ }
if ($name !== "")
$where[] = "a.name_id='$name'";
|