+ Es ist ein Fehler beim Speichern aufgetreten. Bitte versuche es erneut.
+
diff --git a/php/controller/profileArticles-controller.php b/php/controller/profileArticles-controller.php
index dd53dac..11e49d3 100644
--- a/php/controller/profileArticles-controller.php
+++ b/php/controller/profileArticles-controller.php
@@ -7,28 +7,15 @@ session_start();
require_once 'php/model/Article.php';
require_once 'php/model/ArticleManager.php';
-if (isset($_GET["id"])){
- try {
- $articleManager = ArticleManager::getInstance();
- $article = $articleManager->getArticle($_GET["id"]);
- if($article != null){
- $title = $article->getTitle();
- $content = $article->getContent();
- $category = $article->getCategory();
- $author = $article->getAuthor();
- $tags = $article->getTags();
- $creationDate = $article->getCreationDate();
- }else{
- $_SESSION["message"] = "article_not_found";
- echo "article_not_found";
- }
- } catch (Exception $e){
- $_SESSION["message"] = "internal_error";
- echo "Fehler aufgetreten: " . $e->getMessage();
+try {
+ $author = "max.mustermann"; // TODO: später Nutzer aus der Session beziehen.
+ $articleManager = ArticleManager::getInstance();
+ $userArticles = $articleManager->getArticlesByAuthor($author);
+ if(!isset($userArticles)) {
+ $_SESSION["message"] = "user_has_no_articles";
}
-}else{
- $_SESSION["message"] = "article_not_found";
- echo "article_not_found";
+} catch (Exception $e) {
+ $_SESSION["message"] = "internal_error";
}
?>
\ No newline at end of file
diff --git a/php/controller/showArticle-controller.php b/php/controller/showArticle-controller.php
index d9be3f5..ea27a0c 100644
--- a/php/controller/showArticle-controller.php
+++ b/php/controller/showArticle-controller.php
@@ -23,6 +23,5 @@ if (isset($_GET["id"])){
}
}else{
$_SESSION["message"] = "article_not_found";
- echo "article_not_found";
}
?>
\ No newline at end of file
diff --git a/php/model/ArticleManagerDAO.php b/php/model/ArticleManagerDAO.php
index 95b04cc..99b93f8 100644
--- a/php/model/ArticleManagerDAO.php
+++ b/php/model/ArticleManagerDAO.php
@@ -62,6 +62,12 @@ interface ArticleManagerDAO
*/
public function getAllArticles();
+ /**
+ * Gibt alle Beiträge eines Nutzer mit einer gegebenen ID aus.
+ * @param $author
+ * @return Article[]
+ */
+ public function getArticlesByAuthor($author);
}
?>
\ No newline at end of file