From ac82e0a9dff9511eaf97bb7fc6f25add762583a4 Mon Sep 17 00:00:00 2001 From: Tim Almdal Date: Mon, 9 Mar 2009 13:43:13 +0000 Subject: Change Item_Model::get_position to respect the sort order. This also forced the next/prev buttons in album navication to respect the sort order as well. --- core/models/item.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'core') diff --git a/core/models/item.php b/core/models/item.php index f2fb8fa4..9f9134fa 100644 --- a/core/models/item.php +++ b/core/models/item.php @@ -299,11 +299,10 @@ class Item_Model extends ORM_MPTT { * the first child in the album is at position 1. */ public function get_position($child_id) { - // Right now we only sort by id ascending, so bake that assumption in here. - // @todo fix this when we introduce sort orders. return ORM::factory("item") ->where("parent_id", $this->id) ->where("id <=", $child_id) + ->orderby(array($this->sort_column => $this->sort_order)) ->count_all(); } -- cgit v1.2.3