<?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'      => __('Moderation Articles'),
        'page_title' => __('Moderation Articles'),
    ]
);
?>

<?php if (isset($_GET['all'])) : ?>
    <div class="alert alert-success"><?= __('All Articles added in database') ?></div>
<?php endif; ?>
<?php if ($id && isset($_GET['yes'])) : ?>
    <div class="alert alert-success"><?= __('Article') ?> <strong><?= $article ?></strong> <?= __('Added to the database') ?></div>
<?php endif; ?>
<?php if ($total) : ?>
    <?php $i = 0; ?>
    <?php foreach ($list() as $premod) : ?>
        <div class="card mb-3 shadow border-0">
            <div class="card-body">
                <a href="?id=<?= $premod['id'] ?>" class="card-title h3"><?= $premod['name'] ?></a>
                <div class="text-muted small d-flex align-items-center flex-wrap mt-1">
                    <div class="mr-2">
                        <span><?= __('Author:') ?></span><?= $premod['who'] ?>
                    </div>
                </div>
                <div class="mt-2">
                    <a href="?act=premod&amp;yes&amp;id=<?= $premod['id'] ?>" class="pr-2"><?= __('Approve') ?></a>
                    <a href="?act=del&amp;type=article&amp;id=<?= $premod['id'] ?>"><?= __('Delete') ?></a>
                </div>
            </div>
        </div>
    <?php endforeach; ?>
<?php endif; ?>
<div><?= __('Total') ?>: <?= $total ?></div>
<?php if ($total > $user->config->kmess): ?>
    <div><?= $pagination ?></div>
<?php endif ?>
<?php if ($total) : ?>
    <div><a href="?act=premod&amp;all"><?= __('Approve all') ?></a></div>
<?php endif ?>
<p><a href="?"><?= __('To Library') ?></a></p>
