@@ -47,7 +47,7 @@ public function get_name() {
47
47
* Execute.
48
48
*/
49
49
public function execute () {
50
- global $ DB , $ PAGE ;
50
+ global $ DB ;
51
51
52
52
// Get all the certificates that have requested someone get emailed.
53
53
$ emailotherslengthsql = $ DB ->sql_length ('c.emailothers ' );
@@ -66,8 +66,9 @@ public function execute() {
66
66
}
67
67
68
68
// The renderers used for sending emails.
69
- $ htmlrenderer = $ PAGE ->get_renderer ('mod_customcert ' , 'email ' , 'htmlemail ' );
70
- $ textrenderer = $ PAGE ->get_renderer ('mod_customcert ' , 'email ' , 'textemail ' );
69
+ $ page = new \moodle_page ();
70
+ $ htmlrenderer = $ page ->get_renderer ('mod_customcert ' , 'email ' , 'htmlemail ' );
71
+ $ textrenderer = $ page ->get_renderer ('mod_customcert ' , 'email ' , 'textemail ' );
71
72
foreach ($ customcerts as $ customcert ) {
72
73
// Do not process an empty certificate.
73
74
$ sql = "SELECT ce.*
@@ -84,8 +85,8 @@ public function execute() {
84
85
// Get the context.
85
86
$ context = \context::instance_by_id ($ customcert ->contextid );
86
87
87
- // Set the $PAGE context - this ensure settings, such as language, are kept and don't default to the site settings.
88
- $ PAGE ->set_context ($ context );
88
+ // Set the $page context - this ensures settings, such as language, are kept and don't default to the site settings.
89
+ $ page ->set_context ($ context );
89
90
90
91
// Get the person we are going to send this email on behalf of.
91
92
$ userfrom = \core_user::get_noreply_user ();
0 commit comments