summaryrefslogtreecommitdiffstats
path: root/modules-available/locationinfo/api.inc.php
diff options
context:
space:
mode:
authorSimon Rettberg2017-12-19 12:19:20 +0100
committerSimon Rettberg2017-12-19 12:19:20 +0100
commite19fd43bd5982d15b6dd65261035f961e4560656 (patch)
treee9cc96dd9c44f545de193d76b5e3f045e10b13fb /modules-available/locationinfo/api.inc.php
parent[sysconfig] Fix logic by which condition the LDADPd gets (re)started (diff)
downloadslx-admin-e19fd43bd5982d15b6dd65261035f961e4560656.tar.gz
slx-admin-e19fd43bd5982d15b6dd65261035f961e4560656.tar.xz
slx-admin-e19fd43bd5982d15b6dd65261035f961e4560656.zip
[locationinfo] Reload panels when opening times are changed
Diffstat (limited to 'modules-available/locationinfo/api.inc.php')
-rw-r--r--modules-available/locationinfo/api.inc.php26
1 files changed, 15 insertions, 11 deletions
diff --git a/modules-available/locationinfo/api.inc.php b/modules-available/locationinfo/api.inc.php
index ceaf04c0..ad71de8b 100644
--- a/modules-available/locationinfo/api.inc.php
+++ b/modules-available/locationinfo/api.inc.php
@@ -49,15 +49,11 @@ function HandleParameters()
/**
* Get last config modification timestamp for given panel.
- * This was planned to be smart and check the involved locations,
- * even going up the location tree if the opening time schedule
- * is inherited, but this would still be incomplete by design, as
- * it wouldn't react to the linked room plan being considered
- * for changes, or added/removed PCs etc. So rather than giving
- * an incomplete "clever" design for detecting changes, we only
- * consider direct editing of the panel now. So the advice would
- * simply be "if you want the panel to reload automatically, hit
- * the edit button and click save". Might even add a shortcut
+ * This is incomplete however, as it wouldn't react to the
+ * linked room plan being edited, or added/removed PCs
+ * etc. So the advice would simply be "if you want the
+ * panel to reload automatically, hit the edit button
+ * and click save". Might even add a shortcut
* reload-button to the list of panels at some point.
*
* @param string $paneluuid panels uuid
@@ -65,13 +61,21 @@ function HandleParameters()
*/
function getLastChangeTs($paneluuid)
{
- $panel = Database::queryFirst('SELECT lastchange FROM locationinfo_panel WHERE paneluuid = :paneluuid',
+ $panel = Database::queryFirst('SELECT lastchange, locationids FROM locationinfo_panel WHERE paneluuid = :paneluuid',
compact('paneluuid'));
if ($panel === false) {
http_response_code(404);
die('Panel not found');
}
- return (int)$panel['lastchange'];
+ $lastChange = array((int)$panel['lastchange']);
+ if (!empty($panel['locationids'])) {
+ $res = Database::simpleQuery('SELECT lastchange FROM locationinfo_locationconfig
+ WHERE locationid IN (:locs)', array('locs' => explode(',', $panel['locationids'])));
+ while (($lc = $res->fetchColumn()) !== false) {
+ $lastChange[] = (int)$lc;
+ }
+ }
+ return max($lastChange);
}
/**