diff options
Diffstat (limited to 'modules-available/locations/pages/details.inc.php')
-rw-r--r-- | modules-available/locations/pages/details.inc.php | 34 |
1 files changed, 13 insertions, 21 deletions
diff --git a/modules-available/locations/pages/details.inc.php b/modules-available/locations/pages/details.inc.php index 2f444157..fd45646b 100644 --- a/modules-available/locations/pages/details.inc.php +++ b/modules-available/locations/pages/details.inc.php @@ -89,25 +89,25 @@ class SubPage array('locationid' => $locationid, 'openingtime' => $openingTimes)); if (Module::isAvailable('rebootcontrol')) { - if ($wol) { + if ($wol || $sd) { $options = array(); + // Sanity checks if ($woloffset > 15) $woloffset = 15; else if ($woloffset < 0) $woloffset = 0; - $options['wol-offset'] = $woloffset; - Scheduler::updateSchedule($locationid, 'wol', $options, $openingTimes); - } else { - Scheduler::deleteSchedule($locationid, 'wol'); - } - if ($sd) { - $options = array(); - // Sanity checks if ($sdoffset > 15) $sdoffset = 15; else if ($sdoffset < 0) $sdoffset = 0; + + // Set options + $options['wol'] = $wol; + $options['wol-offset'] = $woloffset; + $options['sd'] = $sd; $options['sd-offset'] = $sdoffset; - Scheduler::updateSchedule($locationid, 'sd', $options, $openingTimes); + + Scheduler::updateSchedule($locationid, $options, $openingTimes); + } else { - Scheduler::deleteSchedule($locationid, 'sd'); + Scheduler::deleteSchedule($locationid); } } } @@ -423,16 +423,8 @@ class SubPage $rebootcontrol = Module::isAvailable('rebootcontrol'); $data['rebootcontrol'] = $rebootcontrol; if ($rebootcontrol) { - $wol = Database::queryFirst("SELECT options FROM `reboot_scheduler` WHERE locationid = :id AND action = 'wol'", array('id' => $id)); - if ($wol !== false) { - $data['wol'] = true; - $data['wol-options'] = json_decode($wol['options']); - } - $sd = Database::queryFirst("SELECT options FROM `reboot_scheduler` WHERE locationid = :id AND action = 'sd'", array('id' => $id)); - if ($sd !== false) { - $data['sd'] = true; - $data['sd-options'] = json_decode($sd['options']); - } + $res = Database::queryFirst("SELECT * FROM `reboot_scheduler` WHERE locationid = :id", array('id' => $id)); + if ($res !== false) $data['scheduler-options'] = json_decode($res['options']); } echo Render::parse('ajax-opening-location', $data); |