diff options
author | ben <ben@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2008-07-01 11:09:11 +0000 |
---|---|---|
committer | ben <ben@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2008-07-01 11:09:11 +0000 |
commit | 6eadecc7aeaecd49d5f21bfabd946ddd8dbb2557 (patch) | |
tree | 10d084d5b23e7410672963e251237d8baa4a1998 /engine/lib | |
parent | 68c70b973830ec2fdf9ac505007b8108491ffd8e (diff) | |
download | elgg-6eadecc7aeaecd49d5f21bfabd946ddd8dbb2557.tar.gz elgg-6eadecc7aeaecd49d5f21bfabd946ddd8dbb2557.tar.bz2 |
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
Diffstat (limited to 'engine/lib')
-rw-r--r-- | engine/lib/annotations.php | 19 |
1 files 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'";
|