-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtopics.php
More file actions
47 lines (40 loc) · 1.52 KB
/
topics.php
File metadata and controls
47 lines (40 loc) · 1.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<?php
/**
*
* @package mahara
* @subpackage core
* @author Catalyst IT Ltd
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL version 3 or later
* @copyright For copyright information on Mahara, please see the README file distributed with this software.
*
*/
define('INTERNAL', 1);
define('MENUITEM', 'groups/topics');
define('SECTION_PLUGINTYPE', 'core');
define('SECTION_PLUGINNAME', 'group');
define('SECTION_PAGE', 'topics');
require(dirname(dirname(__FILE__)) . '/init.php');
safe_require('interaction', 'forum');
require_once('group.php');
define('TITLE', get_string('Topics', 'interaction.forum'));
if (!$USER->is_logged_in()) {
throw new AccessDeniedException(get_string('accessdenied', 'error'));
}
$limit = param_integer('limit', 10);
$offset = param_integer('offset', 0);
$category = param_integer('category', 0);
$data = PluginInteractionForum::get_active_topics($limit, $offset, $category);
$pagination = build_pagination(array(
'id' => 'topics_pagination',
'url' => get_config('wwwroot') . 'group/topics.php' . ($category ? ('?category=' . (int) $category) : ''),
'jsonscript' => 'json/topics.php',
'datatable' => 'topiclist',
'count' => $data['count'],
'limit' => $limit,
'offset' => $offset,
));
$smarty = smarty(array('paginator'));
$smarty->assign('topics', $data['data']);
$smarty->assign('pagination', $pagination['html']);
$smarty->assign('INLINEJAVASCRIPT', 'addLoadEvent(function() { p = ' . $pagination['javascript'] . '});');
$smarty->display('group/topics.tpl');