WowPress-Tailwind/theme/template-parts/widgets/char_search.php

44 lines
2.0 KiB
PHP
Raw Normal View History

2024-04-23 22:43:54 +02:00
<?php
2024-04-26 17:47:19 +02:00
use WoWPress\Models\Character;
2024-04-23 22:43:54 +02:00
?>
2024-04-26 17:47:19 +02:00
<div class="bg-glass shadow p-auto order-last flex flex-col gap-1">
<h1 class="text-xl font-bold text-center">Klassensuche</h1>
<div class="grid grid-cols-5 gap-2">
2024-08-05 20:19:44 +02:00
<?php if ($instance['text']) : ?>
2024-04-26 17:47:19 +02:00
<div class="p-auto col-span-5 text-center">
2024-08-05 20:19:44 +02:00
<?= $instance['text'] ?>
2024-04-26 17:47:19 +02:00
</div>
2024-08-05 20:19:44 +02:00
<?php endif; ?>
2024-04-26 17:47:19 +02:00
<?php foreach ($instance['classes'] as $class => $specs) : ?>
2024-08-05 20:19:44 +02:00
<?php if ($this->hasSpec($specs)) : ?>
<div class="col-span-1"><img src="<?= Character::classIconLink($class) ?>" title="<?= translate_string($class) ?>" alt="" class="h-8"></div>
<div class="col-span-4 grid grid-cols-subgrid">
<?php foreach ($specs as $spec => $search) :
switch ($search) {
case 3:
$classes = "border border-red-500";
$text = "Hoch";
break;
case 2:
$classes = "border border-yellow-500 opacity-70";
$text = "Mittel";
break;
case 1:
$classes = "border border-green-500 opacity-50";
$text = "Niedrig";
break;
case 0:
default:
$classes = "opacity-10";
$text = "Suche geschlossen";
break;
} ?>
<div><img src="<?= Character::specIconLink($class, $spec) ?>" alt="" class="h-8 <?= $classes ?>" title="<?= translate_string($spec) ?>: <?= $text ?>"></div>
<?php endforeach; ?>
</div>
<?php endif; ?>
2024-04-26 17:47:19 +02:00
<?php endforeach; ?>
</div>
2024-04-23 22:43:54 +02:00
</div>