summaryrefslogtreecommitdiffstats
path: root/modules-available/runmode
diff options
context:
space:
mode:
authorSimon Rettberg2017-12-01 10:57:09 +0100
committerSimon Rettberg2017-12-01 10:57:09 +0100
commit0e9f943a8a2a7233ceb10d60c57f0a890a88ca09 (patch)
tree078a34fbc7326e8027b8419adcc2e362e2f3c4cb /modules-available/runmode
parent[roomplanner] Set SLX_AUTOLOGIN for dedicated managers (diff)
downloadslx-admin-0e9f943a8a2a7233ceb10d60c57f0a890a88ca09.tar.gz
slx-admin-0e9f943a8a2a7233ceb10d60c57f0a890a88ca09.tar.xz
slx-admin-0e9f943a8a2a7233ceb10d60c57f0a890a88ca09.zip
[runmode] Fix syntax error in SQL query
Diffstat (limited to 'modules-available/runmode')
-rw-r--r--modules-available/runmode/inc/runmode.inc.php24
1 files changed, 23 insertions, 1 deletions
diff --git a/modules-available/runmode/inc/runmode.inc.php b/modules-available/runmode/inc/runmode.inc.php
index 50ae2d72..8ba8587f 100644
--- a/modules-available/runmode/inc/runmode.inc.php
+++ b/modules-available/runmode/inc/runmode.inc.php
@@ -160,7 +160,7 @@ class RunMode
$join = $sel = '';
}
$res = Database::simpleQuery(
- "SELECT r.machineuuid, r.modedata $sel
+ "SELECT r.machineuuid, r.modedata, r.isclient $sel
FROM runmode r $join
WHERE module = :module AND modeid = :modeId",
compact('module', 'modeId'));
@@ -179,6 +179,28 @@ class RunMode
}
/**
+ * Return assoc array of all configured clients.
+ * @param bool $withData also return data field?
+ * @param bool $clientsOnly only return those with isclient == true
+ * @return array all the entries from the table
+ */
+ public static function getAllClients($withData = false, $clientsOnly = false)
+ {
+ $xtra = '';
+ if ($withData) {
+ $xtra .= ', modedata';
+ }
+ $res = Database::simpleQuery("SELECT machineuuid, module, modeid, isclient $withData FROM runmode");
+ $ret = array();
+ while ($row = $res->fetch(PDO::FETCH_ASSOC)) {
+ if ($clientsOnly && !$row['isclient'])
+ continue;
+ $ret[$row['machineuuid']] = $row;
+ }
+ return $ret;
+ }
+
+ /**
* Get display name of a module's mode. If the module doesn't have a getModeName
* method configured, the modeId is simply returned. Otherwise the return value of
* that method is passed through. getModeName by contract should return false if