diff options
-rw-r--r-- | modules-available/runmode/inc/runmode.inc.php | 24 |
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 |