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

51 lines
1.9 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-27 21:21:33 +02:00
function hasSearch($specs)
{
foreach ($specs as $spec) {
foreach ($spec as $search) {
if ($search) {
return true;
}
}
}
return false;
}
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">
<?php if($instance['text']): ?>
<div class="p-auto col-span-5 text-center">
<?=$instance['text']?>
</div>
<?php endif; ?>
<?php foreach ($instance['classes'] as $class => $specs) : ?>
<?php if($this->hasSpec($specs)): ?>
2024-05-02 21:29:31 +02:00
<div class="col-span-1"><img src="<?=Character::classIconLink($class)?>" title="<?=translate_string($class)?>" alt="" class="h-8"></div>
2024-04-26 17:47:19 +02:00
<div class="col-span-4 grid grid-cols-subgrid">
<?php foreach ($specs as $spec => $search) : ?>
<div><img src="<?=Character::specIconLink($class,$spec)?>" alt=""
<?php
switch($search){
2024-05-02 21:29:31 +02:00
case 3: ?>class="h-8 border border-red-500" title="<?=translate_string($spec)?>: Hoch"<?php
2024-04-26 17:47:19 +02:00
break;
2024-05-02 21:29:31 +02:00
case 2: ?>class="h-8 opacity-70 border border-yellow-500" title="<?=translate_string($spec)?>: Mittel"<?php
2024-04-26 17:47:19 +02:00
break;
2024-05-02 21:29:31 +02:00
case 1: ?>class="h-8 opacity-50 border border-green-500" title="<?=translate_string($spec)?>: Niedrig"<?php
2024-04-26 17:47:19 +02:00
break;
case 0:
2024-05-02 21:29:31 +02:00
default: ?>class="h-8 opacity-10" title="<?=translate_string($spec)?>: Suche geschlossen"<?php
2024-04-26 17:47:19 +02:00
break;
}
?>
></div>
<?php endforeach; ?>
<?php endif; ?>
</div>
<?php endforeach; ?>
</div>
2024-04-23 22:43:54 +02:00
</div>