Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.0.x will end 8 May 2023 (12 months).
  • Bug fixes for security issues in 4.0.x will end 13 November 2023 (18 months).
  • PHP version: minimum PHP 7.3.0 Note: the minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is also supported.

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

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

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

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

return: int