summaryrefslogtreecommitdiffstats
path: root/modules-available/locations/pages
diff options
context:
space:
mode:
authorSimon Rettberg2022-04-29 17:38:00 +0200
committerSimon Rettberg2022-04-29 17:38:00 +0200
commit140062e0b606495f90fd77b8f290987844c79cab (patch)
treead32ce72580fa898f447c66316587ee7404e9854 /modules-available/locations/pages
parent[baseconfig_bwlp] Add more HDMI outputs for sound card (diff)
downloadslx-admin-140062e0b606495f90fd77b8f290987844c79cab.tar.gz
slx-admin-140062e0b606495f90fd77b8f290987844c79cab.tar.xz
slx-admin-140062e0b606495f90fd77b8f290987844c79cab.zip
[locations/remoteaccess] Add option to veto remoteaccess mode
Remoteaccess mode can now be forced to be disabled for individual locations in locations module, either unconditionally, or whenever the openingtimes schedule says the room is open. A reboot will be triggered whenever the room opens/closes to force clients into the proper runmode.
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;