path-refactoring + getter & setter

This commit is contained in:
NOrtmann1
2026-05-27 17:18:32 +02:00
parent 68d9224ea3
commit 8466a857c3
4 changed files with 38 additions and 8 deletions
+3 -3
View File
@@ -3,8 +3,8 @@
if (!isset($abs_path)) { if (!isset($abs_path)) {
require_once "../../path.php"; require_once "../../path.php";
} }
/*
require_once '/php/model/LocalArticleManager.php'; require_once $abs_path . '/php/model/LocalArticleManager.php';
try { try {
$articleManager = ArticleManager::getInstance(); $articleManager = ArticleManager::getInstance();
@@ -30,5 +30,5 @@ if ($_SERVER["REQUEST_METHOD"] === "POST") {
header("location: index.php"); header("location: index.php");
exit(); exit();
} }
*/
?> ?>
+31 -1
View File
@@ -13,6 +13,7 @@ class Article
private $author; private $author;
private $creationDate; private $creationDate;
private $category; private $category;
private $tags;
/** /**
* Konstruktor * Konstruktor
@@ -98,10 +99,39 @@ class Article
* Gibt das Veröffentlichungsdatum des Artikels zurück. * Gibt das Veröffentlichungsdatum des Artikels zurück.
* @return mixed * @return mixed
*/ */
public function getcreationDate() public function getCreationDate()
{ {
return $this->creationDate; return $this->creationDate;
} }
/**
* Gibt die Kategorie eines Artikels zurück.
* @return string
*/
public function getCategory()
{
return $this->category;
}
/**
* Gibt die Schlagworte eines Artikels zurück.
* @return string[]
*/
public function getTags()
{
return $this->tags;
}
/**
* Setzt die Schlagworte eines Artikels.
* @param string[] $tags
*/
public function setTags($tags)
{
$this->tags = $tags;
}
} }
?> ?>
+1 -1
View File
@@ -2,7 +2,7 @@
if (!isset($abs_path)) { if (!isset($abs_path)) {
require_once "path.php"; require_once "path.php";
} }
require_once '/php/model/LocalArticleManager.php'; require_once $abs_path . '/php/model/LocalArticleManager.php';
/** /**
* Die Klasse beinhaltet alle Methoden für die Operation mit den Artikel-Daten. * Die Klasse beinhaltet alle Methoden für die Operation mit den Artikel-Daten.
+3 -3
View File
@@ -1,8 +1,8 @@
<?php <?php
if (!isset($abs_path)) { if (!isset($abs_path)) {
require_once "path.php"; require_once 'path.php';
} }
require_once '/php/model/ArticleManagerDAO.php'; require_once $abs_path . '/php/model/ArticleManagerDAO.php';
/** /**
* Klasse: Eine lokale Lösung des ArticleManagerDAO. * Klasse: Eine lokale Lösung des ArticleManagerDAO.
* Schreibt zunächst Daten lokal in das Verzeichnis und kann diese wieder auslesen. * Schreibt zunächst Daten lokal in das Verzeichnis und kann diese wieder auslesen.
@@ -11,7 +11,7 @@ require_once '/php/model/ArticleManagerDAO.php';
*/ */
class LocalArticleManager implements ArticleManagerDAO { class LocalArticleManager implements ArticleManagerDAO {
private string $file = "data/articles.json"; private $file = '../../data/articles.json';
/** /**
* Gibt die LocalArticleManager-Instanz zurück. * Gibt die LocalArticleManager-Instanz zurück.