From bcd4242a32c0b765156a0672d82e9bd086e80e0a Mon Sep 17 00:00:00 2001 From: brettp Date: Mon, 3 Aug 2009 20:27:55 +0000 Subject: Added starttime and endtime for get_entities_from_annotation(). git-svn-id: https://code.elgg.org/elgg/trunk@3418 36083f99-b078-4883-b0ff-0f9b5a30f544 --- engine/lib/annotations.php | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'engine/lib') diff --git a/engine/lib/annotations.php b/engine/lib/annotations.php index af28a6aff..23109cbf6 100644 --- a/engine/lib/annotations.php +++ b/engine/lib/annotations.php @@ -355,13 +355,18 @@ * @param int $offset Place to start. * @param string $order_by How to order results. * @param boolean $count Whether to count entities rather than return them + * @param int $timelower The earliest time the annotation can have been created. Default: all + * @param int $timeupper The latest time the annotation can have been created. Default: all */ - function get_entities_from_annotations($entity_type = "", $entity_subtype = "", $name = "", $value = "", $owner_guid = 0, $group_guid = 0, $limit = 10, $offset = 0, $order_by = "asc", $count = false) + function get_entities_from_annotations($entity_type = "", $entity_subtype = "", $name = "", $value = "", $owner_guid = 0, $group_guid = 0, $limit = 10, $offset = 0, $order_by = "asc", $count = false, $timelower = 0, $timeupper = 0) { global $CONFIG; $entity_type = sanitise_string($entity_type); $entity_subtype = get_subtype_id($entity_type, $entity_subtype); + $timelower = (int) $timelower; + $timeupper = (int) $timeupper; + if ($name) { $name = get_metastring_id($name); @@ -414,7 +419,11 @@ if ($value != "") $where[] = "a.value_id='$value'"; - + + if ($timelower) + $where[] = "a.time_created >= {$timelower}"; + if ($timeupper) + $where[] = "a.time_created <= {$timeupper}"; if ($count) { $query = "SELECT count(distinct e.guid) as total "; -- cgit v1.2.3