summaryrefslogtreecommitdiffstats
path: root/modules-available/roomplanner
diff options
context:
space:
mode:
Diffstat (limited to 'modules-available/roomplanner')
-rw-r--r--modules-available/roomplanner/api.inc.php6
-rw-r--r--modules-available/roomplanner/inc/pvsgenerator.inc.php7
-rw-r--r--modules-available/roomplanner/templates/svg-plan.html14
3 files changed, 21 insertions, 6 deletions
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 = <<<EOF
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 64 64" height="64" width="64">
<g>
<path d="M 0,0 64,64 Z" style="stroke:#ff0000;stroke-width:5" />
@@ -22,7 +22,7 @@ if (Request::any('show') === 'svg') {
EOF;
}
Header('Content-Type: image/svg+xml');
- die($ret);
+ die('<?xml version="1.0" encoding="UTF-8" standalone="no"?>' . $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 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
version="1.1"
@@ -21,6 +20,9 @@
rect.hl {
fill: url(#screenhl);
}
+ rect.muted {
+ fill: url(#muted);
+ }
]]>
</style>
<defs>
@@ -32,12 +34,19 @@
<stop offset="0%" stop-color="#afa" />
<stop offset="100%" stop-color="#074" />
</radialGradient>
+ <radialGradient id="muted" cx=".4" cy=".3" r="1">
+ <stop offset="0%" stop-color="#bbb" />
+ <stop offset="100%" stop-color="#888" />
+ </radialGradient>
</defs>
<g transform="scale({{scale}}) rotate({{rotate}} {{centerX}} {{centerY}})">
<line x1="0" y1="{{line.y}}"
x2="{{line.x}}" y2="{{line.y}}"
style="stroke:#555;stroke-width:.2;opacity:.5" />
{{#machines}}
+ {{#links}}
+ <a xlink:href="./?do=statistics&amp;uuid={{machineuuid}}">
+ {{/links}}
<g transform="translate({{gridCol}} {{gridRow}})">
<rect transform="rotate({{rotation}} 1.9 1.9)"
x=".1"
@@ -55,6 +64,9 @@
class="scrn {{class}}"
/>
</g>
+ {{#links}}
+ </a>
+ {{/links}}
{{/machines}}
</g>
</svg>