summaryrefslogtreecommitdiffstats
path: root/modules-available/locations/pages/details.inc.php
diff options
context:
space:
mode:
Diffstat (limited to 'modules-available/locations/pages/details.inc.php')
-rw-r--r--modules-available/locations/pages/details.inc.php22
1 files changed, 17 insertions, 5 deletions
diff --git a/modules-available/locations/pages/details.inc.php b/modules-available/locations/pages/details.inc.php
index e400d492..19a89c88 100644
--- a/modules-available/locations/pages/details.inc.php
+++ b/modules-available/locations/pages/details.inc.php
@@ -42,7 +42,7 @@ class SubPage
$sd = Request::post('sd', false, 'bool');
$sdoffset = Request::post('sd-offset', 0, 'int');
- User::assertPermission('location.edit.*', $locationid); // TODO: Introduce permission
+ User::assertPermission('location.edit.openingtimes', $locationid);
// Construct opening-times for database
if ($openingTimes !== '') {
@@ -405,19 +405,30 @@ class SubPage
$data['used_percent'] = $count === 0 ? 0 : round(($used / $count) * 100);
- Permission::addGlobalTags($data['perms'], $locationId, ['location.edit.name', 'location.edit.subnets', 'location.delete', '.roomplanner.edit'], 'save_button');
+ Permission::addGlobalTags($data['perms'], $locationId,
+ ['location.edit.name', 'location.edit.subnets', 'location.delete', 'location.edit.openingtimes', '.roomplanner.edit'],
+ 'save_button');
if (empty($allowedLocs)) {
$data['perms']['location']['edit']['parent']['disabled'] = 'disabled';
} else {
unset($data['perms']['save_button']);
}
+ if (Module::get('rebootcontrol') !== false) {
+ $res = Database::queryFirst("SELECT action, nextexecution FROM `reboot_scheduler`
+ WHERE locationid = :id", ['id' => $locationId]);
+ if ($res !== false) {
+ $data['next_action'] = $res['action'];
+ $data['next_time'] = Util::prettyTime($res['nextexecution']);
+ }
+ }
+
echo Render::parse('location-subnets', $data);
}
private static function ajaxOpeningTimes($id)
{
- User::assertPermission('location.edit', $id);
+ User::assertPermission('location.edit.openingtimes', $id);
$openTimes = Database::queryFirst("SELECT openingtime FROM `location` WHERE locationid = :id", array('id' => $id));
if ($openTimes !== false) {
$openingTimes = json_decode($openTimes['openingtime'], true);
@@ -432,9 +443,10 @@ class SubPage
$rebootcontrol = Module::isAvailable('rebootcontrol');
$data['rebootcontrol'] = $rebootcontrol;
if ($rebootcontrol) {
- $res = Database::queryFirst("SELECT * FROM `reboot_scheduler` WHERE locationid = :id", array('id' => $id));
+ $res = Database::queryFirst("SELECT action, nextexecution, options FROM `reboot_scheduler`
+ WHERE locationid = :id", ['id' => $id]);
if ($res !== false) {
- $data['scheduler-options'] = json_decode($res['options']);
+ $data['scheduler-options'] = json_decode($res['options'], true);
}
}