Moodle PHP Documentation 4.5
Moodle 4.5dev (Build: 20240606) (d3ae1391abe)
block_online_users\fetcher Class Reference

Class used to list and count online users. More...

Public Member Functions

 __construct ($currentgroup, $now, $timetoshowusers, $context, $sitelevel=true, $courseid=null)
 Class constructor.
 
 count_users ()
 Count the number of online users.
 
 get_users ($userlimit=0)
 Get a list of the most recent online users.
 

Public Attributes

string $csql
 The SQL query for counting the number of online users.
 
string $params
 The params for the SQL queries.
 
string $sql
 The SQL query for retrieving a list of online users.
 

Protected Member Functions

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

Detailed Description

Class used to list and count online users.

License
http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later

Constructor & Destructor Documentation

◆ __construct()

block_online_users\fetcher::__construct ( $currentgroup,
$now,
$timetoshowusers,
$context,
$sitelevel = true,
$courseid = null )

Class constructor.

Parameters
int$currentgroupThe group (if any) to filter on
int$nowTime now
int$timetoshowusersNumber of seconds to show online users
context$contextContext object used to generate the sql for users enrolled in a specific course
bool$sitelevelWhether to check online users at site level.
int$courseidThe course id to check

Member Function Documentation

◆ count_users()

block_online_users\fetcher::count_users ( )

Count the number of online users.

Return values
int

◆ get_users()

block_online_users\fetcher::get_users ( $userlimit = 0)

Get a list of the most recent online users.

Parameters
int$userlimitThe maximum number of users that will be returned (optional, unlimited if not set)
Return values
array

◆ set_sql()

block_online_users\fetcher::set_sql ( $currentgroup,
$now,
$timetoshowusers,
$context,
$sitelevel,
$courseid )
protected

Store the SQL queries & params for listing online users.

Parameters
int$currentgroupThe group (if any) to filter on
int$nowTime now
int$timetoshowusersNumber of seconds to show online users
context$contextContext object used to generate the sql for users enrolled in a specific course
bool$sitelevelWhether to check online users at site level.
int$courseidThe course id to check

The documentation for this class was generated from the following file: