The forum module trait with additional generator helpers.
Copyright: | 2018 Andrew Nicols <andrew@nicols.co.uk> |
License: | http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later |
File Size: | 174 lines (6 kb) |
Included or required: | 18 times |
Referenced: | 1 time |
Includes or requires: | 0 files |
helper_create_users($course, $count, $role = null) X-Ref |
Helper to create the required number of users in the specified course. Users are enrolled as students by default. return: array The users created param: stdClass $course The course object param: integer $count The number of users to create param: string $role The role to assign users as |
helper_post_to_forum($forum, $author, $fields = array() X-Ref |
Create a new discussion and post within the specified forum, as the specified author. return: array An array containing the discussion object, and the post object param: stdClass $forum The forum to post in param: stdClass $author The author to post as param: array $fields any other fields in discussion (name, message, messageformat, ...) |
helper_update_post_time($post, $factor) X-Ref |
Update the post time for the specified post by $factor. param: stdClass $post The post to update param: int $factor The amount to update by |
helper_update_subscription_time($user, $discussion, $factor) X-Ref |
Update the subscription time for the specified user/discussion by $factor. param: stdClass $user The user to update param: stdClass $discussion The discussion to update for this user param: int $factor The amount to update by |
helper_post_to_discussion($forum, $discussion, $author, array $options = []) X-Ref |
Create a new post within an existing discussion, as the specified author. return: stdClass The forum post param: stdClass $forum The forum to post in param: stdClass $discussion The discussion to post in param: stdClass $author The author to post as param: array $options Additional options to pass to `create_post` |
helper_reply_to_post($parent, $author, array $options = []) X-Ref |
Create a new post within an existing discussion, as the specified author. return: stdClass The forum post param: stdClass $parent The post being replied to param: stdClass $author The author to post as param: array $options Additional options to pass to `create_post` |
get_role_id($roleshortname) X-Ref |
Gets the role id from it's shortname. return: int param: string $roleshortname |