Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.11.x will end 14 Nov 2022 (12 months plus 6 months extension).
  • Bug fixes for security issues in 3.11.x will end 13 Nov 2023 (18 months plus 12 months extension).
  • PHP version: minimum PHP 7.3.0 Note: minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is supported too.

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

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