mirror of
https://github.com/catalyst/moodle-auth_outage.git
synced 2026-05-16 21:41:31 +02:00
Included logic for 'Force off' setting.
This commit is contained in:
committed by
Brendan Heywood
parent
551a97142c
commit
1ef47a6233
@@ -100,6 +100,12 @@ class outagedb {
|
||||
$outage->modifiedby = $USER->id;
|
||||
$outage->lastmodified = time();
|
||||
|
||||
// Setting autostart to false if the default autostart is configured to "Force off".
|
||||
if (get_config('default_autostart', 'auth_outage') === '2') {
|
||||
$outage->autostart = 0;
|
||||
}
|
||||
|
||||
|
||||
if ($outage->id === null) {
|
||||
// If new outage, set its creator.
|
||||
$outage->createdby = $USER->id;
|
||||
|
||||
@@ -48,8 +48,11 @@ class edit extends moodleform {
|
||||
$mform->addElement('hidden', 'id');
|
||||
$mform->setType('id', PARAM_INT);
|
||||
|
||||
$mform->addElement('checkbox', 'autostart', get_string('autostart', 'auth_outage'));
|
||||
$mform->addHelpButton('autostart', 'autostart', 'auth_outage');
|
||||
|
||||
if (get_config('auth_outage', 'default_autostart') !== '2') {
|
||||
$mform->addElement('checkbox', 'autostart', get_string('autostart', 'auth_outage'));
|
||||
$mform->addHelpButton('autostart', 'autostart', 'auth_outage');
|
||||
}
|
||||
|
||||
$mform->addElement('duration', 'warningduration', get_string('warningduration', 'auth_outage'));
|
||||
$mform->addHelpButton('warningduration', 'warningduration', 'auth_outage');
|
||||
|
||||
@@ -223,7 +223,7 @@ class outagelib {
|
||||
* @param outage|null $outage Outage or null if no scheduled outage.
|
||||
*/
|
||||
private static function update_maintenance_later($outage) {
|
||||
if (is_null($outage) || !$outage->autostart) {
|
||||
if (is_null($outage) || !$outage->autostart || get_config('default_autostart', 'auth_outage') === '2') {
|
||||
unset_config('maintenance_later');
|
||||
} else {
|
||||
$message = get_config('moodle', 'maintenance_message');
|
||||
|
||||
Reference in New Issue
Block a user