Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 4.1.x will end 13 November 2023 (12 months).
  • Bug fixes for security issues in 4.1.x will end 10 November 2025 (36 months).
  • PHP version: minimum PHP 7.4.0 Note: minimum PHP version has increased since Moodle 4.0. PHP 8.0.x is supported too.

Differences Between: [Versions 400 and 401]

(no description)

File Size: 398 lines (14 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class


Class: schedule  - X-Ref

Helper class for report schedule related methods

create_schedule(stdClass $data, ?int $timenow = null)   X-Ref
Create report schedule, calculate when it should be next sent

param: stdClass $data
param: int|null $timenow Time to use as comparison against current date (defaults to current time)
return: model

update_schedule(stdClass $data)   X-Ref
Update report schedule

param: stdClass $data
return: model

toggle_schedule(int $reportid, int $scheduleid, bool $enabled)   X-Ref
Toggle report schedule enabled

param: int $reportid
param: int $scheduleid
param: bool $enabled
return: bool

get_schedule_report_users(model $schedule)   X-Ref
Return array of users who match the audience records added to the given schedule

param: model $schedule
return: stdClass[]

get_schedule_report_count(model $schedule)   X-Ref
Return count of schedule report rows

param: model $schedule
return: int

get_schedule_report_file(model $schedule)   X-Ref
Generate stored file instance for given schedule, in user draft

param: model $schedule
return: stored_file

should_send_schedule(model $schedule)   X-Ref
No description

calculate_next_send_time(model $schedule, ?int $timenow = null)   X-Ref
Calculate the next time a schedule should be sent, based on it's recurrence and when it was initially scheduled. Ensures
returned value is after the current date

param: model $schedule
param: int|null $timenow Time to use as comparison against current date (defaults to current time)
return: int

send_schedule_message(model $schedule, stdClass $user, stored_file $attachment)   X-Ref
Send schedule message to user

param: model $schedule
param: stdClass $user
param: stored_file $attachment
return: bool

delete_schedule(int $reportid, int $scheduleid)   X-Ref
Delete report schedule

param: int $reportid
param: int $scheduleid
return: bool

get_format_options()   X-Ref
Return list of available data formats

return: string[]

get_viewas_options()   X-Ref
Return list of available view as user options

return: string[]

get_recurrence_options()   X-Ref
Return list of recurrence options

return: string[]

get_report_empty_options()   X-Ref
Return list of options for when report is empty

return: string[]