mirror of
https://github.com/catalyst/moodle-auth_outage.git
synced 2026-05-16 21:41:31 +02:00
Reorganize warning and buttons for Edit form #172.
This commit is contained in:
@@ -82,6 +82,9 @@ class edit extends moodleform {
|
||||
$mform->addHelpButton('description', 'description', 'auth_outage');
|
||||
|
||||
$mform->addElement('static', 'usagehints', '', get_string('textplaceholdershint', 'auth_outage'));
|
||||
$mform->addElement('static', 'warningreenablemaintenancemode', '');
|
||||
|
||||
$this->add_action_buttons();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -145,6 +148,7 @@ class edit extends moodleform {
|
||||
*/
|
||||
public function set_data($outage) {
|
||||
global $OUTPUT;
|
||||
$mform = $this->_form;
|
||||
|
||||
// Cannot change method signature, check type.
|
||||
if ($outage instanceof outage) {
|
||||
@@ -158,21 +162,12 @@ class edit extends moodleform {
|
||||
'description' => ['text' => $outage->description, 'format' => '1'],
|
||||
]);
|
||||
|
||||
if (!empty($outage->id) && $outage->autostart && $outage->starttime < time() &&
|
||||
$outage->stoptime > time()) {
|
||||
$this->_form->addElement('html',
|
||||
$OUTPUT->notification(get_string('warningreenablemaintenancemode', 'auth_outage'), 'notifywarning'));
|
||||
if (!empty($outage->id) && $outage->autostart && $outage->starttime < time() && $outage->stoptime > time()) {
|
||||
$warning = $mform->getElement('warningreenablemaintenancemode');
|
||||
$warning->setValue($OUTPUT->notification(get_string('warningreenablemaintenancemode', 'auth_outage'), 'notifywarning'));
|
||||
}
|
||||
} else {
|
||||
throw new coding_exception('$outage must be an outage object.', $outage);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
* @see moodleform::definition_after_data()
|
||||
*/
|
||||
public function definition_after_data() {
|
||||
$this->add_action_buttons();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user