From 4462a9c07b19adc899cb5c90a7bc652dc05c41ce Mon Sep 17 00:00:00 2001 From: Daniel Thee Roperto Date: Mon, 12 Sep 2016 09:53:50 +1000 Subject: [PATCH] Bugfix - Fixed problem preventing the creation of a new outage. --- classes/forms/outage/edit.php | 2 +- new.php | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/classes/forms/outage/edit.php b/classes/forms/outage/edit.php index ee21a6b..e43aa57 100644 --- a/classes/forms/outage/edit.php +++ b/classes/forms/outage/edit.php @@ -135,7 +135,7 @@ class edit extends \moodleform { 'description' => ['text' => $outage->description, 'format' => '1'] ]); } else { - throw new \InvalidArgumentException('$default_values must be an outage object.'); + throw new \InvalidArgumentException('$outage must be an outage object.'); } } } diff --git a/new.php b/new.php index 06a5f79..f9f3305 100644 --- a/new.php +++ b/new.php @@ -42,13 +42,13 @@ if ($mform->is_cancelled()) { } $config = get_config('auth_outage'); -$defaults = [ +$defaults = new outage([ 'starttime' => time(), - 'outageduration' => ($config->default_duration * 60), - 'warningduration' => ($config->warning_duration * 60), + 'stoptime' => time() + ($config->default_duration * 60), + 'warntime' => time() - ($config->warning_duration * 60), 'title' => $config->warning_title, - 'description' => ['text' => $config->warning_description, 'format' => '1'] -]; + 'description' => $config->warning_description +]); $mform->set_data($defaults); $PAGE->navbar->add(get_string('outagecreate', 'auth_outage'));