fehlerbehandlung beim statusicon geändert
getKrautStatus gibt jetzt einen string zurück. tooltip in den php-code verlegt. icon für fehler beim auswerten des statuscode hinzugefügt. catch prüft jetzt auf throwable.
This commit is contained in:
parent
d452c362ad
commit
6ffb650103
3 changed files with 21 additions and 11 deletions
2
public/images/icons/question.svg
Normal file
2
public/images/icons/question.svg
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<svg width="1792" height="1792" viewBox="0 0 1792 1792" xmlns="http://www.w3.org/2000/svg"><path d="M1088 1256v240q0 16-12 28t-28 12h-240q-16 0-28-12t-12-28v-240q0-16 12-28t28-12h240q16 0 28 12t12 28zm316-600q0 54-15.5 101t-35 76.5-55 59.5-57.5 43.5-61 35.5q-41 23-68.5 65t-27.5 67q0 17-12 32.5t-28 15.5h-240q-15 0-25.5-18.5t-10.5-37.5v-45q0-83 65-156.5t143-108.5q59-27 84-56t25-76q0-42-46.5-74t-107.5-32q-65 0-108 29-35 25-107 115-13 16-31 16-12 0-25-8l-164-125q-13-10-15.5-25t5.5-28q160-266 464-266 80 0 161 31t146 83 106 127.5 41 158.5z"/></svg>
|
After Width: | Height: | Size: 587 B |
|
@ -38,15 +38,17 @@
|
||||||
<div id="headline" class="flex-box row">
|
<div id="headline" class="flex-box row">
|
||||||
<div id="header-left" class="flex-box row center">
|
<div id="header-left" class="flex-box row center">
|
||||||
<div id="status-icon" class="icon tooltip">
|
<div id="status-icon" class="icon tooltip">
|
||||||
<span class="tooltiptext">Befinden sich Leute im Raum?</span>
|
|
||||||
<?php
|
<?php
|
||||||
|
include_once '../src/getContent.php';
|
||||||
try {
|
try {
|
||||||
include_once '../src/getContent.php';
|
echo getKrautButton($status);
|
||||||
getKrautButton($status);
|
} catch(Throwable $th) {
|
||||||
} catch(Exception $ex) {
|
echo '<span class="tooltiptext">
|
||||||
error_log("$ex", 0);
|
Fehler beim Parsen des Raumstatus</span>
|
||||||
|
<img alt="Raumstatus Icon - Fehler beim Parsen"
|
||||||
|
class="icon-img" src="./images/icons/question.svg"/>';
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
</div>
|
</div>
|
||||||
<div id="banner-div" class="flex-box column">
|
<div id="banner-div" class="flex-box column">
|
||||||
<a id="banner" href="#"
|
<a id="banner" href="#"
|
||||||
|
|
|
@ -40,13 +40,19 @@ function getStatus(): bool
|
||||||
catch (Error $e) { return false; }
|
catch (Error $e) { return false; }
|
||||||
}
|
}
|
||||||
|
|
||||||
function getKrautButton(bool $status)
|
/**
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
function getKrautButton(bool $status): string
|
||||||
{
|
{
|
||||||
if ($status) {
|
if ($status) {
|
||||||
echo '<img alt="Raumstatus Icon - Raum ist geöffnet"
|
return '<span class="tooltiptext">Der Space ist geöffnet</span>
|
||||||
class="icon-img" src="./images/icons/users.svg">';
|
<img alt="Raumstatus Icon - Raum ist geöffnet"
|
||||||
|
class="icon-img" src="./images/icons/users.svg">';
|
||||||
} else {
|
} else {
|
||||||
echo '<img alt="Raumstatus Icon - Raum ist geschlossen"
|
return '<span class="tooltiptext">Der Space ist geschlossen</span>
|
||||||
class="icon-img" src="./images/icons/user-times.svg">';
|
<img alt="Raumstatus Icon - Raum ist geschlossen"
|
||||||
|
class="icon-img" src="./images/icons/user-times.svg">';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue