View file modules/forum/templates/section.phtml

File size: 1.82Kb
<?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 \Forum\Models\ForumSection $sections
 * @var \Forum\Models\ForumSection $section
 * @var $online
 * @var $files_count
 * @var $unread_count
 */

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

<?= $this->fetch(
    'forum::header',
    [
        'unread_count' => $unread_count,
        'files_count'  => $files_count,
        'files_url'    => '/forum/?act=files&c=' . $id,
        'files_name'   => __('Section Files'),
    ]
) ?>

<?php if ($sections->count() === 0): ?>
    <?= $this->fetch(
        'system::app/alert',
        [
            'alert_type' => 'alert-info',
            'alert'      => __('There are no sections in this category'),
        ]
    ) ?>
<?php endif; ?>

<?php foreach ($sections as $section): ?>
    <div class="forum-section">
        <div class="section-header">
            <div class="d-flex align-items-center">
                <a href="<?= $section->url ?>" class="section-name"><?= $section->name ?></a>
                <span class="badge badge-pill badge-light border ml-3"><?= ($section->section_type === 1 ? $section->topics_count : $section->subsections_count) ?></span>
            </div>
        </div>
        <?php if (! empty($section->description)): ?>
            <div class="small pt-2 text-muted"><?= $section->description ?></div>
        <?php endif; ?>
    </div>
<?php endforeach; ?>
<?= $this->fetch(
    'forum::footer',
    [
        'online'   => $online,
        'who_url'  => '/forum/?act=who',
        'who_name' => __('Who in Forum'),
    ]
) ?>