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

41 lines
1.3 KiB
PHP

<?php
use PlanetTeamSpeak\TeamSpeak3Framework\Viewer\Html;
use WoWPress\Frontend\Icon;
$this->init($instance);
?>
<div class="bg-glass shadow p-auto order-last flex flex-col gap-2">
<h3 class="text-xl font-bold text-center"><?= $this->title ?></h3>
<?php
if ($this->error) :
?>
<div class="flex flex-col items-center gap-2">
<?= Icon::get('o-exclamation-triangle', '2em'); ?>
<span><?= $this->error ?></span>
</div>
<?php
else :
foreach ($this->ts_server->channelList() as $channel) :
$clients = $channel->clientList();
if (!empty($clients)) :
?>
<span class="flex flex-row items-center gap-1"><?= Icon::get('o-hashtag', '1em') ?><?= $channel ?></span>
<div class="flex flex-col gap-1 px-2">
<?php
foreach ($clients as $client) :
if ($client != "Unknown") :
?>
<span class="flex flex-row items-center gap-1"><?= Icon::get('o-user-circle', '1em') ?><?= $client ?></span>
<?php
endif;
endforeach;
?>
</div>
<?php
endif;
endforeach;
endif;
?>
</div>