View file modules/profile/templates/karma.phtml

File size: 2.59Kb
<?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 $data
 */

$this->layout(
    'system::layout/default',
    [
        'title'      => $title,
        'page_title' => $page_title,
    ]
);
?>

<?php if (! empty($data['filters'])): ?>
    <div class="mb-2">
        <?php foreach ($data['filters'] as $filter): ?>
            <a href="<?= $filter['url'] ?>" class="btn btn-outline-secondary mb-1 <?= ($filter['active'] ? 'active' : '') ?>"><?= $filter['name'] ?></a>
        <?php endforeach; ?>
    </div>
<?php endif; ?>
<?php if (empty($data['items'])): ?>
    <?= $this->fetch(
        'system::app/alert',
        [
            'alert_type' => 'alert-info',
            'alert'      => __('The list is empty'),
        ]
    ) ?>
<?php endif; ?>

<?php foreach ($data['items'] as $item): ?>
    <div class="user-row">
        <div class="post-header d-flex justify-content-between">
            <div class="d-flex align-items-center">
                <div class="badge <?= ($item['type'] > 0 ? 'badge-success' : 'badge-danger') ?> mr-2">
                    <?= ($item['type'] > 0 ? '+' : '-') ?><?= $item['points'] ?>
                </div>
                <?php if ($item['user_id'] > 0): ?>
                    <a href="/profile/?user=<?= $item['user_id'] ?>" class="user-login mr-2"><?= $item['name'] ?></a>
                <?php else: ?>
                    <b class="user-login mr-2"><?= $item['name'] ?></b>
                <?php endif; ?>
                <span class="post-date"><?= $item['display_date'] ?></span>
            </div>
        </div>
        <?php if (! empty($item['text'])): ?>
            <div class="pt-1">
                <?= $item['text'] ?>
            </div>
        <?php endif ?>
        <?php if (! empty($item['delete_url'])): ?>
            <a href="<?= $item['delete_url'] ?>" class="small">Удалить</a>
        <?php endif; ?>
    </div>
<?php endforeach; ?>

<?php if (! empty($data['reset_url'])): ?>
    <div class="mt-3 mb-2">
        <a href="<?= $data['reset_url'] ?>" class="btn btn-danger btn-sm"><?= __('Reset Karma') ?></a>
    </div>
<?php endif; ?>

<?php if ($data['total'] > $user->config->kmess): ?>
    <div class="mt-3">
        <?= $data['pagination'] ?>
    </div>
<?php endif; ?>

<?php if ($data['total'] > 0): ?>
    <div><?= __('Total:') ?> <?= $data['total'] ?></div>
<?php endif; ?>

<div>
    <a href="<?= $data['back_url'] ?>"><?= __('Back') ?></a>
</div>