From b9ee37f30effee856dc963b38751f3e904fd8ddf Mon Sep 17 00:00:00 2001 From: Tim Almdal Date: Mon, 9 Mar 2009 14:38:25 +0000 Subject: Override the ORM_MTTP::children and ORM_MTPP::descendants methods in the item model and always pass the orderby fields. This insures that all children or descendant calls will respect the album sort order. --- core/models/item.php | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'core/models') diff --git a/core/models/item.php b/core/models/item.php index 9f9134fa..bab83aca 100644 --- a/core/models/item.php +++ b/core/models/item.php @@ -353,4 +353,29 @@ class Item_Model extends ORM_MPTT { url::abs_file("lib/flowplayer-3.0.5.swf") . "'); "; } + + /** + * Return all of the children of this node, ordered by id. + * + * @chainable + * @param integer SQL limit + * @param integer SQL offset + * @return array ORM + */ + function children($limit=null, $offset=0) { + return parent::children($limit, $offset, array($this->sort_column => $this->sort_order)); + } + + /** + * Return all of the children of the specified type, ordered by id. + * + * @param integer SQL limit + * @param integer SQL offset + * @param string type to return + * @return object ORM_Iterator + */ + function descendants($limit=null, $offset=0, $type=null) { + return parent::descendants($limit, $offset, $type, + array($this->sort_column => $this->sort_order)); + } } -- cgit v1.2.3