mirror of
https://github.com/catalyst/moodle-auth_outage.git
synced 2026-05-16 21:41:31 +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),
|
||||
|
||||
@@ -128,8 +128,11 @@ $string['tableheaderduration'] = 'Duration';
|
||||
$string['tableheaderdurationplanned'] = 'Planned duration';
|
||||
$string['tableheaderdurationactual'] = 'Actual duration';
|
||||
$string['tableheaderstarttime'] = 'Starts on';
|
||||
$string['tableheaderstartedtime'] = 'Started on';
|
||||
$string['tableheaderwarnbefore'] = 'Warns before';
|
||||
$string['tableheadertitle'] = 'Title';
|
||||
$string['tablestarttimefutureformat'] = '{$a->absolute}<br />In {$a->relative}';
|
||||
$string['tablestarttimepastformat'] = '{$a->absolute}<br />{$a->relative} ago';
|
||||
$string['taskupdatestaticpage'] = 'Update static outage page';
|
||||
$string['textplaceholdershint'] = 'You can use {{start}}, {{stop}} and {{duration}} as placeholders on the title and description.';
|
||||
$string['titleerrorinvalid'] = 'Title cannot be left blank.';
|
||||
|
||||
Reference in New Issue
Block a user