MDL-42597 Administration: Modified maintenance mode countdown to display nicely
Added Style and JS to display maintenance mode timer similar to what is done on moodle demo site for rest.
This commit is contained in:
+13
-2
@@ -468,9 +468,20 @@ class core_renderer extends renderer_base {
|
||||
|
||||
$output = '';
|
||||
if (isset($CFG->maintenance_later) and $CFG->maintenance_later > time()) {
|
||||
$output .= $this->box_start('errorbox maintenancewarning');
|
||||
$output .= get_string('maintenancemodeisscheduled', 'admin', (int)(($CFG->maintenance_later-time())/60));
|
||||
$timeleft = $CFG->maintenance_later - time();
|
||||
// If timeleft less than 30 sec, set the class on block to error to highlight.
|
||||
$errorclass = ($timeleft < 30) ? 'error' : 'warning';
|
||||
$output .= $this->box_start($errorclass . ' moodle-has-zindex maintenancewarning');
|
||||
$a = new stdClass();
|
||||
$a->min = (int)($timeleft/60);
|
||||
$a->sec = (int)($timeleft % 60);
|
||||
$output .= get_string('maintenancemodeisscheduled', 'admin', $a) ;
|
||||
$output .= $this->box_end();
|
||||
$this->page->requires->yui_module('moodle-core-maintenancemodetimer', 'M.core.maintenancemodetimer',
|
||||
array(array('timeleftinsec' => $timeleft)));
|
||||
$this->page->requires->strings_for_js(
|
||||
array('maintenancemodeisscheduled', 'sitemaintenance'),
|
||||
'admin');
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user