Skip to content

Commit 4ca374e

Browse files
author
r.tschu
committed
added timezone support
1 parent 147cbda commit 4ca374e

File tree

3 files changed

+13
-12
lines changed

3 files changed

+13
-12
lines changed

amd/build/edit_timeframe.min.js

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

amd/src/edit_timeframe.js

+8-3
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,8 @@ define(['jquery', 'core/modal_factory', 'core/templates', 'core/str', 'core/url'
7171
root.on('modal-save-cancel:save', function () {
7272
var saveid = new URL(clickedLink.prop('href')).searchParams.get("id");
7373
var times = {};
74-
if (document.getElementById("standardtimecheck").checked) {
74+
var settime = document.getElementById("standardtimecheck").checked;
75+
if (settime) {
7576
times = get_timestamp();
7677
}
7778
times.category = saveid;
@@ -83,8 +84,12 @@ define(['jquery', 'core/modal_factory', 'core/templates', 'core/str', 'core/url'
8384
var elementNo = clickedLink.prop('id').split("_")[1];
8485
startdates[elementNo] = times.starttime;
8586
enddates[elementNo] = times.endtime;
86-
document.getElementById('timehint_' + elementNo).innerHTML =
87-
get_time_as_string('start') + " - " + get_time_as_string('end');
87+
if (settime) {
88+
document.getElementById('timehint_' + elementNo).innerHTML =
89+
get_time_as_string('start') + " - " + get_time_as_string('end');
90+
} else {
91+
document.getElementById('timehint_' + elementNo).innerHTML = "";
92+
}
8893
});
8994
modal.show();
9095
require(['block_evasys_sync/initialize'], function(timesetter) {

classes/admin_form.php

+4-8
Original file line numberDiff line numberDiff line change
@@ -184,21 +184,17 @@ private function table_body() {
184184
$mform->setDefault($namecatmode, $mode);
185185

186186
$mform->addElement('html', '</td><td class="cell c3">');
187-
try {
188-
$mode = $record->get('standard_time_mode');
189-
} catch (\coding_exception $e) {
190-
// Backwards compatibility.
191-
$mode = false;
192-
}
193-
$name = 'standard_time_mode_' . $record->get('id');
194187
$timeeditlink = 'javascript:void(0)';
195188
$timeediturl = new \moodle_url($timeeditlink, array('id' => $record->get('id')));
196189
$text = get_string('edit_time', 'block_evasys_sync');
197190
$htmlurl = "<a id='timeediturl_{$i}' href='{$timeediturl->out()}'>$text</a>";
198191
$mform->addElement('html', $htmlurl);
199-
$mform->disabledIf($name, $namecatmode, 'checked');
200192
$startdate = $record->get('standard_time_start');
201193
$enddate = $record->get('standard_time_end');
194+
if ($startdate && $enddate) {
195+
$startdate = usertime($startdate);
196+
$enddate = usertime($enddate);
197+
}
202198
if ($startdate) {
203199
$mform->addElement('html', "<br/><div id='timehint_$i'>" . date('d.m.Y H:i', $startdate)
204200
. ' - ' .

0 commit comments

Comments
 (0)