From 03997075bec3a0fd436c881a748b108acc7a98fd Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Thu, 6 Jul 2017 13:12:21 +0200 Subject: [locationinfo] Support runmode module --- modules-available/locationinfo/page.inc.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'modules-available/locationinfo/page.inc.php') diff --git a/modules-available/locationinfo/page.inc.php b/modules-available/locationinfo/page.inc.php index e8ce7b78..f5e64209 100644 --- a/modules-available/locationinfo/page.inc.php +++ b/modules-available/locationinfo/page.inc.php @@ -440,6 +440,10 @@ class Page_LocationInfo extends Page $res = Database::simpleQuery('SELECT p.paneluuid, p.panelname, p.locationids, p.paneltype FROM locationinfo_panel p ORDER BY panelname ASC'); + $hasRunmode = Module::isAvailable('runmode'); + if ($hasRunmode) { + $runmodes = RunMode::getForModule(Page::getModule(), true); + } $panels = array(); $locations = Location::getLocationsAssoc(); while ($row = $res->fetch(PDO::FETCH_ASSOC)) { @@ -452,9 +456,12 @@ class Page_LocationInfo extends Page if ($len < 5) { $row['panelname'] .= str_repeat('…', 5 - $len); } + if ($hasRunmode && isset($runmodes[$row['paneluuid']])) { + $row['assignedMachineCount'] = count($runmodes[$row['paneluuid']]); + } $panels[] = $row; } - Render::addTemplate('page-panels', array('panels' => $panels)); + Render::addTemplate('page-panels', compact('panels', 'hasRunmode')); } /** -- cgit v1.2.3-55-g7522