From 6eadecc7aeaecd49d5f21bfabd946ddd8dbb2557 Mon Sep 17 00:00:00 2001 From: ben Date: Tue, 1 Jul 2008 11:09:11 +0000 Subject: The $entity_guid on get_annotations can now be an array. git-svn-id: https://code.elgg.org/elgg/trunk@1221 36083f99-b078-4883-b0ff-0f9b5a30f544 --- engine/lib/annotations.php | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/engine/lib/annotations.php b/engine/lib/annotations.php index 192722630..c31efa1c4 100644 --- a/engine/lib/annotations.php +++ b/engine/lib/annotations.php @@ -239,7 +239,7 @@ /** * Get a list of annotations for a given object/user/annotation type. * - * @param int $entity_guid + * @param int|array $entity_guid * @param string $entity_type * @param string $entity_subtype * @param string $name @@ -253,7 +253,17 @@ { global $CONFIG; - $entity_guid = (int)$entity_guid; + if (is_array($entity_guid)) { + if (sizeof($entity_guid) > 0) { + foreach($entity_guid as $key => $val) { + $entity_guid[$key] = (int) $val; + } + } else { + $entity_guid = 0; + } + } else { + $entity_guid = (int)$entity_guid; + } $entity_type = sanitise_string($entity_type); $entity_subtype = get_subtype_id($entity_type, $entity_subtype); if ($name) @@ -285,8 +295,11 @@ $where = array(); - if ($entity_guid != 0) + if ($entity_guid != 0 && !is_array($owner_guid)) { $where[] = "a.entity_guid=$entity_guid"; + } else if (is_array($owner_guid)) { + $where[] = "a.entity_guid in (". implode(",",$entity_guid) . ")"; + } if ($entity_type != "") $where[] = "e.type='$entity_type'"; -- cgit v1.2.3