From 2c70709ddeb70f3c12e8ad03e79122a986d741c0 Mon Sep 17 00:00:00 2001 From: marcus Date: Tue, 7 Apr 2009 17:03:11 +0000 Subject: Closes #937: Added time constraints to the tag retrieval query. git-svn-id: https://code.elgg.org/elgg/trunk@3191 36083f99-b078-4883-b0ff-0f9b5a30f544 --- engine/lib/tags.php | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'engine/lib') diff --git a/engine/lib/tags.php b/engine/lib/tags.php index 6654dfe14..254e81905 100644 --- a/engine/lib/tags.php +++ b/engine/lib/tags.php @@ -74,11 +74,13 @@ * @param string $entity_type Optionally, the entity type ('object' etc) * @param string $entity_subtype The entity subtype, optionally * @param int $owner_guid The GUID of the tags owner, optionally - * @param int $site_guid Optionally, the site to restrict to (default is the current site) + * @param int $site_guid Optionally, the site to restrict to (default is the current site) + * @param int $start_ts Optionally specify a start timestamp for tags used to generate cloud. + * @param int $ent_ts Optionally specify an end timestamp for tags used to generate cloud. * @return array|false Array of objects with ->tag and ->total values, or false on failure */ - function get_tags($threshold = 1, $limit = 10, $metadata_name = "", $entity_type = "object", $entity_subtype = "", $owner_guid = "", $site_guid = -1) { + function get_tags($threshold = 1, $limit = 10, $metadata_name = "", $entity_type = "object", $entity_subtype = "", $owner_guid = "", $site_guid = -1, $start_ts = "", $end_ts = "") { global $CONFIG; @@ -130,6 +132,15 @@ $query .= " and e.container_guid in (".implode(",",$owner_guid).")"; } else if (is_int($owner_guid)) { $query .= " and e.container_guid = {$owner_guid} "; + } + if ($start_ts) { + $start_ts = (int)$start_ts; + $query .= " and e.time_created>=$start_ts"; + } + + if ($end_ts) { + $end_ts = (int)$end_ts; + $query .= " and e.time_created<=$end_ts"; } //$userid = get_loggedin_userid(); -- cgit v1.2.3