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 getCreatedThreads($session_user) { $this->threads_created = Thread::getByUserId($this->id); Thread::getAttributes($this->threads_created, $session_user); }