<?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 ?? $title,
    ]
);
?>
<?php if ($total) : ?>
    <?php foreach ($list() as $newlist): ?>
        <div class="new_post-item without_avatar">
            <a href="?id=<?= $newlist['id'] ?>" class="card-title h3"><?= $newlist['name'] ?></a>
            <div class="post-body"><?= $newlist['announce'] ?></div>
            <div class="text-muted small d-flex align-items-center flex-wrap">
                <div class="mr-2">
                    <span><?= __('Section:') ?></span> <a href="?do=dir&amp;id=<?= $newlist['cat_id'] ?>"><?= $newlist['catalog_name'] ?></a>
                </div>
                <div class="mr-2">
                    <span><?= __('Author:') ?></span><?= $newlist['who'] ?>
                </div>
                <div class="d-flex align-items-center mr-1">
                    <span class="pr-1"><?= __('Rating:') ?></span><?= $newlist['ratingView'] ?>
                </div>
                <div>
                    <?php if ($newlist['comments']) : ?>
                        <a href="?act=comments&amp;id=<?= $newlist['id'] ?>"><?= __('Comments:') ?></a>
                        (<?= $newlist['comm_count'] ?>)
                    <?php endif; ?>
                </div>
            </div>
        </div>
    <?php endforeach; ?>
<?php endif; ?>
<div class="mt-2"><?= __('Total') ?>: <?= $total ?></div>
<?php if ($total > $user->config->kmess) : ?>
    <div><?= $pagination ?></div>
<?php endif ?>
<div class="mt-2">
    <a href="?"><?= __('To Library') ?></a>
</div>
