summaryrefslogtreecommitdiffstats
path: root/modules-available/locations/pages
diff options
context:
space:
mode:
Diffstat (limited to 'modules-available/locations/pages')
-rw-r--r--modules-available/locations/pages/details.inc.php21
1 files changed, 16 insertions, 5 deletions
diff --git a/modules-available/locations/pages/details.inc.php b/modules-available/locations/pages/details.inc.php
index 86bfebd6..d2ec7b24 100644
--- a/modules-available/locations/pages/details.inc.php
+++ b/modules-available/locations/pages/details.inc.php
@@ -39,9 +39,10 @@ class SubPage
$openingTimes = Request::post('openingtimes', Request::REQUIRED, 'string');
$locationid = Request::post('locationid', Request::REQUIRED, 'int');
$wol = Request::post('wol', false, 'bool');
- $woloffset = Request::post('wol-offset', 0, 'int');
+ $wolOffset = Request::post('wol-offset', 0, 'int');
$sd = Request::post('sd', false, 'bool');
- $sdoffset = Request::post('sd-offset', 0, 'int');
+ $sdOffset = Request::post('sd-offset', 0, 'int');
+ $raMode = Request::post('ra-mode', 'ALWAYS', 'string');
User::assertPermission('location.edit.openingtimes', $locationid);
@@ -93,7 +94,16 @@ class SubPage
if (Module::isAvailable('rebootcontrol')) {
// Set options
- Scheduler::setLocationOptions($locationid, $wol, $sd, $woloffset, $sdoffset);
+ if (!Scheduler::isValidRaMode($raMode)) {
+ $raMode = Scheduler::RA_ALWAYS;
+ }
+ Scheduler::setLocationOptions($locationid, [
+ 'wol' => $wol,
+ 'sd' => $sd,
+ 'wol-offset' => $wolOffset,
+ 'sd-offset' => $sdOffset,
+ 'ra-mode' => $raMode,
+ ]);
}
}
@@ -396,7 +406,7 @@ class SubPage
if (Module::get('rebootcontrol') !== false) {
$res = Database::queryFirst("SELECT action, nextexecution FROM `reboot_scheduler`
WHERE locationid = :id", ['id' => $locationId]);
- if ($res !== false) {
+ if ($res !== false && $res['nextexecution'] > 0) {
$data['next_action'] = $res['action'];
$data['next_time'] = Util::prettyTime($res['nextexecution']);
}
@@ -431,12 +441,13 @@ class SubPage
$data['rebootcontrol'] = $rebootcontrol;
if ($rebootcontrol) {
$data['scheduler-options'] = Scheduler::getLocationOptions($id);
+ $data['scheduler_' . $data['scheduler-options']['ra-mode'] . '_checked'] = 'checked';
}
echo Render::parse('ajax-opening-location', $data);
}
- private static function isSimpleMode(&$array)
+ private static function isSimpleMode(&$array): bool
{
if (empty($array))
return true;