<h1 class="title"><?= __('Ranking') ?> <?= $ranking['name'] ?></h1>

<ul class="breadcrumber">
    <li><a href="<?= url_to('/') ?>" data-ajax><?= __('Home') ?></a></li>
    <li><a href="<?= url_to('/rankings') ?>" data-ajax><?= __('Rankings') ?></a></li>
    <li class="active"><?= $ranking['name'] ?></li>
</ul>

<?= partial('rankings', ['current' => $ranking]) ?>

<hr />

<div class="rankings">
    <?php foreach ($data as $character): ?>
        <div class="character rank-<?= $character['rownum'] ?>">
            <?= util('Ranking')->position($character['rank']) ?>
            <?php if ($character['rownum'] > 3): ?>
                <div class="rank"><?= $character['rownum'] ?>&deg;</div>
            <?php else: ?>
                <div class="rank-trophy"></div>
            <?php endif ?>

            <div class="image">
                <img src="<?= util('Character')->avatar($character['avatar']) ?>" width="60" height="76" />
            </div>
            <div class="desc">
                <div class="name">
                    <?= plugin_active('Profile') ? '<a data-ajax href="' . url_to('/profile/character/' . $character['name']) . '">' . $character['name'] . '</a>' : $character['name'] ?>
                    <?php if (config('register.countries_flag_column', null)): ?>
                        <img title="<?= country_name($character['country']) ?>" src="<?= resource_to('/images/flags/' . strtolower($character['country']) . '.gif') ?>" height="10" />
                    <?php endif ?>

                    <?php if (plugin_active('Patents')): ?>
                        <?php if (empty($character['patentImage'])): ?>
                            <sup style="color:#5ab5ce"><?= $character['patentTitle'] ?></sup>
                        <?php else: ?>
                            <sup style="color:#5ab5ce"><img data-toggle="tooltip" title="<?= $character['patentTitle'] ?>" src="<?= upload_to('/patents/' . $character['patentImage']) ?>" height="20" /></sup>
                        <?php endif ?>
                    <?php endif ?>
                </div>
                <div class="class"><?= util('Character')->className($character['class']) ?></div>
                <div class="level"><?= $character['score'] ?> <?php if (isset($character['subscore'])): ?><sup><?= $character['subscore'] ?></sup><?php endif ?></div>
                <div class="status"><?= strtolower(util('Character')->status($character['status'])) ?></div>
                <div class="guild-name">
                    <?= __('Guild') ?>:
                    <?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 ?>
                </div>
            </div>
        </div>
    <?php endforeach ?>
</div>