Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make sending a confirmation email for requested evaluations to teachers optional #74

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions classes/evaluation_manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
5 changes: 5 additions & 0 deletions classes/evasys_category.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -119,6 +120,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;
}
Expand Down
8 changes: 8 additions & 0 deletions classes/local/form/evasys_category_edit_form.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ 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);

// TODO automatic
/*$mform->addElement('checkbox', 'teacher_evaluation_request_needs_approval',
get_string('teacher_evaluation_request_needs_approval', 'block_evasys_sync'));
Expand All @@ -91,6 +95,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());

Expand All @@ -109,6 +114,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;
}
Expand Down
2 changes: 2 additions & 0 deletions lang/de/block_evasys_sync.php
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,8 @@
$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['search_for_courses'] = 'Nach Kursen suchen';

$string['evasys_settings_for'] = 'Evasys-Einstellungen für {$a}';
Expand Down
2 changes: 2 additions & 0 deletions lang/en/block_evasys_sync.php
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,8 @@
$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['search_for_courses'] = 'Search for courses';

$string['evasys_settings_for'] = 'Evasys settings for {$a}';
Expand Down