View file modules/album/templates/show_one.phtml

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

use Albums\Photo;

/**
 * @var $title
 * @var $page_title
 * @var $data
 * @var $photo Photo
 */

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

$photo = $data['photos'][0] ?? [];
?>
<?php if (empty($data['photos'])): ?>
    <?= $this->fetch(
        'system::app/alert',
        [
            'alert_type' => 'alert-info',
            'alert'      => __('The list is empty'),
        ]
    ) ?>
<?php endif; ?>
<?php if (! empty($data['success_message'])): ?>
    <?= $this->fetch(
        'system::app/alert',
        [
            'alert_type' => 'alert-success border-0',
            'alert'      => $data['success_message'],
        ]
    ) ?>
<?php endif; ?>
<?php if (! empty($photo)): ?>
    <div class="row">
        <div class="col-md-5">
            <a href="<?= $photo->picture ?>" title="<?= __('Photo') ?> "
               data-source="<?= $photo->download_url ?>" class="image-preview">
                <img src="<?= $photo->preview_picture ?>" alt=".">
            </a>
        </div>
    </div>
    <?php if (! empty($photo->formatted_description)): ?>
        <div class="description mt-3 border-top pt-3">
            <?= $photo->formatted_description ?>
        </div>
    <?php endif; ?>
    <div class="text-muted mt-3 mb-3 border-top border-bottom pt-2 pb-2">
        <div><?= __('Views') ?>: <?= $photo->views ?></div>
        <div><?= __('Downloads') ?>: <?= $photo->downloads ?></div>
        <div><?= __('Date') ?>: <?= $photo->display_date ?></div>
        <div>
            <?= __('User') ?>: <a href="<?= $photo->user_albums_url ?>"><?= $photo->user_name ?></a>
        </div>
        <div>
            <?= __('Album') ?>: <a href="<?= $photo->user_album_url ?>"><?= $photo->album_name ?></a>
        </div>
        <div>
            <span><?= __('Rating') ?>:</span>
            <span class="pr-2 font-weight-bold"><?= $photo->rating ?></span>
            <!-- Vote -->
            <?php if ($photo->can_vote): ?>
                <a href="<?= $photo->like_url ?>" class="text-decoration-none pr-2">
                    <svg class="icon download-button-icon mt-n2">
                        <use xlink:href="<?= $this->asset('icons/sprite.svg') ?>#like"></use>
                    </svg>
                    <span><?= $photo->vote_plus ?></span>
                </a>
                <a href="<?= $photo->dislike_url ?>" class="text-decoration-none pr-2">
                    <svg class="icon download-button-icon mr-1">
                        <use xlink:href="<?= $this->asset('icons/sprite.svg') ?>#dislike"></use>
                    </svg>
                    <span><?= $photo->vote_minus ?></span>
                </a>
            <?php else: ?>
                <div class="d-inline pr-2 text-muted">
                    <svg class="icon download-button-icon mt-n2">
                        <use xlink:href="<?= $this->asset('icons/sprite.svg') ?>#like"></use>
                    </svg>
                    <span><?= $photo->vote_plus ?></span>
                </div>
                <div class="d-inline pr-2 text-muted">
                    <svg class="icon download-button-icon mr-1">
                        <use xlink:href="<?= $this->asset('icons/sprite.svg') ?>#dislike"></use>
                    </svg>
                    <span><?= $photo->vote_minus ?></span>
                </div>
            <?php endif; ?>
            <!-- // Vote -->
        </div>
    </div>

    <div class="border-bottom pb-3">
        <svg class="icon download-button-icon mr-1 mt-n1">
            <use xlink:href="<?= $this->asset('icons/sprite.svg') ?>#download"/>
        </svg>
        <a href="<?= $photo->download_url ?>"><?= __('Download') ?></a>
    </div>

    <?php if ($config['mod_down_comm'] || $systemUser->rights >= 7): ?>
        <div class="mt-3 pb-3 border-bottom">
            <svg class="icon download-button-icon mr-1">
                <use xlink:href="<?= $this->asset('icons/sprite.svg') ?>#forum"/>
            </svg>
            <a href="<?= $photo->comments_url ?>"><?= __('Comments') ?></a> (<?= $photo->comm_count ?>)
        </div>
    <?php endif; ?>

    <?php if ($user->rights >= 6 || $user->id === $photo->user_id): ?>
        <div class="btn-group mt-3">
            <div class="dropdown">
                <button class="btn btn-danger dropdown-toggle btn-sm" type="button" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                    <?= __('Actions') ?>
                </button>
                <div class="dropdown-menu" aria-labelledby="dropdownMenuButton">
                    <?php if ($user->id === $photo->user_id): ?>
                        <a class="dropdown-item"
                           href="./show?al=<?= $photo->album_id ?>&amp;user=<?= $photo->user_id ?>&amp;view&amp;img=<?= $photo->id ?>&amp;profile">
                            <?= __('Add to Profile') ?>
                        </a>
                    <?php endif; ?>
                    <a class="dropdown-item" href="./image_edit?img=<?= $photo->id ?>&amp;user=<?= $photo->user_id ?>"><?= __('Edit') ?></a>
                    <a class="dropdown-item" href="./image_move?img=<?= $photo->id ?>&amp;user=<?= $photo->user_id ?>"><?= __('Move') ?></a>
                    <a class="dropdown-item" href="./image_delete?img=<?= $photo->id ?>&amp;user=<?= $photo->user_id ?>"><?= __('Delete') ?></a>
                </div>
            </div>
        </div>
    <?php endif; ?>

<?php endif; ?>

<?php if ($data['total'] > $data['per_page']): ?>
    <div class="mt-4">
        <?= $data['pagination'] ?>
    </div>
<?php endif; ?>

<?php if ($data['total'] > 0): ?>
    <div><?= __('Total') ?>: <?= $data['total'] ?></div>
<?php endif; ?>

<div class="mt-2">
    <a href="<?= $photo->user_album_url ?>"><?= __('Back') ?></a><br>
    <a href="./list?user=<?= $photo->user_id ?>"><?= __('Album List') ?></a>
</div>