diff --git a/adminsettings.php b/adminsettings.php
index 4d26b4a..9dee70d 100755
--- a/adminsettings.php
+++ b/adminsettings.php
@@ -74,7 +74,7 @@
} else {
$record->category_mode = 0;
}
- $record->mode_flags = 0;
+ //$record->mode_flags = 0;
$persistent = new \block_evasys_sync\evasys_category(0, $record);
$persistent->create();
if ($evasysroleid) {
diff --git a/classes/evaluation_manager.php b/classes/evaluation_manager.php
index bc6d0f6..e11ab69 100644
--- a/classes/evaluation_manager.php
+++ b/classes/evaluation_manager.php
@@ -109,11 +109,13 @@ public static function set_default_evaluation_for($courseids, evasys_category $c
$data->courseshort = $course->shortname;
$data->coursefull = $course->fullname;
- foreach ($teachers as $teacher) {
- email_to_user($teacher, $coordinatoruser,
+ if ($category->send_mail_to_teacher()) {
+ foreach ($teachers as $teacher) {
+ email_to_user($teacher, $coordinatoruser,
get_string('notify_teacher_email_subject', 'block_evasys_sync', $data),
get_string('notify_teacher_email_body', 'block_evasys_sync', $data)
- );
+ );
+ }
}
self::clear_error($course->id);
diff --git a/classes/evasys_category.php b/classes/evasys_category.php
index a4c05e3..55b569e 100644
--- a/classes/evasys_category.php
+++ b/classes/evasys_category.php
@@ -43,6 +43,7 @@ class evasys_category extends persistent {
const MASK_AUTOMATIC_TASK_CREATION = 1 << 2;
const MASK_TEACHER_CAN_CHANGE_EVALUATION = 1 << 3;
const MASK_EVALUATION_CHANGE_NEEDS_APPROVAL = 1 << 4;
+ const MASK_SEND_MAIL_TO_TEACHER = 1 << 5;
/**
* Return the definition of the properties of this model.
@@ -64,6 +65,7 @@ protected static function define_properties() {
'message' => new \lang_string('invalidmode', 'block_evasys_sync')
),
'mode_flags' => array(
+ 'default' => 33,
'type' => PARAM_INT
),
'standard_time_start' => array (
@@ -119,6 +121,10 @@ public function can_teacher_request_evaluation() : bool {
return $this->get('mode_flags') & self::MASK_TEACHER_CAN_REQUEST_EVALUATION;
}
+ public function send_mail_to_teacher() : bool {
+ return $this->get('mode_flags') & self::MASK_SEND_MAIL_TO_TEACHER;
+ }
+
public function teacher_evaluation_request_needs_approval() : bool {
return $this->get('mode_flags') & self::MASK_EVALUATION_REQUEST_NEEDS_APPROVAL;
}
diff --git a/classes/local/form/evasys_category_edit_form.php b/classes/local/form/evasys_category_edit_form.php
index d71db34..57efd07 100644
--- a/classes/local/form/evasys_category_edit_form.php
+++ b/classes/local/form/evasys_category_edit_form.php
@@ -69,6 +69,11 @@ protected function definition() {
get_string('teacher_can_request_evaluation', 'block_evasys_sync'));
$mform->setDefault('teacher_can_request_evaluation', true);
+ $mform->addElement('checkbox', 'send_mail_to_teacher',
+ get_string('send_mail_to_teacher', 'block_evasys_sync'));
+ $mform->setDefault('send_mail_to_teacher', true);
+ $mform->addHelpButton('send_mail_to_teacher', 'send_mail_to_teacher', 'block_evasys_sync');
+
// TODO automatic
/*$mform->addElement('checkbox', 'teacher_evaluation_request_needs_approval',
get_string('teacher_evaluation_request_needs_approval', 'block_evasys_sync'));
@@ -91,6 +96,7 @@ protected function definition() {
$mform->setDefault('standard_time_end', $this->evasys_category->get('standard_time_end'));
}
$mform->setDefault('teacher_can_request_evaluation', $this->evasys_category->can_teacher_request_evaluation());
+ $mform->setDefault('send_mail_to_teacher', $this->evasys_category->send_mail_to_teacher());
// $mform->setDefault('teacher_evaluation_request_needs_approval', $this->evasys_category->teacher_evaluation_request_needs_approval());
// $mform->setDefault('automatic_task_creation', $this->evasys_category->is_automatic());
@@ -109,6 +115,9 @@ function get_data_transformed(): ?evasys_category {
if ($data->teacher_can_request_evaluation ?? false) {
$flags |= evasys_category::MASK_TEACHER_CAN_REQUEST_EVALUATION;
}
+ if ($data->send_mail_to_teacher ?? false) {
+ $flags |= evasys_category::MASK_SEND_MAIL_TO_TEACHER;
+ }
if ($data->teacher_evaluation_needs_approval ?? false) {
$flags |= evasys_category::MASK_EVALUATION_REQUEST_NEEDS_APPROVAL;
}
diff --git a/db/install.xml b/db/install.xml
index e57334e..9e01daa 100644
--- a/db/install.xml
+++ b/db/install.xml
@@ -9,7 +9,7 @@
-
+
diff --git a/db/upgrade.php b/db/upgrade.php
index f3f87dd..296ee7b 100644
--- a/db/upgrade.php
+++ b/db/upgrade.php
@@ -532,5 +532,17 @@ function xmldb_block_evasys_sync_upgrade ($oldversion) {
upgrade_block_savepoint(true, 2022092400, 'evasys_sync');
}
+ if ($oldversion < 2023092100) {
+ // Changing default of evasyscategory mode_flags
+ $table = new xmldb_table('block_evasys_sync_categories');
+ $field = new xmldb_field('mode_flags', XMLDB_TYPE_INTEGER, 10, null, XMLDB_NOTNULL, null, 33, 'category_mode');
+
+ // Launch change of type for field mode_flags.
+ $dbman->change_field_default($table, $field);
+
+ // Evasys_sync savepoint reached.
+ upgrade_block_savepoint(true, 2023092100, 'evasys_sync');
+ }
+
return true;
}
diff --git a/lang/de/block_evasys_sync.php b/lang/de/block_evasys_sync.php
index 732c06a..195bb93 100755
--- a/lang/de/block_evasys_sync.php
+++ b/lang/de/block_evasys_sync.php
@@ -245,6 +245,10 @@
$string['teacher_can_change_evaluation'] = 'Lehrende können bestehende Evaluationen verändern';
$string['teacher_evaluation_change_needs_approval'] = 'Änderungen an bestehenden Evaluationen müssen von Ihnen bestätigt werden';
+$string['send_mail_to_teacher'] = 'Sende Bestätigungsmail an Lehrende';
+$string['send_mail_to_teacher_help'] = 'Falls ausgewählt, wird eine Benachrichtigungsmail an Lehrende geschickt, wenn über die evasys-Überblick-Seite eine Evaluation für ihren Kurs beantragt wird.';
+
+
$string['search_for_courses'] = 'Nach Kursen suchen';
$string['evasys_settings_for'] = 'Evasys-Einstellungen für {$a}';
diff --git a/lang/en/block_evasys_sync.php b/lang/en/block_evasys_sync.php
index b0740ae..003a940 100755
--- a/lang/en/block_evasys_sync.php
+++ b/lang/en/block_evasys_sync.php
@@ -256,6 +256,9 @@
$string['teacher_can_change_evaluation'] = 'Teachers can change existing evaluation';
$string['teacher_evaluation_change_needs_approval'] = 'Teacher\'s evaluation changes needs approval from you';
+$string['send_mail_to_teacher'] = 'Send mail to teacher';
+$string['send_mail_to_teacher_help'] = 'If checked, each time an evaluation is requested from the evasys overview page, a notification email will be sent to the teacher of the course.';
+
$string['search_for_courses'] = 'Search for courses';
$string['evasys_settings_for'] = 'Evasys settings for {$a}';
diff --git a/version.php b/version.php
index 98d9e74..4ad0c08 100755
--- a/version.php
+++ b/version.php
@@ -18,6 +18,6 @@
defined('MOODLE_INTERNAL') || die();
$plugin->component = 'block_evasys_sync';
-$plugin->version = 2023080700; // YYYYMMDDHH (year, month, day, 24-hr time).
+$plugin->version = 2023092100; // YYYYMMDDHH (year, month, day, 24-hr time).
$plugin->requires = 2022041900; // YYYYMMDDHH (This is the release version for Moodle 4.0).
$plugin->maturity = MATURITY_RC;