public function listTaggedTopics($tag, $page = 1) { $posts_per_page = \CODOF\Util::get_opt("num_posts_all_topics"); if ($page == null) { $page = 1; } $page = (int) $page; if ($page <= 1) { $from = 0; } else { $from = ($page - 1) * $posts_per_page; } $topics = new \Controller\Ajax\forum\topics(); $taggedTopics = $topics->getTaggedTopics($tag, $from); $topic = new \CODOF\Forum\Topic($this->db); $num_pages = $topic->get_num_pages($topic->getTaggedTopicsCount($tag), $posts_per_page); $url = 'tags/' . $tag . '/'; $curr_page = $page; //var_dump($taggedTopics); $this->smarty->assign('tag', $tag); $this->smarty->assign('curr_page', $curr_page); $this->smarty->assign('url', RURI . $url); $this->smarty->assign('num_pages', $num_pages); $this->smarty->assign('topics', json_encode($taggedTopics)); $this->smarty->assign('tags', json_encode($taggedTopics['tags'])); $this->css_files = array('tags'); $this->js_files = array(array('tags/tags.js', array('type' => 'defer'))); $this->view = 'forum/tags'; \CODOF\Store::set('sub_title', $tag . ' - ' . _t('Tags')); }
} $notifications = $notifier->getFormattedForInline($events); echo json_encode(array("events" => $notifications, "time" => $time)); } }); dispatch_get('Ajax/notifications/all', function () { if (Request::valid($_GET['_token'])) { $notifier = new \CODOF\Forum\Notification\Notifier(); $notifications = $notifier->get(); echo json_encode($notifier->getFormattedForInline($notifications)); } }); //search: from query dispatch_get('Ajax/topics/get_topics', function () { if (Request::valid($_GET['token'])) { $topics = new Controller\Ajax\forum\topics(); $list = $topics->get_topics($_GET['from'], isset($_GET['str'])); echo json_encode($list); } }); dispatch_get('Ajax/topics/mark_read', function () { if (Request::valid($_GET['token'])) { $tracker = new CODOF\Forum\Tracker(); $tracker->mark_forum_as_read(); } }); dispatch_get('Ajax/topics/mark_read/:cid', function ($cid) { if (Request::valid($_GET['token'])) { $tracker = new CODOF\Forum\Tracker(); $tracker->mark_category_as_read($cid); }