mirror of
https://github.com/catalyst/moodle-auth_outage.git
synced 2026-05-17 05:48:43 +02:00
Issue #26 - Preview warning bar with parameters auth_outage_preview and auth_outage_delta
This commit is contained in:
@@ -64,11 +64,26 @@ class outagelib {
|
||||
}
|
||||
self::$initialized = true;
|
||||
|
||||
if (($active = outagedb::get_active()) == null) {
|
||||
return;
|
||||
// Check for a previewing outage, then for an active outage.
|
||||
$previewid = optional_param('auth_outage_preview', null, PARAM_INT);
|
||||
$time = time();
|
||||
if (is_null($previewid)) {
|
||||
if (($active = outagedb::get_active()) == null) {
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
if (($active = outagedb::get_by_id($previewid)) == null) {
|
||||
return;
|
||||
}
|
||||
$delta = optional_param('auth_outage_delta', null, PARAM_FLOAT);
|
||||
if ($delta) {
|
||||
// Delta is float in minutes, allowing to check the redirect in a few seconds.
|
||||
$time = $active->starttime + (int)($delta * 60);
|
||||
}
|
||||
}
|
||||
|
||||
$CFG->additionalhtmltopofbody = self::get_renderer()->renderoutagebar($active)
|
||||
// There is a previewing or active outage.
|
||||
$CFG->additionalhtmltopofbody = self::get_renderer()->renderoutagebar($active, $time)
|
||||
. $CFG->additionalhtmltopofbody;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user