Adhoc task to send moodle forum digests for the specified user.
More...
|
| add_discussion_footer ($discussion) |
| Add the footer for this discussion. More...
|
|
| add_discussion_header ($discussion, $forum, $course) |
| Add the header for this discussion. More...
|
|
| add_message_header () |
| Add the header to this message.
|
|
| add_post_body ($author, $post, $discussion, $forum, $cm, $course) |
| Add the body of this post. More...
|
|
| empty_queue (int $userid, int $timemodified) |
| Empty the queue of posts for this user. More...
|
|
| fill_digest_cache () |
| Fill the cron digest cache.
|
|
| get_default_concurrency_limit () |
| Returns default concurrency limit for this task. More...
|
|
| get_maildigest ($forumid) |
| Get the forum digest type for the specified forum, failing back to the default setting for the current user if not specified. More...
|
|
| get_post_author ($userid, $course, $forum, $cm, $context) |
| Fetch and initialise the post author. More...
|
|
| get_renderer ($maildigest, $html=false) |
| Helper to fetch the required renderer, instantiating as required. More...
|
|
| prepare_data (int $timenow) |
| Prepare the data for this run. More...
|
|
| send_mail () |
| Send the composed message to the user.
|
|
|
bool | $allowhtml = true |
| Whether the user has requested HTML or not.
|
|
bool[] | $canpostto = [] |
| Whether the user can post in each forum.
|
|
stdClass[] | $courses = [] |
| Courses with posts them.
|
|
string | $discussionhtml = '' |
| The HTML content for the current discussion being processed.
|
|
stdClass[] | $discussions = [] |
| Discussions with posts them.
|
|
string | $discussiontext = '' |
| The plaintext content for the current discussion being processed.
|
|
stdClass[] | $forumdigesttypes = [] |
| A list of any per-forum digest preference that this user holds.
|
|
stdClass[] | $forums = [] |
| Forums with posts them.
|
|
int[] | $markpostsasread = [] |
| A list of post IDs to be marked as read for this user.
|
|
string | $notificationhtml = '' |
| The HTML content of the whole message.
|
|
string | $notificationtext = '' |
| The plaintext content of the whole message.
|
|
stdClass[] | $posts = [] |
| The posts to be sent.
|
|
string | $postsubject = '' |
| The subject of the message.
|
|
stdClass | $recipient |
| A shortcut to $USER.
|
|
renderer[][] | $renderers |
| A cache of the different types of renderer, stored both by target (HTML, or Text), and type. More...
|
|
int | $sentcount = 0 |
| The number of messages sent in this digest.
|
|
stdClass[] | $users = [] |
| The various authors.
|
|
bool[] | $viewfullnames = [] |
| Whether the user can view fullnames for each forum.
|
|
Adhoc task to send moodle forum digests for the specified user.
- Copyright
- 2018 Andrew Nicols andre.nosp@m.w@ni.nosp@m.cols..nosp@m.co.u.nosp@m.k
- License
- http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
◆ add_discussion_footer()
mod_forum\task\send_user_digests::add_discussion_footer |
( |
|
$discussion | ) |
|
|
protected |
Add the footer for this discussion.
- Parameters
-
stdClass | $discussion | The discussion to add the footer for |
◆ add_discussion_header()
mod_forum\task\send_user_digests::add_discussion_header |
( |
|
$discussion, |
|
|
|
$forum, |
|
|
|
$course |
|
) |
| |
|
protected |
Add the header for this discussion.
- Parameters
-
stdClass | $discussion | The discussion to add the footer for |
stdClass | $forum | The forum that the discussion belongs to |
stdClass | $course | The course that the forum belongs to |
◆ add_post_body()
mod_forum\task\send_user_digests::add_post_body |
( |
|
$author, |
|
|
|
$post, |
|
|
|
$discussion, |
|
|
|
$forum, |
|
|
|
$cm, |
|
|
|
$course |
|
) |
| |
|
protected |
Add the body of this post.
- Parameters
-
stdClass | $author | The author of the post |
stdClass | $post | The post being sent |
stdClass | $discussion | The discussion that the post is in |
stdClass | $forum | The forum that the discussion belongs to |
cminfo | $cm | The cminfo object for the forum |
stdClass | $course | The course that the forum belongs to |
◆ empty_queue()
mod_forum\task\send_user_digests::empty_queue |
( |
int |
$userid, |
|
|
int |
$timemodified |
|
) |
| |
|
protected |
Empty the queue of posts for this user.
- Parameters
-
int | $userid | user id which queue elements are going to be removed. |
int | $timemodified | up time limit of the queue elements to be removed. |
◆ execute()
mod_forum\task\send_user_digests::execute |
( |
| ) |
|
◆ get_component()
core\task\task_base::get_component |
( |
| ) |
|
|
inherited |
Getter for $component.
- Return values
-
◆ get_concurrency_limit()
core\task\adhoc_task::get_concurrency_limit |
( |
| ) |
|
|
finalinherited |
Returns effective concurrency limit for this task.
- Return values
-
int | effective concurrency limit for this task |
◆ get_cron_lock()
core\task\task_base::get_cron_lock |
( |
| ) |
|
|
inherited |
Get the current lock for the entire cron.
- Return values
-
◆ get_custom_data()
core\task\adhoc_task::get_custom_data |
( |
| ) |
|
|
inherited |
Getter for $customdata.
- Return values
-
mixed | (anything that can be handled by json_decode). |
◆ get_custom_data_as_string()
core\task\adhoc_task::get_custom_data_as_string |
( |
| ) |
|
|
inherited |
Alternate getter for $customdata.
- Return values
-
string | this is the raw json encoded version. |
◆ get_default_concurrency_limit()
core\task\adhoc_task::get_default_concurrency_limit |
( |
| ) |
|
|
protectedinherited |
Returns default concurrency limit for this task.
- Return values
-
int | default concurrency limit |
◆ get_fail_delay()
core\task\task_base::get_fail_delay |
( |
| ) |
|
|
inherited |
Getter for $faildelay.
- Return values
-
◆ get_id()
core\task\adhoc_task::get_id |
( |
| ) |
|
|
inherited |
Getter for $id.
- Return values
-
◆ get_lock()
core\task\task_base::get_lock |
( |
| ) |
|
|
inherited |
Get the current lock for this task.
- Return values
-
◆ get_maildigest()
mod_forum\task\send_user_digests::get_maildigest |
( |
|
$forumid | ) |
|
|
protected |
Get the forum digest type for the specified forum, failing back to the default setting for the current user if not specified.
- Parameters
-
- Return values
-
◆ get_next_run_time()
core\task\task_base::get_next_run_time |
( |
| ) |
|
|
inherited |
Get the next run time for this task.
- Return values
-
◆ get_post_author()
mod_forum\task\send_user_digests::get_post_author |
( |
|
$userid, |
|
|
|
$course, |
|
|
|
$forum, |
|
|
|
$cm, |
|
|
|
$context |
|
) |
| |
|
protected |
Fetch and initialise the post author.
- Parameters
-
int | $userid | The id of the user to fetch |
stdClass | $course | |
stdClass | $forum | |
stdClass | $cm | |
context | $context | |
- Return values
-
◆ get_renderer()
mod_forum\task\send_user_digests::get_renderer |
( |
|
$maildigest, |
|
|
|
$html = false |
|
) |
| |
|
protected |
Helper to fetch the required renderer, instantiating as required.
- Parameters
-
int | $maildigest | The type of mail digest being sent |
bool | $html | Whether to fetch the HTML renderer |
- Return values
-
◆ get_userid()
core\task\adhoc_task::get_userid |
( |
| ) |
|
|
inherited |
Getter for $userid.
- Return values
-
◆ is_blocking()
core\task\task_base::is_blocking |
( |
| ) |
|
|
inherited |
Getter for $blocking.
- Return values
-
◆ prepare_data()
mod_forum\task\send_user_digests::prepare_data |
( |
int |
$timenow | ) |
|
|
protected |
Prepare the data for this run.
Note: This will also remove posts from the queue.
- Parameters
-
◆ set_blocking()
core\task\task_base::set_blocking |
( |
|
$blocking | ) |
|
|
inherited |
Setter for $blocking.
- Parameters
-
◆ set_component()
core\task\task_base::set_component |
( |
|
$component | ) |
|
|
inherited |
Setter for $component.
- Parameters
-
◆ set_concurrency_lock()
Sets concurrency task lock.
- Parameters
-
◆ set_cron_lock()
Set the current lock for the entire cron process.
- Parameters
-
◆ set_custom_data()
core\task\adhoc_task::set_custom_data |
( |
|
$customdata | ) |
|
|
inherited |
Setter for $customdata.
- Parameters
-
mixed | $customdata | (anything that can be handled by json_encode) |
◆ set_custom_data_as_string()
core\task\adhoc_task::set_custom_data_as_string |
( |
|
$customdata | ) |
|
|
inherited |
Alternate setter for $customdata.
Expects the data as a json_encoded string.
- Parameters
-
string | $customdata | json_encoded string |
◆ set_fail_delay()
core\task\task_base::set_fail_delay |
( |
|
$faildelay | ) |
|
|
inherited |
Setter for $faildelay.
- Parameters
-
◆ set_id()
core\task\adhoc_task::set_id |
( |
|
$id | ) |
|
|
inherited |
Setter for $id.
- Parameters
-
◆ set_lock()
Set the current lock for this task.
- Parameters
-
◆ set_next_run_time()
core\task\task_base::set_next_run_time |
( |
|
$nextruntime | ) |
|
|
inherited |
Set the next run time for this task.
- Parameters
-
◆ set_userid()
core\task\adhoc_task::set_userid |
( |
|
$userid | ) |
|
|
inherited |
Setter for $userid.
- Parameters
-
◆ $renderers
renderer [][] mod_forum\task\send_user_digests::$renderers |
|
protected |
Initial value:= [
'html' => [],
'text' => [],
]
A cache of the different types of renderer, stored both by target (HTML, or Text), and type.
The documentation for this class was generated from the following file: