public function topics($page) { $cat = new \CODOF\Forum\Category($this->db); $topic = new \CODOF\Forum\Topic($this->db); //gets category name and no of topics each hold $raw_cats = $cat->get_categories(); $cats = $cat->generate_tree($raw_cats); //get complete list of topics $new_topics = array(); if (\CODOF\User\CurrentUser\CurrentUser::loggedIn()) { $tracker = new \CODOF\Forum\Tracker($this->db); $new_topics = $tracker->get_new_topic_counts(); } $this->smarty->assign('new_topics', $new_topics); //$cat->update_count($cats); $api = new Ajax\forum\topics(); $num_topics_page = \CODOF\Util::get_opt('num_posts_all_topics'); $data = $api->get_topics($num_topics_page * ($page - 1)); $total_topics = $topic->get_total_num_topics(); $this->smarty->assign('load_more_hidden', false); if ($page * $num_topics_page >= $total_topics) { $this->smarty->assign('load_more_hidden', true); } $user = \CODOF\User\User::get(); $this->smarty->assign('can_search', $user->can('use search')); $this->smarty->assign('topics', \CODOF\HB\Render::tpl('forum/topics', $data)); $this->smarty->assign('total_num_topics', $total_topics); $this->smarty->assign('cats', $cats); $this->smarty->assign('subcategory_dropdown', \CODOF\Util::get_opt('subcategory_dropdown')); $this->smarty->assign('num_posts_per_page', $num_topics_page); $this->smarty->assign('curr_page', $page); $this->css_files = array('topics'); $this->js_files = array(array('topics/topics.js', array('type' => 'defer'))); $this->view = 'forum/topics'; \CODOF\Store::set('sub_title', _t('All topics')); $this->smarty->assign('can_delete', $user->can(array('delete my topics', 'delete all topics'))); $this->smarty->assign('can_merge', $user->can('merge topics')); $this->smarty->assign('can_move', $user->can('move topics')); //var_dump($user->can('move topics')); }