View file modules/forum/templates/files_list.phtml

File size: 6.89Kb
<?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
 */

$this->layout(
    'system::layout/default',
    [
        'title'      => $title,
        'page_title' => $page_title,
    ]
);
?>
<?php if (! empty($new_count)): ?>
    <div class="border-top border-bottom mb-3">
        <div class="py-3">
            <a href="<?= $new_url ?>"><?= __('New Files') ?></a>
            <span class="badge badge-pill badge-danger"><?= $new_count ?></span>
        </div>
    </div>
<?php endif; ?>

<?php if (empty($files)): ?>
    <div class="alert alert-info">
        <?= __('The list is empty') ?>
    </div>
<?php endif; ?>

<div>
    <?php foreach ($files as $file): ?>
        <div class="new_post-item border-bottom shadow mb-2">
            <div class="new_post-header d-flex justify-content-between">
                <div class="post-user">
                    <?php if (! empty($file['user_profile_link'])): ?>
                        <a href="<?= $file['user_profile_link'] ?>">
                            <div class="avatar">
                                <img src="<?= $this->avatar($file['user_id']) ?>" class="img-fluid" alt=".">
                            </div>
                        </a>
                    <?php else: ?>
                        <div class="avatar">
                            <img src="<?= $this->avatar($file['user_id']) ?>" class="img-fluid" alt=".">
                        </div>
                    <?php endif; ?>
                    <span class="user-status <?= (time() <= $file['lastdate'] + 300) ? 'online' : 'offline' ?> shadow"></span>
                    <?php if (! empty($file['user_rights_name'])): ?>
                        <div class="post-of-user"
                             data-toggle="tooltip"
                             data-placement="top"
                             data-html="true"
                             title="<?= $file['user_rights_name'] ?>">
                            <svg class="icon-post">
                                <use xlink:href="<?= $this->asset('icons/sprite.svg') ?>?4#check"/>
                            </svg>
                        </div>
                    <?php endif ?>
                </div>
                <div class="flex-grow-1 post-user d-flex flex-wrap overflow-hidden d-flex align-items-center">
                    <div class="w-100">
                        <?php if (! empty($file['user_profile_link'])): ?>
                            <a href="<?= $file['user_profile_link'] ?>"><span class="user-name d-inline mr-2"><?= $file['user_name'] ?></span></a>
                        <?php else: ?>
                            <div class="user-name d-inline mr-2"><?= $file['user_name'] ?></div>
                        <?php endif; ?>
                        <a href="<?= $file['post_url'] ?? '' ?>"
                           class="post-meta d-inline mr-2"
                           data-toggle="tooltip"
                           data-placement="top"
                           title="<?= __('Link to post') ?>">
                            <?= $file['post_time'] ?>
                        </a>
                    </div>
                    <?php if (! empty($file['status'])): ?>
                        <div class="overflow-hidden text-nowrap text-dark-brown overflow-ellipsis small">
                            <span class="font-weight-bold"><?= $file['status'] ?></span>
                        </div>
                    <?php endif ?>
                </div>
            </div>
            <div class="post-body">
                <?= $file['post_text'] ?>
            </div>
            <div class="pt-1 pb-1">
                <div class="d-flex flex-wrap pt-2">
                    <div class="attached-file pr-3 d-flex flex-column justify-content-between">
                        <div class="d-flex justify-content-center align-items-center">
                            <?php if (! empty($file['file_preview'])): ?>
                                <a href="<?= $file['file_url'] ?>" class="image-preview" data-source="<?= $file['file_url'] ?>" title="<?= $file['filename'] ?>">
                                    <img src="<?= $file['file_preview'] ?>" class="img-thumbnail thumb-limit-height" alt="<?= $file['filename'] ?>">
                                </a>
                            <?php else: ?>
                                <a href="<?= $file['file_url'] ?>">
                                    <svg class="icon attachment-icon">
                                        <use xlink:href="<?= $this->asset('icons/sprite.svg') ?>#file"/>
                                    </svg>
                                </a>
                            <?php endif; ?>
                        </div>
                        <div class="pt-1">
                            <div class="text-muted small d-flex flex-wrap justify-content-center">
                                <div class="text-nowrap pr-1">
                                    <svg class="icon downloads-icon">
                                        <use xlink:href="<?= $this->asset('icons/sprite.svg') ?>#download"/>
                                    </svg>
                                    <?= $file['dlcount'] ?>
                                </div>
                                <div>(<?= $file['file_size'] ?>&nbsp;kb)</div>
                            </div>
                            <div class="file-name">
                                <a href="<?= $file['file_url'] ?>" title="<?= $file['filename'] ?>"><?= $file['filename'] ?></a>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <?php if (! empty($file['post_url']) || ! empty($file['topic_url'])): ?>
                <div class="post-footer d-flex">
                    <div class="ml-auto">
                        <?php if (! empty($file['post_url'])): ?>
                            <a href="<?= $file['post_url'] ?>" class="ml-2"><?= __('To message') ?></a>
                        <?php endif; ?>
                        <?php if (! empty($file['topic_url'])): ?>
                            <a href="<?= $file['topic_url'] ?>" class="ml-2"><?= __('To topic') ?></a>
                        <?php endif; ?>
                    </div>
                </div>
            <?php endif; ?>
        </div>
    <?php endforeach; ?>
</div>

<div class="mb-3">
    <div><?= __('Total') ?>: <?= $total ?></div>
    <!-- Page switching -->
    <?php if ($total > $user->config->kmess): ?>
        <div class="mt-1"><?= $pagination ?></div>
    <?php endif ?>
</div>

<?php if (! empty($back_url)): ?>
    <div class="mb-3">
        <a href="<?= $back_url ?>"><?= $back_url_name ?></a><br>
        <a href="/forum/"><?= __('Forum') ?></a>
    </div>
<?php endif; ?>