From 89d952f7e9475d79c9e9a46e78e84bd63978dd04 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Wed, 18 Jan 2023 16:15:18 +0100 Subject: [statistics] Listview: Display roomlayout and unique properties in a sidebar .... if viewport is wide enouh, it will be a sidebar, otherwise, it will be displayed above the actual list. --- modules-available/roomplanner/api.inc.php | 6 +++--- modules-available/roomplanner/inc/pvsgenerator.inc.php | 7 +++++-- modules-available/roomplanner/templates/svg-plan.html | 14 +++++++++++++- 3 files changed, 21 insertions(+), 6 deletions(-) (limited to 'modules-available/roomplanner') diff --git a/modules-available/roomplanner/api.inc.php b/modules-available/roomplanner/api.inc.php index 8ddb945c..1af25ca8 100644 --- a/modules-available/roomplanner/api.inc.php +++ b/modules-available/roomplanner/api.inc.php @@ -5,14 +5,14 @@ if (Request::any('show') === 'svg') { $ret = PvsGenerator::generateSvg(Request::any('locationid', false, 'int'), Request::any('machineuuid', false, 'string'), Request::any('rotate', 0, 'int'), - Request::any('scale', 1, 'float')); + Request::any('scale', 1, 'float'), + Request::any('url', false, 'bool')); if ($ret === false) { if (Request::any('fallback', 0, 'int') === 0) { Header('HTTP/1.1 404 Not Found'); exit; } $ret = << @@ -22,7 +22,7 @@ if (Request::any('show') === 'svg') { EOF; } Header('Content-Type: image/svg+xml'); - die($ret); + die('' . $ret); } // PVS.ini diff --git a/modules-available/roomplanner/inc/pvsgenerator.inc.php b/modules-available/roomplanner/inc/pvsgenerator.inc.php index 0275054b..f23dcb20 100644 --- a/modules-available/roomplanner/inc/pvsgenerator.inc.php +++ b/modules-available/roomplanner/inc/pvsgenerator.inc.php @@ -78,7 +78,7 @@ class PvsGenerator * @param float $scale scaling factor for output * @return string SVG */ - public static function generateSvg($locationId = false, $highlightUuid = false, $rotate = 0, $scale = 1) + public static function generateSvg($locationId = false, $highlightUuid = false, int $rotate = 0, $scale = 1, $links = false, array $present = null) { if ($locationId === false) { $locationId = Database::queryFirst('SELECT fixedlocationid FROM machine @@ -105,7 +105,7 @@ class PvsGenerator // Figure out autorotate $auto = ($rotate < 0); if ($auto && $highlightUuid !== false) { - foreach ($machines as &$machine) { + foreach ($machines as $machine) { if ($machine['machineuuid'] === $highlightUuid) { $rotate = 4 - $ORIENTATION[$machine['rotation']]; // Reverse rotation break; @@ -117,6 +117,8 @@ class PvsGenerator foreach ($machines as &$machine) { if ($machine['machineuuid'] === $highlightUuid) { $machine['class'] = 'hl'; + } elseif (!empty($present) && !in_array($machine['machineuuid'], $present)) { + $machine['class'] = 'muted'; } $machine['rotation'] = $ORIENTATION[$machine['rotation']] * 90; } @@ -140,6 +142,7 @@ class PvsGenerator 'centerY' => $centerY, 'rotate' => $rotate * 90, 'machines' => $machines, + 'links' => $links, 'line' => ['x' => $sizeX, 'y' => $sizeY], ], 'roomplanner'); // FIXME: Needs module param if called from api.inc.php } diff --git a/modules-available/roomplanner/templates/svg-plan.html b/modules-available/roomplanner/templates/svg-plan.html index a2ecd5a7..4b0339f3 100644 --- a/modules-available/roomplanner/templates/svg-plan.html +++ b/modules-available/roomplanner/templates/svg-plan.html @@ -1,4 +1,3 @@ - @@ -32,12 +34,19 @@ + + + + {{#machines}} + {{#links}} + + {{/links}} + {{#links}} + + {{/links}} {{/machines}} -- cgit v1.2.3-55-g7522