<?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,
    ]
);
$this->sectionReplace('sidebar-menu', $this->fetch('admin::sidebar-admin-menu', ['module_menu' => ['forum' => true]]));
?>

<div class="alert alert-danger">
    <div class="pb-2">
        <?= __('<h3>WARNING!</h3>There are topics in the section. You must move them to another section.') ?>
    </div>
</div>
<div>
    <form action="<?= $data['form_action'] ?>" method="post">
        <h3><?= __('Select section') ?></h3>
        <?php foreach ($data['sections'] as $sections): ?>
            <div class="custom-control custom-radio">
                <input type="radio" id="sect_<?= $sections['id'] ?>" name="subcat" value="<?= $sections['id'] ?>" class="custom-control-input">
                <label class="custom-control-label" for="sect_<?= $sections['id'] ?>"><?= $this->e($sections['name']) ?></label>
            </div>
        <?php endforeach; ?>
        <h3 class="mt-3"><?= __('Other category') ?></h3>
        <ul>
            <?php foreach ($data['categories'] as $category): ?>
                <li><a href="?act=forum&amp;mod=del&amp;id=<?= $data['id'] ?>&amp;cat=<?= $category['id'] ?>"><?= $this->e($category['name']) ?></a></li>
            <?php endforeach; ?>
        </ul>
        <div class="alert alert-info">
            <?= __('All the topics and files will be moved to selected section. Old section will be deleted.') ?>
        </div>
        <div class="mb-3">
            <button type="submit" name="submit" value="1" class="btn btn-danger"><?= __('Move') ?></button>
        </div>
        <?php if ($user->rights === 9): ?>
            <div class="mb-2">
                <h3><?= __('Complete removal') ?></h3>
                <?= __('WARNING! All the information will be deleted') ?>
            </div>
            <button type="submit" name="delete" value="1" class="btn btn-danger"><?= __('Delete') ?></button>
        <?php endif; ?>
        <a href="<?= $data['back_url'] ?>" class="btn btn-outline-secondary"><?= __('Cancel') ?></a>
    </form>
</div>

