diff --git a/htdocs/lib/user.php b/htdocs/lib/user.php index 338087575a7d749ef39ce21cd9d2b27934c24c65..512f1a496c80ae24001bbe1fc7dca9712774c746 100644 --- a/htdocs/lib/user.php +++ b/htdocs/lib/user.php @@ -2023,6 +2023,9 @@ function build_onlinelist_html(&$data, $page) { 'count' => $data['count'], 'limit' => $data['limit'], 'offset' => $data['offset'], + 'datatable' => 'onlinelist', + 'jsonscript' => 'user/online.json.php', + 'setlimit' => true, 'resultcounttextsingular' => $resultcounttextsingular, 'resultcounttextplural' => $resultcounttextplural, 'extradata' => array('page' => $page), diff --git a/htdocs/theme/raw/templates/user/online.tpl b/htdocs/theme/raw/templates/user/online.tpl index 3f29ce08ba4c35fe5eb3b8edc9c968c5fce57670..d4fdb99722df40390b180a597ceee478fbf924ae 100644 --- a/htdocs/theme/raw/templates/user/online.tpl +++ b/htdocs/theme/raw/templates/user/online.tpl @@ -6,4 +6,9 @@ {$data.pagination|safe} +{if $data.pagination_js} + +{/if} {include file="footer.tpl"} diff --git a/htdocs/user/online.json.php b/htdocs/user/online.json.php new file mode 100644 index 0000000000000000000000000000000000000000..33aa09648a04a35a08a6aa7172ac7b80c8849b1b --- /dev/null +++ b/htdocs/user/online.json.php @@ -0,0 +1,34 @@ + null, + 'data' => array( + 'tablerows' => $data['tablerows'], + 'pagination' => $data['pagination'], + 'pagination_js' => $data['pagination_js'], + 'count' => $data['count'], + 'results' => $data['count'] . ' ' . ($data['count'] == 1 ? get_string('result') : get_string('results')), + 'offset' => $offset, + 'setlimit' => $setlimit, + ) +)); \ No newline at end of file diff --git a/htdocs/user/online.php b/htdocs/user/online.php index d6ee66980f3f0c9a671938e9c5dcb239403f373b..c8cd82dd484e59e2b4ba7dd8d02d1ef4b9eb9fb5 100644 --- a/htdocs/user/online.php +++ b/htdocs/user/online.php @@ -17,8 +17,14 @@ define('SECTION_PLUGINNAME', 'user'); define('SECTION_PAGE', 'onlineusers'); $offset = param_integer('offset', 0); -$limit = 10; - +$limit = param_integer('limit', 10); +$userlimit = get_account_preference($USER->get('id'), 'viewsperpage'); +if ($limit > 0 && $limit != $userlimit) { + $USER->set_account_preference('viewsperpage', $limit); +} +else { + $limit = $userlimit; +} $data = get_onlineusers($limit, $offset); build_onlinelist_html($data, 'online');