]> gitweb.fluxo.info Git - lorea/elgg.git/commitdiff
Added starttime and endtime for get_entities_from_annotation().
authorbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>
Mon, 3 Aug 2009 20:27:55 +0000 (20:27 +0000)
committerbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>
Mon, 3 Aug 2009 20:27:55 +0000 (20:27 +0000)
git-svn-id: https://code.elgg.org/elgg/trunk@3418 36083f99-b078-4883-b0ff-0f9b5a30f544

engine/lib/annotations.php

index af28a6affc59902660d1199433762eb58bac1c23..23109cbf60109cb43a74cbbf6ac3127d7e004159 100644 (file)
         * @param int $offset Place to start.\r
         * @param string $order_by How to order results.\r
         * @param boolean $count Whether to count entities rather than return them\r
+        * @param int $timelower The earliest time the annotation can have been created. Default: all\r
+        * @param int $timeupper The latest time the annotation can have been created. Default: all\r
         */\r
-       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)\r
+       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)\r
        {\r
                global $CONFIG;\r
                \r
                $entity_type = sanitise_string($entity_type);\r
                $entity_subtype = get_subtype_id($entity_type, $entity_subtype);\r
+               $timelower = (int) $timelower;\r
+               $timeupper = (int) $timeupper;\r
+               \r
                if ($name)\r
                {\r
                        $name = get_metastring_id($name);\r
                        \r
                if ($value != "")\r
                        $where[] = "a.value_id='$value'";\r
-                       \r
+\r
+               if ($timelower)\r
+                       $where[] = "a.time_created >= {$timelower}";\r
+               if ($timeupper)\r
+                       $where[] = "a.time_created <= {$timeupper}";\r
                \r
                if ($count) {\r
                        $query = "SELECT count(distinct e.guid) as total ";\r