diff options
author | Nathan Kinkade <nkinkade@nkinka.de> | 2010-01-03 23:16:31 +0000 |
---|---|---|
committer | Nathan Kinkade <nkinkade@nkinka.de> | 2010-01-03 23:16:31 +0000 |
commit | 00a22c24b4f177421781886c1e1c48ab82e4c8a3 (patch) | |
tree | 1c4d713c6bcc8696ee812e51a0868145d9a44540 | |
parent | 399abbc3a754cf5fdcfdff113446e1bc264091e2 (diff) |
Updated controller to work with newer API.
-rw-r--r-- | modules/latestupdates/controllers/latestupdates.php | 34 |
1 files changed, 15 insertions, 19 deletions
diff --git a/modules/latestupdates/controllers/latestupdates.php b/modules/latestupdates/controllers/latestupdates.php index bcee909e..39f0df60 100644 --- a/modules/latestupdates/controllers/latestupdates.php +++ b/modules/latestupdates/controllers/latestupdates.php @@ -25,7 +25,7 @@ class latestupdates_Controller extends Controller { // Figure out which page # the visitor is on and // don't allow the visitor to go below page 1. - $page = $this->input->get("page", 1); + $page = Input::instance()->get("page", 1); if ($page < 1) { $page = 1; } @@ -37,22 +37,19 @@ class latestupdates_Controller extends Controller { // for page numbering purposes. $count = ORM::factory("item", $id) ->viewable() - ->where("type !=", "album") - ->orderby("created", "DESC") - ->descendants() - ->count(); + ->where("type", "!=", "album") + ->order_by("created", "DESC") + ->count_all(); // Figure out what the highest page number is. - $max_pages = ceil($count / $itemsPerPage, 1); + $max_pages = ceil($count / $itemsPerPage); // Figure out which items to display on this page. $children = ORM::factory("item", $id) ->viewable() - ->where("type !=", "album") - ->orderby("created", "DESC") - ->limit($itemsPerPage) - ->offset($offset) - ->descendants(); + ->where("type", "!=", "album") + ->order_by("created", "DESC") + ->find_all($itemsPerPage, $offset); // Set up and display the actual page. $template = new Theme_View("page.html", "collection", "LatestUpdates"); @@ -72,8 +69,8 @@ class latestupdates_Controller extends Controller { $itemsPerPage = module::get_var("gallery", "page_size", 9); // Figure out which page # the visitor is on and - // don't allow the visitor to go below page 1. - $page = $this->input->get("page", 1); + // don't allow the visitor to go below page 1. + $page = Input::instance()->get("page", 1); if ($page < 1) { $page = 1; @@ -86,18 +83,17 @@ class latestupdates_Controller extends Controller { // for page numbering purposes. $count = ORM::factory("item") ->viewable() - ->where("type !=", "album") - ->find_all() - ->count(); + ->where("type", "!=", "album") + ->count_all(); // Figure out what the highest page number is. - $max_pages = ceil($count / $itemsPerPage, 1); + $max_pages = ceil($count / $itemsPerPage); // Figure out which items to display on this page. $items = ORM::factory("item") ->viewable() - ->where("type !=", "album") - ->orderby("created", "DESC") + ->where("type", "!=", "album") + ->order_by("created", "DESC") ->find_all($itemsPerPage, $offset); // Set up and display the actual page. |