| @@ 327-333 (lines=7) @@ | ||
| 324 | $plugin->enrol_user($plugin_instance, $userid, $plugin_instance->roleid, $timestart, $timeend); |
|
| 325 | ||
| 326 | // Pass $view=true to filter hidden caps if the user cannot see them |
|
| 327 | if ($users = get_users_by_capability($context, 'moodle/course:update', 'u.*', 'u.id ASC', |
|
| 328 | '', '', '', '', false, true)) { |
|
| 329 | $users = sort_by_roleassignment_authority($users, $context); |
|
| 330 | $teacher = array_shift($users); |
|
| 331 | } else { |
|
| 332 | $teacher = get_admin(); |
|
| 333 | } |
|
| 334 | ||
| 335 | $mailstudents = $plugin->get_config('mailstudents'); |
|
| 336 | $mailteachers = $plugin->get_config('mailteachers'); |
|
| @@ 157-163 (lines=7) @@ | ||
| 154 | $strcourses = get_string("courses"); |
|
| 155 | ||
| 156 | // Pass $view=true to filter hidden caps if the user cannot see them. |
|
| 157 | if ($users = get_users_by_capability($context, 'moodle/course:update', 'u.*', 'u.id ASC', |
|
| 158 | '', '', '', '', false, true)) { |
|
| 159 | $users = sort_by_roleassignment_authority($users, $context); |
|
| 160 | $teacher = array_shift($users); |
|
| 161 | } else { |
|
| 162 | $teacher = false; |
|
| 163 | } |
|
| 164 | ||
| 165 | if ( (float) $instance->cost <= 0 ) { |
|
| 166 | $cost = (float) $this->get_config('cost'); |
|