mirror of
https://github.com/catalyst/moodle-auth_outage.git
synced 2026-05-17 05:48:43 +02:00
Issue #86 - Added relative time on manage outage tables.
This commit is contained in:
@@ -48,6 +48,14 @@ class base_table extends flexible_table {
|
||||
*/
|
||||
private static $autoid = 0;
|
||||
|
||||
protected static function create_starttime_string($starttime) {
|
||||
$absolute = userdate($starttime, get_string('datetimeformat', 'auth_outage'));
|
||||
$relative = $starttime - time();
|
||||
$format = ($relative < 0) ? 'tablestarttimepastformat' : 'tablestarttimefutureformat';
|
||||
$relative = format_time($relative);
|
||||
return get_string($format, 'auth_outage', compact('absolute', 'relative'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* @param string|null $id to be used by the table, autogenerated if null.
|
||||
|
||||
@@ -50,7 +50,7 @@ class history_table extends base_table {
|
||||
|
||||
$this->define_headers([
|
||||
get_string('tableheaderwarnbefore', 'auth_outage'),
|
||||
get_string('tableheaderstarttime', 'auth_outage'),
|
||||
get_string('tableheaderstartedtime', 'auth_outage'),
|
||||
get_string('tableheaderdurationplanned', 'auth_outage'),
|
||||
get_string('tableheaderdurationactual', 'auth_outage'),
|
||||
get_string('tableheadertitle', 'auth_outage'),
|
||||
@@ -71,7 +71,7 @@ class history_table extends base_table {
|
||||
$finished = is_null($finished) ? '-' : format_time($finished);
|
||||
$this->add_data([
|
||||
format_time($outage->get_warning_duration()),
|
||||
userdate($outage->starttime, get_string('datetimeformat', 'auth_outage')),
|
||||
self::create_starttime_string($outage->starttime),
|
||||
format_time($outage->get_duration_planned()),
|
||||
$finished,
|
||||
$outage->get_title(),
|
||||
|
||||
@@ -75,7 +75,7 @@ class planned_table extends base_table {
|
||||
|
||||
$this->add_data([
|
||||
format_time($outage->get_warning_duration()),
|
||||
userdate($outage->starttime, get_string('datetimeformat', 'auth_outage')),
|
||||
self::create_starttime_string($outage->starttime),
|
||||
format_time($outage->get_duration_planned()),
|
||||
$title,
|
||||
$this->create_data_buttons($outage, true),
|
||||
|
||||
Reference in New Issue
Block a user