diff options
author | Tim Almdal <tnalmdal@shaw.ca> | 2009-03-08 16:29:01 +0000 |
---|---|---|
committer | Tim Almdal <tnalmdal@shaw.ca> | 2009-03-08 16:29:01 +0000 |
commit | 39954ad0b77800b3d4935430794adf18c2625148 (patch) | |
tree | a9016b38fa2b1ed0e9a20276457f2011a4a70f27 /core/libraries | |
parent | bf6c814e81a00d6aec3cacdecd3b93b90cf73a3e (diff) |
Implement Sortable albums. Current sort fields include (Creation
Date, Update Date, Random Key, Title, Mime Type, Item Type & Number of views)
Diffstat (limited to 'core/libraries')
-rw-r--r-- | core/libraries/ORM_MPTT.php | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/core/libraries/ORM_MPTT.php b/core/libraries/ORM_MPTT.php index 7e89bf6f..6b493e88 100644 --- a/core/libraries/ORM_MPTT.php +++ b/core/libraries/ORM_MPTT.php @@ -142,10 +142,14 @@ class ORM_MPTT_Core extends ORM { * @param integer SQL offset * @return array ORM */ - function children($limit=null, $offset=0) { - return $this->where("parent_id", $this->id) - ->orderby("id", "ASC") - ->find_all($limit, $offset); + function children($limit=null, $offset=0, $orderby=null) { + $this->where("parent_id", $this->id); + if (empty($orderby)) { + $this->orderby("id", "ASC"); + } else { + $this->orderby($orderby); + } + return $this->find_all($limit, $offset); } /** |