aboutsummaryrefslogtreecommitdiff
path: root/engine/lib/annotations.php
diff options
context:
space:
mode:
authordave <dave@36083f99-b078-4883-b0ff-0f9b5a30f544>2008-06-13 17:17:12 +0000
committerdave <dave@36083f99-b078-4883-b0ff-0f9b5a30f544>2008-06-13 17:17:12 +0000
commit6569e7c79eb9d674d053390bac357e063a93666b (patch)
treea3ed4a201f0fce4e318a1d4b539ebb2010dafaf4 /engine/lib/annotations.php
parent0cc34b975d829e2fd7da8096ac09094b7b230424 (diff)
downloadelgg-6569e7c79eb9d674d053390bac357e063a93666b.tar.gz
elgg-6569e7c79eb9d674d053390bac357e063a93666b.tar.bz2
getAnnotations now has an extra param $order
git-svn-id: https://code.elgg.org/elgg/trunk@917 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine/lib/annotations.php')
-rw-r--r--engine/lib/annotations.php36
1 files changed, 20 insertions, 16 deletions
diff --git a/engine/lib/annotations.php b/engine/lib/annotations.php
index 3b5be89b3..0507cba09 100644
--- a/engine/lib/annotations.php
+++ b/engine/lib/annotations.php
@@ -98,15 +98,15 @@
function delete()
{
return delete_annotation($this->id);
- }
-
- // SYSTEM LOG INTERFACE ////////////////////////////////////////////////////////////
-
- /**
- * For a given ID, return the object associated with it.
- * This is used by the river functionality primarily.
- * This is useful for checking access permissions etc on objects.
- */
+ }
+
+ // SYSTEM LOG INTERFACE ////////////////////////////////////////////////////////////
+
+ /**
+ * For a given ID, return the object associated with it.
+ * This is used by the river functionality primarily.
+ * This is useful for checking access permissions etc on objects.
+ */
public function getObjectFromID($id) { return get_annotation($id); }
}
@@ -226,25 +226,29 @@
* @param int $offset
* @param string $order_by
*/
- function get_annotations($entity_guid = 0, $entity_type = "", $entity_subtype = "", $name = "", $value = "", $owner_guid = 0, $limit = 10, $offset = 0, $order_by = "a.time_created desc")
+ function get_annotations($entity_guid = 0, $entity_type = "", $entity_subtype = "", $name = "", $value = "", $owner_guid = 0, $limit = 10, $offset = 0, $order_by = "asc")
{
global $CONFIG;
$entity_guid = (int)$entity_guid;
$entity_type = sanitise_string($entity_type);
- $entity_subtype = get_subtype_id($entity_type, $entity_subtype);
+ $entity_subtype = get_subtype_id($entity_type, $entity_subtype);
if ($name)
- {
- $name = get_metastring_id($name);
+ {
+ $name = get_metastring_id($name);
if ($name === false)
- $name = 0;
+ $name = 0;
}
if ($value != "") $value = get_metastring_id($value);
$owner_guid = (int)$owner_guid;
$limit = (int)$limit;
$offset = (int)$offset;
- $order_by = sanitise_string($order_by);
+ if($order_by == 'asc')
+ $order_by = "a.time_created asc";
+
+ if($order_by == 'desc')
+ $order_by = "a.time_created desc";
$where = array();
@@ -270,7 +274,7 @@
foreach ($where as $w)
$query .= " $w and ";
$query .= get_access_sql_suffix("a"); // Add access controls
- $query .= " order by $order_by limit $offset,$limit"; // Add order and limit
+ $query .= " order by $order_by limit $offset,$limit"; // Add order and limit
return get_data($query, "row_to_elggannotation");
}