summaryrefslogtreecommitdiff
path: root/core/libraries
diff options
context:
space:
mode:
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);
}
/**