Browse Source

Add teacher notification setting (sendmailtoteacher) per instance.

SABERES_37_STABLE
Johannes Burk 9 years ago
parent
commit
25a19cf32c
  1. 2
      edit.php
  2. 2
      edit_form.php
  3. 2
      lib.php

2
edit.php

@ -55,6 +55,7 @@ if ($mform->is_cancelled()) {
$instance->customtext1 = $data->customtext1; $instance->customtext1 = $data->customtext1;
$instance->customint1 = $data->customint1; $instance->customint1 = $data->customint1;
$instance->customint2 = $data->customint2; $instance->customint2 = $data->customint2;
$instance->customint3 = $data->customint3;
$instance->roleid = $data->roleid; $instance->roleid = $data->roleid;
$instance->timemodified = time(); $instance->timemodified = time();
$DB->update_record('enrol', $instance); $DB->update_record('enrol', $instance);
@ -64,6 +65,7 @@ if ($mform->is_cancelled()) {
'status' =>$data->status, 'status' =>$data->status,
'name' =>$data->name, 'name' =>$data->name,
'roleid' =>$data->roleid, 'roleid' =>$data->roleid,
'customint3' =>$data->customint3,
'customtext1' =>$data->customtext1); 'customtext1' =>$data->customtext1);
$plugin->add_instance($course, $fields); $plugin->add_instance($course, $fields);
} }

2
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->addElement('select', 'customint2', get_string('show_extra_user_profile', 'enrol_apply'), $options);
$mform->setDefault('customint2', $plugin->get_config('customint2')); $mform->setDefault('customint2', $plugin->get_config('customint2'));
$mform->addElement('advcheckbox', 'customint3', get_string('sendmailtoteacher', 'enrol_apply'));
$mform->addElement('hidden', 'id'); $mform->addElement('hidden', 'id');
$mform->setType('id', PARAM_INT); $mform->setType('id', PARAM_INT);
$mform->addElement('hidden', 'courseid'); $mform->addElement('hidden', 'courseid');

2
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; ($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); $course = get_course($courseid);
$context = context_course::instance($courseid, MUST_EXIST); $context = context_course::instance($courseid, MUST_EXIST);
$teacherType = $DB->get_record('role',array("shortname"=>"editingteacher")); $teacherType = $DB->get_record('role',array("shortname"=>"editingteacher"));

Loading…
Cancel
Save