aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormarcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544>2009-04-07 17:03:11 +0000
committermarcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544>2009-04-07 17:03:11 +0000
commit2c70709ddeb70f3c12e8ad03e79122a986d741c0 (patch)
tree436f15732704543ef00d7ab33bd75be58f1b4e9e
parentd3bd2ffad91cdc8c663fbe598f84118b0439719f (diff)
downloadelgg-2c70709ddeb70f3c12e8ad03e79122a986d741c0.tar.gz
elgg-2c70709ddeb70f3c12e8ad03e79122a986d741c0.tar.bz2
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
-rw-r--r--engine/lib/tags.php15
1 files changed, 13 insertions, 2 deletions
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();