online.php 1.08 KB
Newer Older
1 2 3 4 5 6
<?php
/**
 *
 * @package    mahara
 * @subpackage core
 * @author     Stacey Walker
7 8
 * @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.
9 10 11 12 13 14 15 16 17 18 19
 *
 */

define('INTERNAL', 1);
require(dirname(dirname(__FILE__)) . '/init.php');
define('TITLE', get_string('onlineusers'));
define('SECTION_PLUGINTYPE', 'core');
define('SECTION_PLUGINNAME', 'user');
define('SECTION_PAGE', 'onlineusers');

$offset = param_integer('offset', 0);
20 21 22 23 24 25 26 27
$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;
}
28 29 30 31 32 33 34 35
$data = get_onlineusers($limit, $offset);
build_onlinelist_html($data, 'online');

$smarty = smarty(array('paginator'));
$smarty->assign('PAGEHEADING', TITLE);
$smarty->assign('lastminutes', floor(get_config('accessidletimeout') / 60));
$smarty->assign('data', $data);
$smarty->display('user/online.tpl');