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/blog/post.php

287 lines
13 KiB
PHP

<?php
defined('BASEPATH') OR exit('No direct script access allowed');
use Coduo\PHPHumanizer\DateTimeHumanizer;
?>
<div class="col-lg-8 order-lg-first">
<div class="like-toggle-icon-container floating">
<button class="like-toggle-icon <?= $hasLiked ? '-checked' : '' ?>" title="❤ Toggle Like!" onclick="likeDislike(<?= $ID ?>)"></button>
<span class="like-count"><?= $likeCount ?></span>
</div>
<div class="blog">
<div class="blog-item">
<?php // TODO: Add notice if post was deleted
if (false): ?>
<h2 class="text-error">
<i class="fa fa-warning"></i>
</h2>
<?php else: ?>
<?php if ($image != '') { ?>
<img class="img-fluid img-blog" src="<?= $image; ?>?w=800" width="100%" alt="" />
<?php } ?>
<div class="blog-content">
<div class="entry-meta">
<span>
<a href="<?= base_url('user/' . $author['username']) ?>">
<i class="far fa-user"></i>
<?= $author['displayname'] ?>
</a>
</span>
<?php
$initialRelease = strtotime($initialRelease);
if (isset($lastEdit)) {
$lastEdit = strtotime($lastEdit);
}
?>
<span style="cursor:pointer" data-toggle="tooltip" data-placement="bottom"
title="<?= strftime("%d. %B %Y", $initialRelease) ?>">
<i class="far fa-calendar"></i>
<?= DateTimeHumanizer::difference(new \DateTime(), new \DateTime("@$initialRelease"), $_SESSION['site_lang']) ?>
</span>
<?php if (isset($lastEdit) && $lastEdit !== 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 style="cursor:pointer" data-toggle="tooltip" data-placement="bottom" title="<?= lang('blog_approximate_reading_time') ?>">
<i class="far fa-clock"></i>
<?= $this->BlogModel->getReadingTime($wordCount) ?> 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(<?= $ID ?>)">
<i class="far fa-heart"></i>
<span class="like-count"><?= $likeCount ?></span>
</a>
</span>
</div>
<h1 class="post-title"><?= $title ?></h1>
<h2 class="post-subtitle"><?= $description ?></h2>
</div>
</div>
<div class="blog-item">
<div class="blog-content">
<div class="blog-post">
<?= isset($content) ? $content : "" ?>
</div>
</div>
</div>
<div class="row">
<div class="col-sm-6">
<div class="blog-item">
<div class="blog-content">
<h3>
<i class="far fa-folder-open"></i>
Kategorien
</h3>
<?php foreach ($categories as $category): ?>
<a href="<?= base_url('blog/category/' . $category['name']) ?>">
<span class="badge badge-primary">
<?= lang('blog_category_' . $category['name']) != '' ? lang('blog_category_' . $category['name']) : $category['displayname'] ?>
</span>
</a>
<?php endforeach; ?>
</div>
</div>
<div class="blog-item">
<div class="blog-content">
<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="badge badge-primary"><?= $tag['displayname'] ?></span>
</a>
<?php } ?>
</div>
</div>
</div>
</div>
<div class="col-sm-6">
<div class="blog-item">
<div class="blog-content">
<h3>
<i class="far fa-user"></i> <?= lang('blog_about') ?>
</h3>
<?php
$this->load->view('network/user/user_overview_card', [
'noContainer' => true,
'username' => $author['username'],
'displayname' => $author['displayname'],
'profilePicture' => $author['profilePicture'],
'headerImage' => $author['headerImage'],
'about' => $author['about']])
?>
</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['image'] != ''): ?>
<a href="<?= base_url('blog/post/' . $item['url']) ?>">
<img src="<?= $item['image'] ?>?w=200" alt="<?= $item['title'] ?>" class="card-img-top">
</a>
<?php endif; ?>
<div class="card-body">
<a href="<?= base_url('blog/post/' . $item['url']) ?>">
<h5 class="card-title"><?= $item['title'] ?></h5>
</a>
<small class="card-text">
<i class="far fa-user"></i>
<a href="<?= base_url('user/' . $item['author']['username']) ?>">
<?= $item['author']['displayname'] ?>
</a>
</small>
</div>
</div>
</div>
<?php } ?>
</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>
<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="row">
<?php if (!empty($prevPost)):
$prevPost = $prevPost[0]; ?>
<div class="col-6">
<div class="blog-item following-post left">
<a href="<?= base_url('blog/post/' . $prevPost['url']) ?>">
<div class="following-post-image"
style="background-image: url(<?= $prevPost['image'] ?>?w=150)"></div>
<div style="width: calc(100% - 110px);display: inline-block;margin:10px 0;">
<h5>
<i class="fa fa-arrow-left"></i> <?= lang('blog_previous_article') ?></h5>
<h4 style="font-size:20px"><?= $prevPost['title'] ?></h4>
</div>
</a>
</div>
</div>
<?php endif; ?>
<?php if (!empty($nextPost)):
$nextPost = $nextPost[0]; ?>
<div class="col-6">
<div class="blog-item following-post right">
<a href="<?= base_url('blog/post/' . $nextPost['url']) ?>">
<div class="following-post-image" style="background-image: url(<?= $nextPost['image'] ?>?w=150)"></div>
<div style="width: calc(100% - 110px);text-align:right;display: inline-block;margin:10px 0;">
<h5><?= lang('blog_next_article') ?>
<i class="fa fa-arrow-right"></i>
</h5>
<h4 style="font-size:20px"><?= $nextPost['title'] ?></h4>
</div>
</a>
</div>
</div>
<?php endif; ?>
</div>
<!--/.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">&times;</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>