Merge pull request 'Anzeigenamen' (#51) from AnzeigeNamen into dev
Reviewed-on: #51
This commit was merged in pull request #51.
This commit is contained in:
@@ -45,8 +45,8 @@ include_once 'php/controller/showArticle-controller.php';
|
||||
</h1>
|
||||
|
||||
<div class="article-view-meta">
|
||||
<?php if (isset($author) && !empty($author)): ?>
|
||||
<span class="article-view-author">Von: <strong><?php echo htmlspecialchars($author); ?></strong></span>
|
||||
<?php if (isset($name) && !empty($name)): ?>
|
||||
<span class="article-view-author">Von: <strong><?php echo htmlspecialchars($name); ?></strong></span>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -58,7 +58,7 @@ $currentPage = isset($page) ? $page : 1;
|
||||
<div class="cat-view-item">
|
||||
<div class="cat-view-content">
|
||||
<h2 class="cat-view-item-title">
|
||||
<a href="#" class="cat-view-link">
|
||||
<a href="index.php?pfad=showArticle&id=<?php echo htmlspecialchars($article->getID()); ?>" class="cat-view-link">
|
||||
<?php echo (isset($article) && !empty($article->getTitle())) ? htmlspecialchars($article->getTitle()) : 'Kein Titel'; ?>
|
||||
</a>
|
||||
</h2>
|
||||
@@ -71,10 +71,7 @@ $currentPage = isset($page) ? $page : 1;
|
||||
❤️ <?php echo (isset($article) && !empty($article->getLikes())) ? htmlspecialchars($article->getLikes()) : '0'; ?>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<p style="margin: 0; color: #4a5568;">
|
||||
<?php echo (isset($article) && !empty($article->getContent())) ? htmlspecialchars($article->getContent()) : 'Kein Inhalt'; ?>
|
||||
</p>
|
||||
|
||||
</div>
|
||||
<div class="cat-view-arrow">→</div>
|
||||
</div>
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
if (session_status() === PHP_SESSION_NONE) {
|
||||
session_start();
|
||||
}
|
||||
require_once '../model/LocalArticleManager.php';
|
||||
require_once '../model/ArticleManager.php';
|
||||
require_once '../model/UserManager.php';
|
||||
require_once '../model/Article.php';
|
||||
require_once '../validator/search-validator.php';
|
||||
|
||||
@@ -18,6 +18,7 @@ if ($_SERVER["REQUEST_METHOD"] === "GET" && isset($_GET["q"])) {
|
||||
try {
|
||||
|
||||
$articleManager = ArticleManager::getInstance();
|
||||
$userManager = UserManager::getInstance();
|
||||
|
||||
$results = $articleManager->search($search);
|
||||
|
||||
@@ -52,7 +53,7 @@ if ($_SERVER["REQUEST_METHOD"] === "GET" && isset($_GET["q"])) {
|
||||
"id" => $obj->getId(),
|
||||
"title" => $obj->getTitle(),
|
||||
"content" => $obj->getContent(),
|
||||
"author" => $obj->getAuthor(),
|
||||
"author" => $userManager->findUser($obj->getAuthor())["vorname"] . " " . $userManager->findUser($obj->getAuthor())["nachname"],
|
||||
"category" => $obj->getCategory(),
|
||||
"tags" => $obj->getTags(),
|
||||
"creationDate" => $obj->getCreationDate(),
|
||||
|
||||
@@ -5,6 +5,7 @@ if (session_status() === PHP_SESSION_NONE) {
|
||||
|
||||
require_once 'php/model/Article.php';
|
||||
require_once 'php/model/ArticleManager.php';
|
||||
require_once 'php/model/UserManager.php';
|
||||
require_once 'php/model/CommentManager.php';
|
||||
|
||||
if (isset($_GET["id"]) && !empty($_GET["id"])){
|
||||
@@ -19,6 +20,9 @@ if (isset($_GET["id"]) && !empty($_GET["id"])){
|
||||
$author = $article->getAuthor();
|
||||
$tags = $article->getTags();
|
||||
$articleObj = $article; // Objekt für die Like-Abfagen sichern
|
||||
|
||||
$userManager = UserManager::getInstance();
|
||||
$name = $userManager->findUser($author)["vorname"]." ".$userManager->findUser($author)["nachname"];
|
||||
}else{
|
||||
//header("location: index.php?pfad=404");
|
||||
include_once "content/404.php";
|
||||
|
||||
@@ -5,6 +5,7 @@ if (session_status() === PHP_SESSION_NONE) {
|
||||
|
||||
require_once 'php/model/Article.php';
|
||||
require_once 'php/model/ArticleManager.php';
|
||||
require_once 'php/model/UserManager.php';
|
||||
require_once 'php/validator/article-validator.php';
|
||||
|
||||
if (isset($_GET["category"]) && !empty($_GET["category"]) && articleCategoryValidator($_GET["category"])){
|
||||
@@ -19,7 +20,11 @@ if (isset($_GET["category"]) && !empty($_GET["category"]) && articleCategoryVali
|
||||
|
||||
try {
|
||||
$articleManager = ArticleManager::getInstance();
|
||||
$userManager = UserManager::getInstance();
|
||||
$allArticles = $articleManager->getArticlesByCategory($category);
|
||||
foreach ($allArticles as $article) {
|
||||
$article->setAuthor($userManager->findUser($article->getAuthor())["vorname"] . " " . $userManager->findUser($article->getAuthor())["nachname"]);
|
||||
}
|
||||
$totalArticles = count($allArticles);
|
||||
|
||||
// --- SORTIERUNG LOGIK ---
|
||||
|
||||
@@ -97,6 +97,16 @@ class Article
|
||||
return $this->author;
|
||||
}
|
||||
|
||||
/**
|
||||
* Setzt einen neuen Autor eines Beitrages.
|
||||
* @param string $author
|
||||
* @return void
|
||||
*/
|
||||
public function setAuthor(string $author)
|
||||
{
|
||||
$this->author = $author;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gibt das Veröffentlichungsdatum des Beitrags zurück.
|
||||
* @return string
|
||||
|
||||
Reference in New Issue
Block a user