summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Almdal <tnalmdal@shaw.ca>2009-03-09 13:43:13 +0000
committerTim Almdal <tnalmdal@shaw.ca>2009-03-09 13:43:13 +0000
commitac82e0a9dff9511eaf97bb7fc6f25add762583a4 (patch)
treef74551c2d1be81497f6783060079403df5648fba
parentc0375db79f47b4e4e0b1c261929389c6d3995edc (diff)
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.
-rw-r--r--core/models/item.php3
1 files changed, 1 insertions, 2 deletions
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();
}