Moodle PHP Documentation 5.1
Moodle 5.1dev (Build: 20250706) (a6b17d8f6bd)
mod_assign\notification_helper Class Reference

Static Public Member Functions

static get_due_digest_assignments ()
 Get all assignments that are due in 7 days (includes users and groups with due date overrides).
 
static get_due_digest_assignments_for_user (int $userid)
 Get all assignments for a user that are due in 7 days (includes users and groups with due date overrides).
 
static get_due_soon_assignments ()
 Get all assignments that have an approaching due date (includes users and groups with due date overrides).
 
static get_overdue_assignments ()
 Get all assignments that are overdue, but not exceeding the cut-off date (includes users and groups with due date overrides).
 
static get_users_within_assignment (int $assignmentid, string $type)
 Get all assignment users that we should send the notification to.
 
static send_due_digest_notification_to_user (int $userid)
 Get all the assignments and send the due digest notification to the user.
 
static send_due_soon_notification_to_user (int $assignmentid, int $userid)
 Send the due soon notification to the user.
 
static send_overdue_notification_to_user (int $assignmentid, int $userid)
 Send the overdue notification to the user.
 

Public Attributes

string const TYPE_DUE_DIGEST = 'assign_due_digest'
 Due digest notification type.
 
string const TYPE_DUE_SOON = 'assign_due_soon'
 Due soon notification type.
 
string const TYPE_OVERDUE = 'assign_overdue'
 Overdue notification type.
 

Static Protected Member Functions

static get_assignment_data (int $assignmentid)
 Get the assignment object, including the course and course module.
 
static get_day_start_and_end (int $timestamp)
 Get the timestamps for the start (00:00:00) and end (23:59:59) of the provided day.
 
static get_future_time (int $interval)
 Get a future time.
 
static get_time_now ()
 Get the time now.
 
static has_user_been_sent_a_notification_already (int $userid, string $match, string $type)
 Check if a user has been sent a notification already.
 
static is_time_within_range (int $time, array $range)
 Check if a time is within the current time now and the future time values (inclusive).
 

Member Function Documentation

◆ get_assignment_data()

static mod_assign\notification_helper::get_assignment_data ( int $assignmentid)
staticprotected

Get the assignment object, including the course and course module.

Parameters
int$assignmentidThe assignment id.
Return values
assignReturns the assign object.

◆ get_day_start_and_end()

static mod_assign\notification_helper::get_day_start_and_end ( int $timestamp)
staticprotected

Get the timestamps for the start (00:00:00) and end (23:59:59) of the provided day.

Parameters
int$timestampThe timestamp to base the calculation on.
Return values
arrayDay start and end timestamps.

◆ get_due_digest_assignments()

static mod_assign\notification_helper::get_due_digest_assignments ( )
static

Get all assignments that are due in 7 days (includes users and groups with due date overrides).

Return values
moodle_recordsetReturns the matching assignment records.

◆ get_due_digest_assignments_for_user()

static mod_assign\notification_helper::get_due_digest_assignments_for_user ( int $userid)
static

Get all assignments for a user that are due in 7 days (includes users and groups with due date overrides).

Parameters
int$useridThe user id.
Return values
moodle_recordsetReturns the matching assignment records.

◆ get_due_soon_assignments()

static mod_assign\notification_helper::get_due_soon_assignments ( )
static

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

Return values
moodle_recordsetReturns the matching assignment records.

◆ get_future_time()

static mod_assign\notification_helper::get_future_time ( int $interval)
staticprotected

Get a future time.

Parameters
int$intervalAmount of seconds added to the now time.
Return values
intThe time now value plus the interval.

◆ get_overdue_assignments()

static mod_assign\notification_helper::get_overdue_assignments ( )
static

Get all assignments that are overdue, but not exceeding the cut-off date (includes users and groups with due date overrides).

We don't want to get every single overdue assignment ever. We just want the ones within the specified window.

Return values
moodle_recordsetReturns the matching assignment records.

◆ get_time_now()

static mod_assign\notification_helper::get_time_now ( )
staticprotected

Get the time now.

Return values
intThe time now as a timestamp.

◆ get_users_within_assignment()

static mod_assign\notification_helper::get_users_within_assignment ( int $assignmentid,
string $type )
static

Get all assignment users that we should send the notification to.

Parameters
int$assignmentidThe assignment id.
string$typeThe notification type.
Return values
arrayThe users after all filtering has been applied.

◆ has_user_been_sent_a_notification_already()

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

Check if a user has been sent a notification already.

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

◆ is_time_within_range()

static mod_assign\notification_helper::is_time_within_range ( int $time,
array $range )
staticprotected

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

Parameters
int$timeThe timestamp to check.
array$rangeLower and upper times to check.
Return values
boolean

◆ send_due_digest_notification_to_user()

static mod_assign\notification_helper::send_due_digest_notification_to_user ( int $userid)
static

Get all the assignments and send the due digest notification to the user.

Parameters
int$useridThe user id.

◆ send_due_soon_notification_to_user()

static mod_assign\notification_helper::send_due_soon_notification_to_user ( int $assignmentid,
int $userid )
static

Send the due soon notification to the user.

Parameters
int$assignmentidThe assignment id.
int$useridThe user id.

◆ send_overdue_notification_to_user()

static mod_assign\notification_helper::send_overdue_notification_to_user ( int $assignmentid,
int $userid )
static

Send the overdue notification to the user.

Parameters
int$assignmentidThe assignment id.
int$useridThe user id.

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