summaryrefslogtreecommitdiff
path: root/core/libraries
diff options
context:
space:
mode:
authorTim Almdal <tnalmdal@shaw.ca>2009-03-08 16:29:01 +0000
committerTim Almdal <tnalmdal@shaw.ca>2009-03-08 16:29:01 +0000
commit39954ad0b77800b3d4935430794adf18c2625148 (patch)
treea9016b38fa2b1ed0e9a20276457f2011a4a70f27 /core/libraries
parentbf6c814e81a00d6aec3cacdecd3b93b90cf73a3e (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.php12
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);
}
/**