<h1 class="title"><?= __('Players online') ?></h1>

<ul class="breadcrumber">
    <li><a href="<?= url_to('/') ?>" data-ajax><?= __('Home') ?></a></li>
    <li class="active"><?= __('Players online') ?></li>
</ul>

<div class="box-panel">
    <div class="box-panel-title"><?= __('Players') ?></div>
    <div class="box-panel-content">
        <table class="list">
            <thead>
                <tr>
                    <th><?= __('Character') ?></th>
                    <th><?= __('Class') ?></th>
                    <th><?= __('Guild') ?></th>
                    <th><?= __('Server') ?></th>
                    <th width="120"><?= __('Connected at') ?></th>
                </tr>
            </thead>

            <tbody>
                <?php foreach (server()->getCharactersOnline() as $character): ?>
                    <tr>
                        <td><?= plugin_active('Profile') ? '<a data-ajax href="' . url_to('/profile/character/' . $character['character']) . '">' . $character['character'] . '</a>' : $character['character'] ?></td>
                        <td><?= util('Character')->className($character['character_class']) ?></td>
                        <td>
                            <?php if ($character['guild']): ?>
                                <?= plugin_active('Profile') ? '<a data-ajax href="' . url_to('/profile/guild/' . $character['guild']) . '">' . $character['guild'] . '</a>' : $character['guild'] ?>
                            <?php else: ?>
                                -
                            <?php endif ?>
                        </td>
                        <td><?= $character['server_name'] ?></td>
                        <td><?= util('Date')->dateTime($character['connected_at']) ?></td>
                    </tr>
                <?php endforeach ?>
            </tbody>
        </table>
    </div>
</div>