From 25a19cf32c55f1fd9350f394711659534e65e53b Mon Sep 17 00:00:00 2001 From: Johannes Burk Date: Sat, 9 Apr 2016 11:04:05 +0200 Subject: [PATCH] Add teacher notification setting (sendmailtoteacher) per instance. --- edit.php | 2 ++ edit_form.php | 2 ++ lib.php | 2 +- 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/edit.php b/edit.php index 36e4a33..5060e25 100644 --- a/edit.php +++ b/edit.php @@ -55,6 +55,7 @@ if ($mform->is_cancelled()) { $instance->customtext1 = $data->customtext1; $instance->customint1 = $data->customint1; $instance->customint2 = $data->customint2; + $instance->customint3 = $data->customint3; $instance->roleid = $data->roleid; $instance->timemodified = time(); $DB->update_record('enrol', $instance); @@ -64,6 +65,7 @@ if ($mform->is_cancelled()) { 'status' =>$data->status, 'name' =>$data->name, 'roleid' =>$data->roleid, + 'customint3' =>$data->customint3, 'customtext1' =>$data->customtext1); $plugin->add_instance($course, $fields); } diff --git a/edit_form.php b/edit_form.php index 7cbec9b..cdaaa4d 100644 --- a/edit_form.php +++ b/edit_form.php @@ -48,6 +48,8 @@ class enrol_self_edit_form extends moodleform { $mform->addElement('select', 'customint2', get_string('show_extra_user_profile', 'enrol_apply'), $options); $mform->setDefault('customint2', $plugin->get_config('customint2')); + $mform->addElement('advcheckbox', 'customint3', get_string('sendmailtoteacher', 'enrol_apply')); + $mform->addElement('hidden', 'id'); $mform->setType('id', PARAM_INT); $mform->addElement('hidden', 'courseid'); diff --git a/lib.php b/lib.php index 781fe41..de70026 100644 --- a/lib.php +++ b/lib.php @@ -375,7 +375,7 @@ function sendConfirmMailToTeachers($instance,$info,$applydescription){ ($apply_setting['show_extra_user_profile']->value == 0)?$show_extra_user_profile = true:$show_extra_user_profile = false; } - if($apply_setting['sendmailtoteacher']->value == 1){ + if($instance->customint3 == 1){ $course = get_course($courseid); $context = context_course::instance($courseid, MUST_EXIST); $teacherType = $DB->get_record('role',array("shortname"=>"editingteacher"));