input->get("page", "1"); $children_count = $item->viewable()->children_count(); $offset = ($page-1) * $page_size; // Make sure that the page references a valid offset if ($page < 1 || $page > max(ceil($children_count / $page_size), 1)) { Kohana::show_404(); } $template = new Theme_View("page.html", "album", $theme_name); $template->set_global("page_size", $page_size); $template->set_global("item", $item); $template->set_global("children", $item->viewable()->children($page_size, $offset)); $template->set_global("children_count", $children_count); $template->set_global("parents", $item->parents()); $template->content = new View("album.html"); $item->view_count++; $item->save(); print $template; } /** * @see Rest_Controller::_form_add($parameters) */ public function _form_add($parent_id) { $parent = ORM::factory("item", $parent_id); print album::get_add_form($parent)->render(); } }