Skip to content

Commit 9b7de1a

Browse files
committed
disable evaluation date changing for teachers, add status information for just adding participants
1 parent 7b8f59f commit 9b7de1a

7 files changed

+44
-31
lines changed

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/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
});

block_evasys_sync.php

+2
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,8 @@ public function display_status($status) {
226226
$this->page->requires->js_call_amd('block_evasys_sync/post_dialog', 'show_dialog_success');
227227
} else if ($status === 'uptodate') {
228228
$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');
229231
} else if ($status === 'nostudents') {
230232
$this->page->requires->js_call_amd('block_evasys_sync/post_dialog', 'show_dialog_no_students');
231233
} else if ($status === 'failure') {

lang/de/block_evasys_sync.php

+5-1
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,11 @@
123123
"Sie müssen nichts weiter tun, ".
124124
"Ihr*e Evaluationsbeauftragte*r wird nach den Richtlinien Ihres Fachbereichs weiter verfahren.";
125125

126-
$string['content_uptodate'] = "Ihr*e Evaluationsbeauftragte*r hat bereist einen Auftrag zum Durchführen der Evaluation von Ihnen erhalten.<br />" .
126+
$string['content_successandinfo'] = "Sie haben die Evaluation erfolgreich erneut beantragt.<br />" .
127+
"Es existiert bereits ein Evaluationsantrag für diesen Kurs; Sie haben lediglich Teilnehmer*innen hinzugefügt.<br />" .
128+
"Zum Ändern des Evaluationszeitraums wenden Sie sich bitte an Ihre*n Evaluationsbeauftragte*n.";
129+
130+
$string['content_uptodate'] = "Ihr*e Evaluationsbeauftragte*r hat bereits einen Auftrag zum Durchführen der Evaluation von Ihnen erhalten.<br />" .
127131
"Für Fragen zum Status Ihrer Evaluation kontaktieren Sie bitte Ihre*n Evaluationsbeauftragte*n.";
128132

129133
$string['content_failure'] = "Leider konnte die Evaluation nicht beauftragt werden.<br />" .

lang/en/block_evasys_sync.php

+4
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,10 @@
9898
"However, you have done your part.".
9999
"The coordinator will process your request in accordance with the regulations of your organization.";
100100

101+
$string['content_successandinfo'] = "Your evaluation coordinatior has been instructed to start the evaluation again.<br />" .
102+
"There already exists an evaluation reqest for this course; there have just been participants added to the evaluation.<br />>" .
103+
"In order to change the dates of the evaluation, please contact your evaluation coordinator.";
104+
101105
$string['content_uptodate'] = "Your evaluation coordinator has already been instructed to start the evaluation. <br />" .
102106
"If you have questions regarding the status of the evaluation please contact your evaluation coordinator.";
103107

sync.php

+18-7
Original file line numberDiff line numberDiff line change
@@ -36,17 +36,22 @@
3636
if (!optional_param('activate_standard', false, PARAM_BOOL)) {
3737

3838
if (optional_param('datedisabled', false, PARAM_BOOL)) {
39-
40-
$record = course_evaluation_allocation::get_record_by_course($courseid);
41-
$startdate = new \DateTime('@' . $record->get('startdate'), \core_date::get_server_timezone_object());
42-
$enddate = new \DateTime('@' . $record->get('enddate'), \core_date::get_server_timezone_object());
39+
// We already have an evaluation request for this course: fetch the start- and enddates
40+
$sql = 'SELECT v.id, v.starttime, v.endtime, max(v.timemodified) as time FROM {' . \block_evasys_sync\dbtables::EVAL_VERANSTS . '} v INNER JOIN ' .
41+
'{' . \block_evasys_sync\dbtables::EVAL_COURSES . '} c on v.evalid=c.evalid WHERE c.courseid = :courseid ORDER BY time DESC';
42+
$record = $DB->get_record_sql($sql, ['courseid' => $courseid]);
43+
// $record = course_evaluation_allocation::get_record_by_course($courseid);
44+
$startdate = new \DateTime('@' . $record->starttime, \core_date::get_server_timezone_object());
45+
$enddate = new \DateTime('@' . $record->endtime, \core_date::get_server_timezone_object());
4346

4447
} else {
4548

4649
if (optional_param('only_end', false, PARAM_BOOL)) {
4750
// Existing start date should not be changed; just the end date. Fetch start date from record.
48-
$record = course_evaluation_allocation::get_record_by_course($courseid);
49-
$startdate = new \DateTime('@' . $record->get('startdate'), \core_date::get_server_timezone_object());
51+
$sql = 'SELECT v.id, v.starttime, max(v.timemodified) as time FROM {' . \block_evasys_sync\dbtables::EVAL_VERANSTS . '} v INNER JOIN ' .
52+
'{' . \block_evasys_sync\dbtables::EVAL_COURSES . '} c on v.evalid=c.evalid WHERE c.courseid = :courseid ORDER BY time DESC';
53+
$record = $DB->get_record_sql($sql, ['courseid' => $courseid]);
54+
$startdate = new \DateTime('@' . $record->starttime, \core_date::get_server_timezone_object());
5055
} else {
5156
$startyear = required_param('year_start', PARAM_TEXT);
5257
$startmonth = date_decoder::decode_from_localised_string(required_param('month_start', PARAM_TEXT));
@@ -116,6 +121,7 @@
116121
\block_evasys_sync\evaluation_manager::clear_error($courseid);
117122

118123
if ($newparticipantsadded || $datenew) {
124+
119125
if ($datenew) {
120126
// Only send an email if it's the first time requesting this evaluation
121127
$evasyssynchronizer->notify_evaluation_responsible_person($dates, $newparticipantsadded, $datenew);
@@ -129,7 +135,12 @@
129135
));
130136
$event->trigger();
131137

132-
$returnurl->param('status', 'success');
138+
if ($datenew) {
139+
$returnurl->param('status', 'success');
140+
} else {
141+
$returnurl->param('status', 'successandinfo');
142+
}
143+
133144
redirect($returnurl, get_string('syncsucessful', 'block_evasys_sync'));
134145
exit();
135146
} else {

templates/block.mustache

+1-21
Original file line numberDiff line numberDiff line change
@@ -123,27 +123,7 @@ Example context (json):
123123
<input id='evasyssubmitbutton' class="in_box_button" type="submit" value="{{# str}}invitestudents, block_evasys_sync{{/str}}" {{#disablesubmit}}disabled{{/disablesubmit}}/>
124124
{{/direct}}
125125
{{#direct}}
126-
<input id='evasyssubmitbutton' class="in_box_button" type="submit" value="{{# str}}planorstartevaluation, block_evasys_sync{{/str}}" {{#datedisabled}}data-toggle="modal" data-target="#confirmmodal"{{/datedisabled}}{{#disablesubmit}}disabled{{/disablesubmit}}/>
126+
<input id='evasyssubmitbutton' class="in_box_button" type="submit" value="{{# str}}planorstartevaluation, block_evasys_sync{{/str}}" {{#disablesubmit}}disabled{{/disablesubmit}}/>
127127
{{/direct}}
128-
<div class="modal fade" id="confirmmodal" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
129-
<div class="modal-dialog">
130-
<div class="modal-content">
131-
<div class="modal-header">
132-
<h5 class="modal-title" id="exampleModalLabel">Modal title</h5>
133-
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
134-
<span aria-hidden="true">&times;</span>
135-
</button>
136-
</div>
137-
<div class="modal-body">
138-
...
139-
</div>
140-
<div class="modal-footer">
141-
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
142-
<button type="button" class="btn btn-primary">Save changes</button>
143-
</div>
144-
</div>
145-
</div>
146-
</div>
147-
148128
{{/showcontrols}}
149129
</form>

0 commit comments

Comments
 (0)