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

<div class="top-players-group">
    <?php foreach ($rankings as $ranking): ?>
        <?php foreach ($ranking['data'] as $type => $data): ?>
            <div class="top-player-group top-players-group-3">
                <div class="type"><?= $ranking['name'] ?> <?= __(ucfirst($type)) ?></div>
                <table class="list" style="margin-bottom:10px">
                    <thead>
                        <tr>
                            <th>#</th>
                            <th><?= __('Name') ?></th>
                            <th style="text-align:right;"><?= __('Score') ?></th>
                        </tr>
                    </thead>

                    <tbody>
                        <?php foreach ($data as $rank => $record): ?>
                            <tr>
                                <td style="text-align:left;"><?= $rank + 1 ?></td>
                                <td style="text-align:left;">
                                    <div class="data-name">
                                        <?php if ($ranking['is_guild']): ?>
                                            <?= util('Guild')->logo($record['mark'], 20) ?>
                                        <?php else: ?>
                                            <img src="<?= util('Character')->avatar($record['avatar']) ?>" width="20" />
                                        <?php endif ?>

                                        <?php if (plugin_active('Profile')): ?>
                                            <a data-ajax href="<?= url_to('/profile/' . ($ranking['is_guild'] ? 'guild' : 'character') . '/' . $record['name']) ?>"><?= $record['name'] ?></a>
                                        <?php else: ?>
                                            <?= $record['name'] ?>
                                        <?php endif ?>
                                    </div>
                                </td>
                                <td style="text-align:right;"><?= $record['score'] ?></td>
                            </tr>
                        <?php endforeach ?>
                    </tbody>
                </table>
            </div>
        <?php endforeach ?>
    <?php endforeach ?>
</div>
