Moodle PHP Documentation 5.1
Moodle 5.1dev (Build: 20250711) (9addea9f0ac)
mod_quiz\notification_helper Class Reference

Static Public Member Functions

static get_quizzes_within_date_range ()
 Get all quizzes that have an approaching open date (includes users and groups with open date overrides).
 
static get_users_within_quiz (int $quizid)
 Get all users that have an approaching open date within a quiz.
 
static send_notification_to_user (stdClass $user)
 Send the notification to the user.
 

Static Protected Member Functions

static get_future_time (?int $range=null)
 Get a future time that serves as the cut-off for this notification.
 
static get_time_now ()
 Get the time now.
 
static has_user_attempted (stdClass $user)
 Check if a user has attempted this quiz already.
 
static has_user_been_sent_a_notification_already (int $userid, string $match)
 Check if a user has been sent a notification already.
 
static is_time_within_range (int $time)
 Check if a time is within the current time now and the future time values.
 
static update_user_with_date_overrides (array $overrides, stdClass $user)
 Update user's recorded date based on the overrides.
 

Member Function Documentation

◆ get_future_time()

static mod_quiz\notification_helper::get_future_time ( ?int $range = null)
staticprotected

Get a future time that serves as the cut-off for this notification.

Parameters
int | null$rangeAmount of seconds added to the now time (optional).
Return values
intThe time now value plus the range.

◆ get_quizzes_within_date_range()

static mod_quiz\notification_helper::get_quizzes_within_date_range ( )
static

Get all quizzes that have an approaching open date (includes users and groups with open date overrides).

Return values
moodle_recordsetReturns the matching quiz records.

◆ get_time_now()

static mod_quiz\notification_helper::get_time_now ( )
staticprotected

Get the time now.

Return values
intThe time now as a timestamp.

◆ get_users_within_quiz()

static mod_quiz\notification_helper::get_users_within_quiz ( int $quizid)
static

Get all users that have an approaching open date within a quiz.

Parameters
int$quizidThe quiz id.
Return values
arrayThe users after all filtering has been applied.

◆ has_user_attempted()

static mod_quiz\notification_helper::has_user_attempted ( stdClass $user)
staticprotected

Check if a user has attempted this quiz already.

Parameters
stdClass$userThe user record we will be checking.
Return values
boolReturn true if attempt found.

◆ has_user_been_sent_a_notification_already()

static mod_quiz\notification_helper::has_user_been_sent_a_notification_already ( int $userid,
string $match )
staticprotected

Check if a user has been sent a notification already.

Parameters
int$useridThe user id.
string$matchThe custom data string to match on.
Return values
boolReturns true if already sent.

◆ is_time_within_range()

static mod_quiz\notification_helper::is_time_within_range ( int $time)
staticprotected

Check if a time is within the current time now and the future time values.

Parameters
int$timeThe timestamp to check.
Return values
boolean

◆ send_notification_to_user()

static mod_quiz\notification_helper::send_notification_to_user ( stdClass $user)
static

Send the notification to the user.

Parameters
stdClass$userThe user's custom data.

◆ update_user_with_date_overrides()

static mod_quiz\notification_helper::update_user_with_date_overrides ( array $overrides,
stdClass $user )
staticprotected

Update user's recorded date based on the overrides.

Parameters
array$overridesThe overrides to check.
stdClass$userThe user records we will be updating.

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