<?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 $files
 * @var $buttons
 * @var $urls
 */

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

<?php if (! $config['mod_down']): ?>
    <div class="alert alert-danger border-0 shadow">
        <?= __('Downloads are closed') ?>
    </div>
<?php endif; ?>

<div class="mb-3 mt-n1">
    <?php foreach ($buttons as $button): ?>
        <a href="<?= $button['url'] ?>" class="btn btn-outline-primary btn-sm mr-1 mt-1 <?= $button['active'] ? 'active' : '' ?>"><?= $button['name'] ?></a>
    <?php endforeach; ?>
</div>

<?php if (empty($files)): ?>
    <div class="row">
        <div class="col-md-6">
            <div class="alert alert-info"><?= __('List is empty') ?></div>
        </div>
    </div>
<?php endif; ?>

<?php foreach ($files as $file): ?>
    <?= $this->fetch('downloads::file_row', ['file' => $file]) ?>
<?php endforeach; ?>

<div class="mt-3">
    <a href="<?= $urls['downloads'] ?>"><?= __('Downloads') ?></a>
</div>
