263 lines
12 KiB
PHP
263 lines
12 KiB
PHP
|
<?php
|
||
|
defined('BASEPATH') OR exit('No direct script access allowed');
|
||
|
|
||
|
use Coduo\PHPHumanizer\DateTimeHumanizer;
|
||
|
|
||
|
?>
|
||
|
|
||
|
<div class="col-sm-8 col-sm-pull-4">
|
||
|
<div class="like-toggle-icon-container floating">
|
||
|
<button class="like-toggle-icon <?= $hasLiked ? '-checked' : '' ?>" title="❤ Toggle Like!" onclick="likeDislike(<?= $postID ?>)"></button>
|
||
|
<span class="like-count"><?= $likeCount ?></span>
|
||
|
</div>
|
||
|
|
||
|
<div class="blog">
|
||
|
<div class="blog-item">
|
||
|
<?php if ($postIsDeleted): ?>
|
||
|
<h2 class="text-error">
|
||
|
<i class="fa fa-warning"></i>
|
||
|
</h2>
|
||
|
<?php else: ?>
|
||
|
<?php if ($postImage != '') { ?>
|
||
|
<img class="img-fluid img-blog" src="<?= $postImage; ?>?w=800" width="100%" alt="" />
|
||
|
<?php } ?>
|
||
|
<div class="blog-content">
|
||
|
<div class="entry-meta">
|
||
|
<span>
|
||
|
<a href="<?= base_url('user/' . $postAuthorUsername) ?>">
|
||
|
<i class="far fa-user"></i>
|
||
|
<?= $postAuthorDisplayname ?>
|
||
|
</a>
|
||
|
</span>
|
||
|
<?php
|
||
|
$publishDate = strtotime($postPublishDate);
|
||
|
$lastEdit = strtotime($postLastEdit);
|
||
|
?>
|
||
|
<span style="cursor:pointer" data-toggle="tooltip" data-placement="bottom"
|
||
|
title="<?= strftime("%d. %B %Y", $publishDate) ?>">
|
||
|
<i class="far fa-calendar"></i>
|
||
|
<?= DateTimeHumanizer::difference(new \DateTime(), new \DateTime("@$publishDate"), $_SESSION['site_lang']) ?>
|
||
|
</span>
|
||
|
|
||
|
<?php if (isset($postLastEdit) && $postLastEdit !== null): ?>
|
||
|
<span style="cursor:pointer" data-toggle="tooltip" data-placement="bottom"
|
||
|
title="<?= strftime("%d. %B %Y", $lastEdit) ?>">
|
||
|
<i class="far fa-edit"></i>
|
||
|
<?= DateTimeHumanizer::difference(new \DateTime(), new \DateTime("@$lastEdit"), $_SESSION['site_lang']) ?>
|
||
|
</span>
|
||
|
<?php endif; ?>
|
||
|
|
||
|
<span>
|
||
|
<a href="<?= base_url('blog/category/' . $categoryName) ?>">
|
||
|
<i class="far fa-folder-open"></i>
|
||
|
<?= lang('blog_category_' . $categoryName) != '' ? lang('blog_category_' . $categoryName) : $categoryDisplayName ?>
|
||
|
</a>
|
||
|
</span>
|
||
|
|
||
|
<span style="cursor:pointer" data-toggle="tooltip" data-placement="bottom" title="<?= lang('blog_approximate_reading_time') ?>">
|
||
|
<i class="far fa-clock"></i>
|
||
|
<?= $this->BlogModel->getReadingTime($postID) ?> min
|
||
|
</span>
|
||
|
|
||
|
<span>
|
||
|
<a rel="gotoid" href="#comments">
|
||
|
<i class="far fa-comment"></i>
|
||
|
<?= $commentCount ?>
|
||
|
</a>
|
||
|
</span>
|
||
|
|
||
|
<span>
|
||
|
<a href="#" style="cursor:pointer" onclick="likeDislike(<?= $postID ?>)">
|
||
|
<i class="far fa-heart"></i>
|
||
|
<span class="like-count"><?= $likeCount ?></span>
|
||
|
</a>
|
||
|
</span>
|
||
|
</div>
|
||
|
<h1 class="post-title"><?= $postTitle ?></h1>
|
||
|
<h2 class="post-subtitle"><?= $postDesc ?></h2>
|
||
|
</div>
|
||
|
</div>
|
||
|
<div class="blog-item">
|
||
|
<div class="blog-content">
|
||
|
<div class="blog-post">
|
||
|
<?= isset($postContent) ? $postContent : "" ?>
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
<div class="blog-item">
|
||
|
<div class="blog-content">
|
||
|
<div class="row">
|
||
|
<div class="col-sm-6">
|
||
|
<h3>
|
||
|
<i class="fa fa-tags"></i>
|
||
|
Tags
|
||
|
</h3>
|
||
|
<div class="tags">
|
||
|
<?php foreach ($tags as $tag) { ?>
|
||
|
<a href="<?= base_url('blog/tag/' . $tag['name']) ?>"><span
|
||
|
class="label label-primary"><?= $tag['display_name'] ?></span>
|
||
|
</a>
|
||
|
<?php } ?>
|
||
|
</div>
|
||
|
</div>
|
||
|
<div class="col-sm-6">
|
||
|
<h3>
|
||
|
<i class="far fa-user"></i> <?= lang('blog_about') ?>
|
||
|
</h3>
|
||
|
|
||
|
<?php
|
||
|
$this->load->view('network/user/user_overview_card', [
|
||
|
'noContainer' => true,
|
||
|
'username' => $postAuthorUsername,
|
||
|
'displayname' => $postAuthorDisplayname,
|
||
|
'profile_picture' => $postAuthorProfilePicture,
|
||
|
'header_image' => $postAuthorHeaderImage,
|
||
|
'about' => $postAuthorAbout])
|
||
|
?>
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
|
||
|
<div class="blog-item">
|
||
|
<div class="blog-content">
|
||
|
<div class="container">
|
||
|
<h3>
|
||
|
<i class="far fa-hand-point-right"></i> <?= lang('blog_articels'); ?></h3>
|
||
|
<div class="recommended-articles row">
|
||
|
<?php foreach ($randomPosts as $item) { ?>
|
||
|
<div class="col-sm-4">
|
||
|
<div class="card">
|
||
|
<?php if ($item['postImage'] != ''): ?>
|
||
|
<a href="<?= base_url('blog/post/' . $item['postUrl']) ?>">
|
||
|
<img src="<?= $item['postImage'] ?>?w=200" alt="<?= $item['postTitle'] ?>" class="card-img-top">
|
||
|
</a>
|
||
|
<?php endif; ?>
|
||
|
<div class="card-body">
|
||
|
<a href="<?= base_url('blog/post/' . $item['postUrl']) ?>">
|
||
|
<h5 class="card-title"><?= $item['postTitle'] ?></h5>
|
||
|
</a>
|
||
|
<small class="card-text">
|
||
|
<i class="far fa-user"></i>
|
||
|
<a href="<?= base_url('user/' . $item['postAuthorUsername']) ?>">
|
||
|
<?= $item['postAuthorDisplayname'] ?>
|
||
|
</a>
|
||
|
</small>
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
<?php } ?>
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
|
||
|
<div class="blog-item">
|
||
|
<div class="blog-content">
|
||
|
<div class="container">
|
||
|
<div id="comments">
|
||
|
<h3>
|
||
|
<i class="far fa-comments"></i> <?= lang('blog_comments') ?> (<span class="comment-count"><?= $commentCount; ?></span>)
|
||
|
</h3>
|
||
|
<ul class="comment-list" id="comment-list">
|
||
|
</ul>
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
|
||
|
<div class="blog-item">
|
||
|
<div class="blog-content">
|
||
|
<div id="comment-form">
|
||
|
<h3>
|
||
|
<i class="far fa-comment"></i>
|
||
|
<?= lang('blog_comment_new'); ?></h3>
|
||
|
<div id="notice-container"></div>
|
||
|
<?php if (!empty($_SESSION['user'])): ?>
|
||
|
<form class="form-horizontal" id="commentForm">
|
||
|
<div class="form-group">
|
||
|
<div class="col-sm-12">
|
||
|
<textarea rows="4" class="form-control" name="comment"
|
||
|
placeholder="<?= lang('blog_comment') ?>"
|
||
|
required id="commentField" wrap="soft"></textarea>
|
||
|
<input id="reply-id" name="reply-id" value="new" type="hidden">
|
||
|
</div>
|
||
|
</div>
|
||
|
<button type="submit"
|
||
|
class="btn btn-green btn-lg col-sm-12"
|
||
|
id="addComment"><?= lang('blog_comment_send'); ?></button>
|
||
|
</form>
|
||
|
<?php else: ?>
|
||
|
<h4><?= lang('blog_comment_required_login') ?></h4>
|
||
|
<a href="/login" class="btn btn-green btn-lg col-sm-12"><?= lang('login') ?></a>
|
||
|
<?php endif; ?>
|
||
|
</div>
|
||
|
<!--/#comment-form-->
|
||
|
</div>
|
||
|
<!--/#comments-->
|
||
|
</div>
|
||
|
<?php if (!empty($prevPost)):
|
||
|
$prevPost = $prevPost[0]; ?>
|
||
|
<div class="blog-item col-xs-6" style="width:calc(50% - 5px);">
|
||
|
<a href="<?= base_url('blog/post/' . $prevPost['postUrl']) ?>">
|
||
|
<div class="pull-left"
|
||
|
style="background: url(<?= $prevPost['postImage'] ?>?w=150) center;background-size:cover;width:100px;height:100px;border-radius: 4px;margin:10px 0;"></div>
|
||
|
<div class="float-right" style="width: calc(100% - 110px)">
|
||
|
<h5>
|
||
|
<i class="fa fa-arrow-left"></i> <?= lang('blog_previous_article') ?></h5>
|
||
|
<h4 style="font-size:20px"><?= $prevPost['postTitle'] ?></h4>
|
||
|
</div>
|
||
|
</a>
|
||
|
</div>
|
||
|
<?php endif; ?>
|
||
|
<?php if (!empty($nextPost)):
|
||
|
$nextPost = $nextPost[0]; ?>
|
||
|
<div class="blog-item col-xs-6 float-right" style="width:calc(50% - 5px);">
|
||
|
<a href="<?= base_url('blog/post/' . $nextPost['postUrl']) ?>">
|
||
|
<div class="float-right"
|
||
|
style="background: url(<?= $nextPost['postImage'] ?>?w=150) center;background-size:cover;width:100px;height:100px;border-radius: 4px;margin:10px 0;"></div>
|
||
|
<div class="pull-left" style="width: calc(100% - 110px);text-align:right;">
|
||
|
<h5><?= lang('blog_next_article') ?>
|
||
|
<i class="fa fa-arrow-right"></i>
|
||
|
</h5>
|
||
|
<h4 style="font-size:20px"><?= $nextPost['postTitle'] ?></h4>
|
||
|
</div>
|
||
|
</a>
|
||
|
</div>
|
||
|
<?php endif; ?>
|
||
|
<!--/.blog-item-->
|
||
|
<?php endif; ?>
|
||
|
</div>
|
||
|
</div>
|
||
|
<!--/.col-md-8-->
|
||
|
</div>
|
||
|
</section>
|
||
|
|
||
|
<!-- Login-Modal -->
|
||
|
<div class="modal fade" id="loginModal" tabindex="-1" role="dialog" aria-labelledby="meinModalLabel">
|
||
|
<div class="modal-dialog modal-dialog-centered" role="document">
|
||
|
<div class="modal-content">
|
||
|
<div class="modal-header">
|
||
|
<h4 class="modal-title" id="meinModalLabel">Du musst dafür angemeldet sein!</h4>
|
||
|
<button type="button" class="close" data-dismiss="modal" aria-label="Schließen">
|
||
|
<span aria-hidden="true">×</span>
|
||
|
</button>
|
||
|
</div>
|
||
|
<div class="modal-body">
|
||
|
<p>Um diese Aktion auszufühen, musst du dich mit deinem Account angemeldet haben.<br>
|
||
|
Solltest du noch kein Besitzer eines <?= lang('website_name') ?>-Accounts sein, kannst du
|
||
|
kostenfrei
|
||
|
einen solchen
|
||
|
erstellen.</p>
|
||
|
<p>
|
||
|
<a href="/faq#accounts" target="_blank">Was bringt mir ein Account?</a>
|
||
|
</p>
|
||
|
</div>
|
||
|
<div class="modal-footer">
|
||
|
<a href="/login" class="btn btn-primary">Anmelden</a>
|
||
|
<a href="/login/register" class="btn btn-green">Registrieren</a>
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|