/** * Call class Pagination to show number of pages * Count all existing threads */ public function index() { $paginate = new Pagination(); $page = $paginate->getPage(Thread::count()); $pagination_links = $paginate->rangeRows($page['pagenum'], $page['last_page']); $threads = Thread::getAll($pagination_links['max']); $this->set(get_defined_vars()); }
/** * To view all threads with limits through Pagination. **/ public function index() { if (!is_logged_in()) { redirect(url('user/index')); } $thread_count = Thread::getNumRows(); $pagination = pagination($thread_count); $threads = Thread::getAll($pagination['max']); $this->set(get_defined_vars()); }
public function index() { $page = Param::get('page', self::FIRST_PAGE); $sort_method = Param::get('sort', 'created'); $user_id = get_authenticated_user_id($_SESSION['userid']); $pagination = new SimplePagination($page, self::MAX_THREADS_PER_PAGE); $threads = Thread::getAll($pagination->start_index - 1, $pagination->count + 1, $sort_method); $pagination->checkLastPage($threads); Thread::getAttributes($threads, $user_id); $trending_threads = Comment::getTrending(); Thread::getTrendTitle($trending_threads); $total = Thread::countAll(); $pages = ceil($total / self::MAX_THREADS_PER_PAGE); $this->set(get_defined_vars()); }
public function index() { $page = Param::get('page', 1); $filter = Param::get('filter'); // pagination $pagination = new SimplePagination($page, self::THREADS_PERPAGE); $threads = Thread::getAll($pagination->start_index - 1, $pagination->count + 1, $filter); $pagination->checkLastPage($threads); $total = Thread::countAll($filter); $pages = ceil($total / self::THREADS_PERPAGE); // Get other info for each thread foreach ($threads as $thread) { $thread->creator = User::getByID($thread->user_id); $thread->category = Category::getName($thread->category_id); $thread->replies_count = Comment::countAll($thread->id); } // get other variables needed by the view $title = 'All Threads'; $auth_user = User::getAuthenticated(); $categories = Category::getAll(); $trending = Thread::getTrending(self::TRENDING_LIMIT); $this->set(get_defined_vars()); }
public function index() { $threads = Thread::getAll(); $this->set(get_defined_vars()); }