From 4318e9697253546e8bb4f76166ac92ee6918e94e Mon Sep 17 00:00:00 2001 From: icewing Date: Thu, 6 Mar 2008 17:50:28 +0000 Subject: Marcus Povey * Added delete annotations, fixed error on annotation search (missing params) git-svn-id: https://code.elgg.org/elgg/trunk@105 36083f99-b078-4883-b0ff-0f9b5a30f544 --- engine/lib/annotations.php | 10 +++++++++- engine/lib/sites.php | 15 +++++++++++++-- 2 files changed, 22 insertions(+), 3 deletions(-) (limited to 'engine/lib') diff --git a/engine/lib/annotations.php b/engine/lib/annotations.php index c02ad10fa..d795f590d 100644 --- a/engine/lib/annotations.php +++ b/engine/lib/annotations.php @@ -136,12 +136,14 @@ * * @param int $object_id * @param string $object_type + * @param string $name + * @param mixed $value * @param int $owner_id * @param string $order_by * @param int $limit * @param int $offset */ - function get_annotations($object_id = 0, $object_type = "", $owner_id = 0, $order_by = "created desc", $limit = 10, $offset = 0) + function get_annotations($object_id = 0, $object_type = "", $name = "", $value = "", $owner_id = 0, $order_by = "created desc", $limit = 10, $offset = 0) { global $CONFIG; @@ -168,6 +170,12 @@ if ($owner_id != 0) $where[] = "owner_id=$owner_id"; + if ($name != "") + $where[] = "name='$name'"; + + if ($value != "") + $where[] = "value='$value'"; + // add access controls $access = get_access_list(); $where[] = "(access_id in {$access} or (access_id = 0 and owner_id = {$_SESSION['id']}))"; diff --git a/engine/lib/sites.php b/engine/lib/sites.php index 991493c8a..294ed9c8f 100644 --- a/engine/lib/sites.php +++ b/engine/lib/sites.php @@ -518,8 +518,19 @@ */ function remove_site_annotations($site_id, $name) { - // TODO : Writeme - throw new NotImplementedException("Writeme!"); + $annotations = get_annotations($site_id, 'site', $name); + + if($annotations) + { + foreach ($annotations as $a) + { + delete_annotation($a->id); + } + + return true; + } + + return false; } /** -- cgit v1.2.3