mirror of
https://github.com/catalyst/moodle-auth_outage.git
synced 2026-05-17 05:48:43 +02:00
WIP Issue #17 - Settings page done, missing forms and other references to warning duration and stop time.
This commit is contained in:
@@ -45,7 +45,7 @@ class edit extends \moodleform {
|
||||
|
||||
$mform->addElement('date_time_selector', 'starttime', get_string('starttime', 'auth_outage'));
|
||||
|
||||
$mform->addElement('date_time_selector', 'stoptime', get_string('stoptime', 'auth_outage'));
|
||||
$mform->addElement('duration', 'outageduration', get_string('outageduration', 'auth_outage'));
|
||||
|
||||
$mform->addElement('duration', 'warningduration', get_string('warningduration', 'auth_outage'));
|
||||
|
||||
@@ -59,6 +59,8 @@ class edit extends \moodleform {
|
||||
|
||||
$mform->addElement('editor', 'description', get_string('description', 'auth_outage'));
|
||||
|
||||
$mform->addElement('static', 'usagehints', '', get_string('textplaceholdershint', 'auth_outage'));
|
||||
|
||||
$this->add_action_buttons();
|
||||
}
|
||||
|
||||
|
||||
@@ -44,9 +44,9 @@ class outage {
|
||||
public $stoptime = null;
|
||||
|
||||
/**
|
||||
* @var int Amount of minutes before outage starts to show the warning message.
|
||||
* @var int Warning start timestamp.
|
||||
*/
|
||||
public $warningduration = null;
|
||||
public $warntime = null;
|
||||
|
||||
/**
|
||||
* @var string Short description of the outage (no HTML).
|
||||
@@ -85,8 +85,8 @@ class outage {
|
||||
if (is_object($data) || is_array($data)) {
|
||||
outagelib::data2object($data, $this);
|
||||
|
||||
// FIXME types are wrong. Is this behaving as expected?
|
||||
$fields = ['createdby', 'id', 'lastmodified', 'modifiedby', 'starttime', 'stoptime', 'warningduration'];
|
||||
// Adjust field types as needed.
|
||||
$fields = ['createdby', 'id', 'lastmodified', 'modifiedby', 'starttime', 'stoptime', 'warntime'];
|
||||
foreach ($fields as $f) {
|
||||
$this->$f = ($this->$f === null) ? null : (int)$this->$f;
|
||||
}
|
||||
|
||||
@@ -158,7 +158,7 @@ class outagedb {
|
||||
// Gets only one record if available, the one that starts(ed) first and that stops last.
|
||||
$data = $DB->get_records_select(
|
||||
'auth_outage',
|
||||
'(starttime - warningduration <= :datetime1 AND stoptime >= :datetime2)',
|
||||
'(warntime <= :datetime1 AND stoptime >= :datetime2)',
|
||||
['datetime1' => $time, 'datetime2' => $time],
|
||||
'starttime ASC, stoptime DESC, title ASC',
|
||||
'*',
|
||||
|
||||
Reference in New Issue
Block a user