From 742fc3aacbd5fb8097a18752d25e1b873eb9eaf8 Mon Sep 17 00:00:00 2001 From: ben Date: Tue, 1 Jul 2008 10:28:21 +0000 Subject: 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 --- engine/lib/annotations.php | 20 +++++++++++++++++--- 1 file 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'"; -- cgit v1.2.3