<?php

/**
 * This file is part of JohnCMS Content Management System.
 *
 * @copyright JohnCMS Community
 * @license   https://opensource.org/licenses/GPL-3.0 GPL-3.0
 * @link      https://johncms.com JohnCMS Project
 */

/**
 * @var $title
 * @var $page_title
 * @var $items
 * @var $pagination
 * @var $users_list_url
 * @var $guests_list_url
 * @var $empty_message
 * @var $is_users
 */

$this->layout(
    'system::layout/default',
    [
        'title'      => $title,
        'page_title' => $page_title,
    ]
);
?>
<?php if (! empty($topic)): ?>
    <div class="pb-2">
        <h4><?= __('Who in Topic') ?>: <?= $topic ?></h4>
    </div>
<?php endif; ?>

<?php if ($user->rights): ?>
    <div class="d-flex mb-3">
        <a href="<?= $users_list_url ?>" class="btn btn-outline-primary mr-2 <?= $is_users ? 'active' : '' ?>"><?= __('Users') ?></a>
        <a href="<?= $guests_list_url ?>" class="btn btn-outline-primary <?= $is_users ? '' : 'active' ?>"><?= __('Guests') ?></a>
    </div>
<?php endif; ?>
<?php foreach ($items as $item): ?>
    <?= $this->fetch('forum::user_row', ['item' => $item]) ?>
<?php endforeach; ?>

<?php if (empty($total)): ?>
    <div class="alert alert-info shadow border-0"><?= $empty_message ?></div>
<?php endif; ?>

<?php if (! empty($total)): ?>
    <div>
        <div class="my-2"><?= __('Total') ?>: <?= $total ?></div>
        <!-- Page switching -->
        <?php if ($total > $user->config->kmess): ?>
            <?= $pagination ?>
        <?php endif ?>
    </div>
<?php endif; ?>

<?php if (! empty($id)): ?>
    <div>
        <a href="/forum/?type=topic&id=<?= $id ?>"><?= __('Go to Topic') ?></a>
    </div>
<?php endif; ?>
