Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 4.1.x will end 13 November 2023 (12 months).
  • Bug fixes for security issues in 4.1.x will end 10 November 2025 (36 months).
  • PHP version: minimum PHP 7.4.0 Note: minimum PHP version has increased since Moodle 4.0. PHP 8.0.x is supported too.

Differences Between: [Versions 310 and 401] [Versions 39 and 401]

File containing onlineusers class.

Copyright: 1999 onwards Martin Dougiamas (http://dougiamas.com)
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 193 lines (8 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

fetcher:: (4 methods):
  __construct()
  set_sql()
  get_users()
  count_users()


Class: fetcher  - X-Ref

Class used to list and count online users

__construct($currentgroup, $now, $timetoshowusers, $context, $sitelevel = true, $courseid = null)   X-Ref
Class constructor

param: int $currentgroup The group (if any) to filter on
param: int $now Time now
param: int $timetoshowusers Number of seconds to show online users
param: context $context Context object used to generate the sql for users enrolled in a specific course
param: bool $sitelevel Whether to check online users at site level.
param: int $courseid The course id to check

set_sql($currentgroup, $now, $timetoshowusers, $context, $sitelevel, $courseid)   X-Ref
Store the SQL queries & params for listing online users

param: int $currentgroup The group (if any) to filter on
param: int $now Time now
param: int $timetoshowusers Number of seconds to show online users
param: context $context Context object used to generate the sql for users enrolled in a specific course
param: bool $sitelevel Whether to check online users at site level.
param: int $courseid The course id to check

get_users($userlimit = 0)   X-Ref
Get a list of the most recent online users

param: int $userlimit The maximum number of users that will be returned (optional, unlimited if not set)
return: array

count_users()   X-Ref
Count the number of online users

return: int