Files
Backend/WEBROOT/services/links.php
T
2026-02-12 20:02:06 +01:00

69 lines
1.8 KiB
PHP

<?php
if (!isset($linkButtons) || !is_array($linkButtons)) {
echo "<p>Keine Links konfiguriert.</p>";
return;
}
if (!isset($linkGroups) || !is_array($linkGroups)) {
echo "<p>Keine Link-Gruppen konfiguriert.</p>";
return;
}
?>
<!-- <h2>Externe Links</h2> -->
<div class="links-container">
<?php foreach ($linkGroups as $groupKey => $group): ?>
<?php
// Links dieser Gruppe sammeln
$groupLinks = array_filter($linkButtons, function($button) use ($groupKey, $isAdmin) {
if (($button['group'] ?? null) !== $groupKey) {
return false;
}
if (!empty($button['adminOnly']) && !$isAdmin) {
return false;
}
return true;
});
if (empty($groupLinks)) {
continue;
}
$color = htmlspecialchars($group['color']);
?>
<div class="link-group">
<h3 style="background-color: <?= $color ?>;">
<?= htmlspecialchars($group['label']) ?>
</h3>
<div class="group-links">
<?php foreach ($groupLinks as $button):
$target = !empty($button['newTab']) ? '_blank' : '_self';
?>
<a href="<?= htmlspecialchars($button['url']) ?>"
target="<?= $target ?>"
<?= $target === '_blank' ? 'rel="noopener noreferrer"' : '' ?>>
<button class="link-button"
style="
border-color: <?= $color ?>;
background-color: <?= $color ?>;
">
<?= htmlspecialchars($button['label']) ?>
</button>
</a>
<?php endforeach; ?>
</div>
</div>
<?php endforeach; ?>
</div>