Archived
1
0
This repository has been archived on 2020-12-10. You can view files and clone it, but cannot push or open issues or pull requests.
old/application/views/network/posts/post_item.php

120 lines
7.2 KiB
PHP

<?php
defined('BASEPATH') OR exit('No direct script access allowed');
use Coduo\PHPHumanizer\DateTimeHumanizer;
?>
<li class="post-item is-reply% my-2" data-uuid="<?= $hashID ?>" data-username="<?= $username ?>">
<div class="comment-well" <?= isset($hideShadows) && $hideShadows ? 'style="box-shadow: none;padding:0"' : '' ?>>
<div class="post-non-content">
<a href="<?= base_url('user/' . $username) ?>" target="_blank">
<img src="<?= $profilePicture ?>?w=100" class="img-fluid">
</a>
</div>
<div class="content-container">
<div class="content">
<h3>
<a href="<?= base_url('user/' . $username) ?>" target="_blank">
<?= $displayname ?>
</a>
<small><?php
$dateCreated = strtotime($date);
echo DateTimeHumanizer::difference(new \DateTime(), new \DateTime("@$dateCreated"), $_SESSION['site_lang']); ?></small>
<?php if ($replyToPostID != NULL): ?>
<small>
<i class="fa fa-reply"></i>
<?= lang('post_reply_to') ?>
<a href="#" onclick="showFullPost('<?= $replyToPost['hashID'] ?>', '<?= $replyToPost['username'] ?>')">@<?= $replyToPost['displayname'] ?></a>
</small>
<?php endif; ?>
</h3>
<div class="comment">
<p>
<?= $this->PostsModel->closeTags($content) ?>
</p>
<?php if (!empty($media)): ?>
<div class="post-media-list row">
<?php foreach ($media as $item) {
$url = '/f/' . $item['name'];
switch ($item['type']) {
case 'image':
?>
<div class="col">
<div class="post-media post-image" data-full-image="<?= $url ?>" style="background-image: url('<?= $url ?>?w=500')"></div>
</div>
<?php
break;
case 'video':
?>
<div class="col">
<div class="video-container">
<video class="video" src="<?= $url ?>" muted></video>
<div class="video-controls">
<button type="button" class="video-control-btn video-toggle-play">
<i class="fa fa-play"></i>
</button>
<div class="video-volume-container">
<button type="button" class="video-control-btn video-mute">
<i class="fa fa-volume-muted"></i>
</button>
<input type="range" class="video-volume" min="0" max="1" step="0.1" value="1">
</div>
<output class="video-time">0:00</output>
<input type="range" class="video-seek-bar" value="0">
<output class="video-length">0:00</output>
<button type="button" class="video-control-btn video-fullscreen">
<i class="fa fa-expand"></i>
</button>
</div>
</div>
</div>
<?php
break;
case 'audio':
break;
}
} ?>
</div>
<?php endif; ?>
</div>
<?php if (!isset($hideActionBtns) || !$hideActionBtns): ?>
<div class="action-btns">
<a href="#" data-uuid="<?= $hashID ?>" class="action-btn reply-button" data-toggle="tooltip" data-placement="top" title="<?= lang('post_reply') ?>">
<i class="far fa-comment"></i>
<span><?= $replyCount ?></span>
</a>
<a href="#" data-uuid="<?= $hashID ?>" class="action-btn like-button <?= isset($userHasLiked) && $userHasLiked ? 'active' : '' ?>" data-toggle="tooltip" data-placement="top" title="<?= lang('post_like') ?>">
<i class="<?= isset($userHasLiked) && $userHasLiked ? 'fas' : 'far' ?> fa-heart"></i>
<span><?= $likeCount ?></span>
</a>
<div class="action-btn dropdown">
<a href="#" class="action-btn more-options-button" id="postMoreOptionsButton<?= $hashID ?>" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<i class="fa fa-ellipsis-h"></i>
</a>
<div class="dropdown-menu" aria-labelledby="postMoreOptionsButton<?= $hashID ?>">
<a href="#" onclick="copyToClipboard('<?= base_url('user/' . $username . '/post/' . $hashID) ?>')" class="dropdown-item">
<i class="fa fa-copy"></i>
<?= lang('post_copy_link') ?>
</a>
<a href="#" onclick="openPostReportModal('<?= $hashID ?>')" class="dropdown-item">
<i class="fa fa-flag"></i>
<?= lang('post_report') ?>
</a>
<?php if (isset($_SESSION['user']) && $_SESSION['user']['username'] == $username): ?>
<div class="dropdown-divider"></div>
<a href="#" onclick="openDeletePostModal('<?= $hashID ?>')" class="dropdown-item text-danger">
<i class="fa fa-trash"></i>
<?= lang('post_delete') ?>
</a>
<?php endif; ?>
</div>
</div>
</div>
<?php endif; ?>
</div>
</div>
</div>
</li>