<div class="align-center">
    <?php foreach (config('rankings', []) as $id => $ranking): ?>
        <?php if ($ranking['active']): ?>
            <a data-ajax class="btn-secondary<?= isset($current) && $current['id'] == $id ? ' active' : '' ?>" href="<?= url_to('/rankings/' . util('Inflector')->dasherize($id)) ?>"><?= isset($ranking['name']) ? $ranking['name'] : $id  ?></a>
        <?php endif ?>
    <?php endforeach ?>
</div>

<?php if (isset($current)): ?>
    <?php $configs = isset($current['configs']) ? $current['configs'] : [] ?>

    <?php if (isset($current['has_frequency'])
            && $current['has_frequency']): ?>

        <hr />

        <div class="align-center">
            <a data-ajax class="btn-secondary<?= empty($current['type']) ? ' active' : '' ?>" href="<?= url_to('/rankings/' . util('Inflector')->dasherize($current['id'])) ?>"><?= __('Realtime') ?></a>

            <?php if (isset($configs['daily'])): ?>
                <a data-ajax class="btn-secondary<?= $current['type'] == 'daily' ? ' active' : '' ?>" href="<?= url_to('/rankings/' . util('Inflector')->dasherize($current['id'])) ?>:daily"><?= __('Daily') ?></a>
            <?php endif ?>

            <?php if (isset($configs['weekly'])): ?>
                <a data-ajax class="btn-secondary<?= $current['type'] == 'weekly' ? ' active' : '' ?>" href="<?= url_to('/rankings/' . util('Inflector')->dasherize($current['id'])) ?>:weekly"><?= __('Weekly') ?></a>
            <?php endif ?>

            <?php if (isset($configs['monthly'])): ?>
                <a data-ajax class="btn-secondary<?= $current['type'] == 'monthly' ? ' active' : '' ?>" href="<?= url_to('/rankings/' . util('Inflector')->dasherize($current['id'])) ?>:monthly"><?= __('Monthly') ?></a>
            <?php endif ?>
        </div>
    <?php endif ?>

    <?php if (config('ranking.show_search_classes', false) && !$current['is_guild']): ?>

        <hr />

        <div class="align-center">
            <?php foreach (util('Character')->getGroupedClass() as $classes): ?>
                <?php $class = array_shift($classes) ?>
                <?php $frequency = $current['type'] ? ':' . $current['type'] : '' ?>
                <a data-ajax class="btn-secondary<?= strtolower($class['short_name']) == Input::get('class') ? ' active' : '' ?>" href="<?= url_to('/rankings/' . util('Inflector')->dasherize($current['id'])) ?><?= $frequency ?>?class=<?= strtolower($class['short_name']) ?>"><?= $class['name'] ?>'s</a>
            <?php endforeach ?>
        </div>
    <?php endif ?>

<?php endif ?>
