Skip to content

Commit 0d1547e

Browse files
author
Laur0r
authored
Merge branch 'master' into feature/automatic-eval-request-rerun-evaluation
2 parents 0eb26a5 + c688509 commit 0d1547e

25 files changed

+615
-82
lines changed

amd/build/initialize.min.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

amd/build/post_dialog.min.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

amd/build/standardtime.min.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

amd/src/initialize.js

+7
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ define(['jquery', 'core/notification', 'core/str'], function ($, notification, s
2020
$('[name=year_end]').last()[0].selectedIndex = end.getFullYear() - 2000;
2121
if ($('#reactivate').length > 0) {
2222
endenabled = !$('[name=minute_end]')[0].disabled;
23+
datedisabled = $('[name=minute_end]')[0].disabled && $('[name=minute_start]')[0].disabled;
2324
$(document).on("change", "#reactivate", function() {
2425
if (this.checked) {
2526
// Ask for confirmation, then enable all fields related to re-invitation.
@@ -51,6 +52,9 @@ define(['jquery', 'core/notification', 'core/str'], function ($, notification, s
5152
if ($('#only_end').length > 0) {
5253
$('#only_end').prop("value", false);
5354
}
55+
if ($('#datedisabled').length > 0) {
56+
$('#datedisabled').prop("value", false);
57+
}
5458
if ($('#evasyssubmitbutton').length > 0) {
5559
$('#evasyssubmitbutton').prop("disabled", false);
5660
$('#evasyssubmitbutton').val(s[4]);
@@ -81,6 +85,9 @@ define(['jquery', 'core/notification', 'core/str'], function ($, notification, s
8185
if ($('#only_end').length > 0) {
8286
$('#only_end').prop("value", true);
8387
}
88+
if ($('#datedisabled').length > 0) {
89+
$('#datedisabled').prop("value", true);
90+
}
8491
if ($('#evasyssubmitbutton').length > 0) {
8592
if (!endenabled) {
8693
$('#evasyssubmitbutton').prop("disabled", true);

amd/src/post_dialog.js

+13-1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,17 @@ define(['jquery', 'core/notification', 'core/str'], function($, notification, st
2222
).fail(notification.exception);
2323
};
2424

25+
var show_dialog_success_and_info = function() {
26+
str.get_strings([
27+
{'key' : 'title_success', component: 'block_evasys_sync'},
28+
{'key' : 'content_successandinfo', component: 'block_evasys_sync'},
29+
{'key' : 'confirm_box', component: 'block_evasys_sync'},
30+
]).done(function(s) {
31+
notification.alert(s[0], s[1], s[2]);
32+
}
33+
).fail(notification.exception);
34+
}
35+
2536
var show_dialog_nostudents = function() {
2637
str.get_strings([
2738
{'key' : 'title_failure', component: 'block_evasys_sync'},
@@ -48,6 +59,7 @@ define(['jquery', 'core/notification', 'core/str'], function($, notification, st
4859
show_dialog_failure: show_dialog_failure,
4960
show_dialog_no_students: show_dialog_nostudents,
5061
show_dialog_success: show_dialog_success,
51-
show_dialog_up_to_date: show_dialog_up_to_date
62+
show_dialog_up_to_date: show_dialog_up_to_date,
63+
show_dialog_success_and_info: show_dialog_success_and_info
5264
};
5365
});

amd/src/standardtime.js

+1
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ define(['jquery', 'core/str'], function($, str) {
3434
$('[name=month_end]')[0].disabled = true;
3535
$('[name=year_end]')[0].disabled = true;
3636
$('#only_end').val(false);
37+
$('#datedisabled').val(true);
3738
};
3839

3940
var enable = function() {

amd/src/tablebulkactions.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ export function init() {
5454
{k: 'action', v: a.getAttribute('data-evasys-action')},
5555
{k: 'sesskey', v: M.cfg.sesskey}
5656
];
57-
if (a.getAttribute('data-evasys-forall') === '1') {
58-
data.push({k: 'all', v: '1'});
57+
if (a.getAttribute('data-evasys-forall') === 1) {
58+
data.push({k: 'all', v: 1});
5959
redirectPost(window.location, data);
6060
} else {
6161
checkboxes.forEach((c) => {

block_evasys_sync.php

+7-2
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ public function get_content() {
9898
$enddisabled = false;
9999
$emailsentnotice = false;
100100
$periodsetnotice = false;
101+
$datedisabled = false;
101102

102103
// Set start to today and end to a week from now.
103104
$start = time();
@@ -115,6 +116,7 @@ public function get_content() {
115116
$first = array_key_first($evaluations->evaluations);
116117
$start = $evaluations->evaluations[$first]->start;
117118
$end = $evaluations->evaluations[$first]->end;
119+
$datedisabled = true;
118120
} elseif ($evasyscategory->default_period_set()) {
119121
$start = $evasyscategory->get('standard_time_start');
120122
$end = $evasyscategory->get('standard_time_end');
@@ -186,8 +188,9 @@ public function get_content() {
186188
'usestandardtimelayout' => $standardttimemode,
187189
// Choose mode.
188190
'direct' => false,
189-
'startdisabled' => $startdisabled || $standardttimemode,
190-
'enddisabled' => $enddisabled || $standardttimemode,
191+
'startdisabled' => $startdisabled || $standardttimemode || $datedisabled,
192+
'enddisabled' => $enddisabled || $standardttimemode || $datedisabled,
193+
'datedisabled' => $datedisabled,
191194
'onlyend' => $startdisabled && !$standardttimemode,
192195
'disablesubmit' => $enddisabled,
193196
// If the evaluation hasn't ended yet, display option to restart it.
@@ -223,6 +226,8 @@ public function display_status($status) {
223226
$this->page->requires->js_call_amd('block_evasys_sync/post_dialog', 'show_dialog_success');
224227
} else if ($status === 'uptodate') {
225228
$this->page->requires->js_call_amd('block_evasys_sync/post_dialog', 'show_dialog_up_to_date');
229+
} else if ($status === 'successandinfo') {
230+
$this->page->requires->js_call_amd('block_evasys_sync/post_dialog', 'show_dialog_success_and_info');
226231
} else if ($status === 'nostudents') {
227232
$this->page->requires->js_call_amd('block_evasys_sync/post_dialog', 'show_dialog_no_students');
228233
} else if ($status === 'failure') {

classes/evaluation_manager.php

+5-3
Original file line numberDiff line numberDiff line change
@@ -109,11 +109,13 @@ public static function set_default_evaluation_for($courseids, evasys_category $c
109109
$data->courseshort = $course->shortname;
110110
$data->coursefull = $course->fullname;
111111

112-
foreach ($teachers as $teacher) {
113-
email_to_user($teacher, $coordinatoruser,
112+
if ($category->send_mail_to_teacher()) {
113+
foreach ($teachers as $teacher) {
114+
email_to_user($teacher, $coordinatoruser,
114115
get_string('notify_teacher_email_subject', 'block_evasys_sync', $data),
115116
get_string('notify_teacher_email_body', 'block_evasys_sync', $data)
116-
);
117+
);
118+
}
117119
}
118120

119121
self::clear_error($course->id);

0 commit comments

Comments
 (0)