Beitrag erstellen #13
@@ -20,17 +20,7 @@ if ($_SERVER["REQUEST_METHOD"] === "POST") {
|
|||||||
$author = "max.mustermann"; // TODO: später aus Session den angemeldeten Nutzer beziehen.
|
$author = "max.mustermann"; // TODO: später aus Session den angemeldeten Nutzer beziehen.
|
||||||
$tags = $_POST["tags"];
|
$tags = $_POST["tags"];
|
||||||
|
|
||||||
//$articleManager->addArticle($title, $content, $author, $category, $tags);
|
$articleManager->addArticle($title, $content, $author, $category, $tags);
|
||||||
$articles[] = [
|
|
||||||
//"id" => count($articles)+1,
|
|
||||||
"title" => $title,
|
|
||||||
"content" => $content,
|
|
||||||
"author" => $author,
|
|
||||||
"category" => $category,
|
|
||||||
"tags" => $tags,
|
|
||||||
//"creationDate" => date("Y-m-d H:i:s")
|
|
||||||
];
|
|
||||||
$articleManager->saveArticle($articles);
|
|
||||||
|
|
||||||
foreach ($articleManager->getAllArticles() as $article) {
|
foreach ($articleManager->getAllArticles() as $article) {
|
||||||
echo htmlspecialchars($article['title'])."<br>";
|
echo htmlspecialchars($article['title'])."<br>";
|
||||||
|
|||||||
@@ -12,12 +12,12 @@ interface ArticleManagerDAO
|
|||||||
* @param $content string Inhalt des Beitrags
|
* @param $content string Inhalt des Beitrags
|
||||||
* @param $author string der Autor des des Beitrages NID
|
* @param $author string der Autor des des Beitrages NID
|
||||||
* @param $category string Kategorie des Beitrages
|
* @param $category string Kategorie des Beitrages
|
||||||
* @param $tags string[] optionale Schlagworte für eine bessere Suche
|
* @param $tags string optionale Schlagworte für eine bessere Suche
|
||||||
*
|
*
|
||||||
* Mögliche Exceptions:
|
* Mögliche Exceptions:
|
||||||
* TODO Fehlerbeschreibung hinzufügen & tags hinzufügen
|
* TODO Fehlerbeschreibung hinzufügen & tags hinzufügen
|
||||||
*/
|
*/
|
||||||
public function addArticle($title, $content, $author, $category, array $tags);
|
public function addArticle($title, $content, $author, $category, $tags);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Ein angemeldeter Nutzer bearbeitet einen Beitrag.
|
* Ein angemeldeter Nutzer bearbeitet einen Beitrag.
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ class LocalArticleManager implements ArticleManagerDAO {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function addArticle($title, $content, $author, $category, array $tags)
|
public function addArticle($title, $content, $author, $category, $tags)
|
||||||
{
|
{
|
||||||
$articles = $this->getAllArticles();
|
$articles = $this->getAllArticles();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user