mirror of
https://github.com/catalyst/moodle-auth_outage.git
synced 2026-05-16 21:41:31 +02:00
Accept natural language start times #163
This commit is contained in:
3
edit.php
3
edit.php
@@ -65,6 +65,9 @@ if ($clone) {
|
||||
$default = $config->default_time;
|
||||
if ($default) {
|
||||
|
||||
// First try natural language parsing.
|
||||
$time = strtotime($default);
|
||||
|
||||
// Lean on the Task API to convert the cron syntax to
|
||||
// the next valid outage date and time.
|
||||
$parts = explode(' ', $default);
|
||||
|
||||
@@ -81,7 +81,10 @@ $string['defaultoutagedurationdescription'] = 'Default duration (in minutes) of
|
||||
$string['defaultwarningduration'] = 'Warning duration';
|
||||
$string['defaultwarningdurationdescription'] = 'Default warning time (in minutes) for outages.';
|
||||
$string['defaulttime'] = 'Default time';
|
||||
$string['defaulttimedescription'] = 'The default time for the next outage. This is expressed in cron notation, eg to say that a regular outage window is any thursday at 7pm you would set this to: <pre>0 19 * * 4</pre>';
|
||||
$string['defaulttimedescription'] = 'The default time for the next outage. This is expressed in either natural language or a cron notation. eg to say that a regular outage window is any Thursday at 7pm either of these work:
|
||||
<pre>0 19 * * 4
|
||||
next Thursday 7pm</pre>
|
||||
See also <a target=_blank href="https://en.wikipedia.org/wiki/Cron#CRON_expression">Cron expressions</a> and <a target=_blank href="https://www.php.net/manual/en/datetime.formats.relative.php">Relative dates</a>';
|
||||
$string['defaulttitle'] = 'Title';
|
||||
$string['defaulttitledescription'] = 'Default title for outages. Use {{start}} and {{stop}} placeholders as required.';
|
||||
$string['defaulttitlevalue'] = 'System down from {{start}} for {{duration}}';
|
||||
|
||||
Reference in New Issue
Block a user