Compare commits
108 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| a33f3b27fb | |||
| 71a8dd5f17 | |||
| e86fef1766 | |||
| 3cb63f791a | |||
| f96415bfe6 | |||
| 365f70af98 | |||
| c1ddbfdf48 | |||
| e575e3dfa8 | |||
| 560f53cfb6 | |||
| d8c350c20f | |||
| 5b718f24ed | |||
| 6634bee77b | |||
| 2a3e73d409 | |||
| 2cd68873de | |||
| d987ca271f | |||
| 0a37dd4b8b | |||
| b4ca25db3d | |||
| 738b36c406 | |||
| c785363384 | |||
| 32cb8a9d9e | |||
| 29e23a8d3b | |||
| 1a6403963a | |||
| e096774233 | |||
| 222759a1bc | |||
| 7a3043f644 | |||
| f1986bc3f7 | |||
| 75d2f17a3f | |||
| 317f4c0ce9 | |||
| 4a7bfa9567 | |||
| fec3cbb550 | |||
| 497ce5bdb4 | |||
| 53b593b380 | |||
| 2d03b1f051 | |||
| d3c190096a | |||
| 2998a7bf22 | |||
| 43bd452a30 | |||
| dfdcc99111 | |||
| ea409dae07 | |||
| 2810bfdce2 | |||
| ff23e6c9a2 | |||
| 88c369de32 | |||
| 52a34cd9b4 | |||
| 46eb99b534 | |||
| 0eba5f875a | |||
| b93692c160 | |||
| 00f9f9cd91 | |||
| 2c0d52a3d5 | |||
| 4a67932002 | |||
| 339e3025b8 | |||
| 4d88605192 | |||
| bd3d81e80c | |||
| 98683197e0 | |||
| 2ded6300ab | |||
| 79efee0979 | |||
| 9db31d4b8c | |||
| d7c7ef1041 | |||
| 483dd4182e | |||
| f63a2be01a | |||
| 838b13e39f | |||
| 7b4abe32a7 | |||
| 26889a8b59 | |||
| 60302e02b6 | |||
| 72023a6634 | |||
| dd1194a1c7 | |||
| d5fbfc950f | |||
| d4fa588c8f | |||
| 2a5ff14cb5 | |||
| df17478d72 | |||
| 38fba55798 | |||
| 5b3e7bf426 | |||
| cb07a4c80f | |||
| 85512e61a2 | |||
| 380736ce26 | |||
| 7f77297100 | |||
| e8693f282f | |||
| 8477462e07 | |||
| c28268faf3 | |||
| 24a759c61a | |||
| 0d0a7dba90 | |||
| 6de87c9e6c | |||
| 104f265e9b | |||
| f21d819c77 | |||
| ac1828b5f9 | |||
| 22bb2de043 | |||
| 664ad37181 | |||
| c2c98d12bc | |||
| cdc8b85f3c | |||
| c0d9949037 | |||
| 5dbe7a99b9 | |||
| 3ddd66dcbb | |||
| 8af0367edf | |||
| b95fc1adbe | |||
| 63f400995b | |||
| 8aa657ed99 | |||
| 627c72bb7f | |||
| a8a75d90ac | |||
| 0b1b704115 | |||
| 0babc42359 | |||
| 4a80d42dda | |||
| a2daded6b3 | |||
| d3169eba18 | |||
| 2d967c200c | |||
| 193e526e67 | |||
| f77643af44 | |||
| 9e900a3436 | |||
| 75988ffe71 | |||
| cb1f3f0d07 | |||
| 4d8017aa2b |
@@ -5,12 +5,12 @@ session_start();
|
||||
Seite: Beitrag erstellen
|
||||
Inhalt: Formular für die Erstellung eines neuen Beitrags
|
||||
-->
|
||||
<form method="post" action="php/controller/createArticle-controller.php" id="editor-form" class="article-editor-scope editor-container">
|
||||
<form method="post" action="php/controller/createArticle-controller.php" id="editor-form" class="article-editor-scope.editor-container article-editor-scope editor-container">
|
||||
|
||||
<main class="editor-main">
|
||||
<?php if (isset($_SESSION["message"]) && $_SESSION["message"] == "internal_error"): ?>
|
||||
<p class="alert-message is-error">
|
||||
Es ist ein Fehler beim Speichern aufgetreten. Bitte versuche es erneut.
|
||||
Es ist ein interner Fehler beim Speichern aufgetreten. Bitte versuche es erneut.
|
||||
</p>
|
||||
<?php endif; ?>
|
||||
<?php if (isset($_SESSION["message"]) && $_SESSION["message"] == "missing_parameters"): ?>
|
||||
@@ -18,6 +18,9 @@ session_start();
|
||||
Jeder Beitrag muss einen Titel, Kategorie und Inhalt besitzen.
|
||||
</p>
|
||||
<?php endif; ?>
|
||||
<?php
|
||||
unset($_SESSION["message"]);
|
||||
?>
|
||||
<input type="text" id="title" name="title" placeholder="Titel hier eingeben" required>
|
||||
<textarea id="content" name="content" placeholder="Schreibe deinen Beitrag..."></textarea>
|
||||
</main>
|
||||
|
||||
@@ -10,10 +10,10 @@
|
||||
<meta name="description" content="EduForge">
|
||||
<meta name="author" content="Niklas Ortmann">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<link rel="icon" type="image/x-icon" href="images/logos/logo_icon.ico">
|
||||
<link rel="stylesheet" href="css/main.css">
|
||||
<link rel="stylesheet" href="css/navbar.css">
|
||||
<link rel="stylesheet" href="css/footer.css">
|
||||
<link rel="icon" type="image/x-icon" href="../images/logos/logo_icon.ico">
|
||||
<link rel="stylesheet" href="../css/main.css">
|
||||
<link rel="stylesheet" href="../css/navbar.css">
|
||||
<link rel="stylesheet" href="../css/footer.css">
|
||||
<title>EduForge</title>
|
||||
</head>
|
||||
|
||||
+81
-32
@@ -2,45 +2,94 @@
|
||||
Content: Profil
|
||||
Inhalt: Das eigene Profil, wenn man angemeldet ist. Dort hat man die Möglichkeit seine Angaben zu ändern.
|
||||
-->
|
||||
|
||||
<?php
|
||||
include_once 'php/controller/profileArticles-controller.php';
|
||||
?>
|
||||
<main class="form-page">
|
||||
<div class="flexbox">
|
||||
<!-- Linke Spalte: Profildaten -->
|
||||
<div class="container">
|
||||
<form>
|
||||
<label class="input-label">Vorname</label>
|
||||
<input type="text" name="Vorname" class="login-input" required
|
||||
placeholder="Vorname"
|
||||
value="<?php //DB-Daten ?>">
|
||||
|
||||
<div class="form-container">
|
||||
<form>
|
||||
<label class="input-label">Nachname</label>
|
||||
<input type="text" name="Nachname" class="login-input" required
|
||||
placeholder="Nachname"
|
||||
value="<?php //DB-Daten ?>">
|
||||
|
||||
<label class="input-label">Vorname</label>
|
||||
<label class="input-label">Email-Adresse</label>
|
||||
<input type="email" name="Email" class="login-input" required
|
||||
placeholder="mustermann@web.de"
|
||||
value="<?php //DB-Daten ?>">
|
||||
|
||||
<input type="text" name="Vorname" class="login-input" required
|
||||
placeholder="Vorname"
|
||||
value="<?php //DB-Daten ?>">
|
||||
<label class="input-label">Passwort</label>
|
||||
<input type="password" name="Passwort" class="login-input"
|
||||
required placeholder="Passwort">
|
||||
|
||||
<label class="input-label">Nachname</label>
|
||||
<input type="text" name="Nachname" class="login-input" required
|
||||
placeholder="Nachname"
|
||||
value="<?php //DB-Daten ?>">
|
||||
<button type="submit" class="login-button">
|
||||
Speichern
|
||||
</button>
|
||||
|
||||
<label class="input-label">Email-Adresse</label>
|
||||
<input type="email" name="Email" class="login-input" required
|
||||
placeholder="mustermann@web.de"
|
||||
value="<?php //DB-Daten ?>">
|
||||
<button type="button" class="login-button delete-account-button">
|
||||
Account löschen
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<label class="input-label">Passwort</label>
|
||||
<input type="password" name="Passwort" class="login-input"
|
||||
required placeholder="Passwort">
|
||||
|
||||
<br>
|
||||
|
||||
<button type="submit" class="login-button">
|
||||
Speichern
|
||||
</button>
|
||||
|
||||
<br><br>
|
||||
|
||||
<button type="button" class="login-button">
|
||||
Account löschen
|
||||
</button>
|
||||
|
||||
</form>
|
||||
<!-- Rechte Spalte: Eigene Beiträge -->
|
||||
<div class="container">
|
||||
<h2 class="section-title">Meine Beiträge</h2>
|
||||
<div class="articles-list">
|
||||
<?php if (isset($_SESSION["message"]) && $_SESSION["message"] == "internal_error"): ?>
|
||||
<p class="alert-message is-error">
|
||||
Es ist ein interner Fehler aufgetreten. Bitte versuche es erneut.
|
||||
</p>
|
||||
<?php elseif (isset($userArticles) && count($userArticles) > 0): ?>
|
||||
<?php foreach ($userArticles as $userArticle): ?>
|
||||
<!-- Ein einzelner Artikel-Eintrag -->
|
||||
<div class="article-item">
|
||||
<div class="article-meta">
|
||||
<span class="article-date"><?php echo htmlspecialchars($userArticle->getCreationDate()); ?></span>
|
||||
<span class="article-category"><?php echo htmlspecialchars($userArticle->getCategory()); ?></span>
|
||||
</div>
|
||||
<h3 class="article-title"><?php echo htmlspecialchars($userArticle->getTitle()); ?></h3>
|
||||
<?php
|
||||
$tags = $userArticle->getTags();
|
||||
if (isset($tags) && !empty($tags)): ?>
|
||||
<div class="article-view-bottom-section">
|
||||
<div class="article-view-tags-label">Tags:</div>
|
||||
<div class="article-view-tags-list">
|
||||
<?php
|
||||
$tagArray = is_array($tags) ? $tags : explode(',', $tags);
|
||||
foreach ($tagArray as $tag):
|
||||
$trimmedTag = trim($tag);
|
||||
if (!empty($trimmedTag)):
|
||||
?>
|
||||
<span class="article-view-tag-item"><?php echo htmlspecialchars($trimmedTag); ?></span>
|
||||
<?php
|
||||
endif;
|
||||
endforeach;
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<a href="index.php?pfad=updateArticle&id=<?php echo $userArticle->getID(); ?>" class="edit-link-button">Bearbeiten</a>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
<?php else: ?>
|
||||
<p>Du hast noch keine Beiträge erstellt.</p>
|
||||
<button type="button" class="login-button" onclick="window.location.href='index.php?pfad=createArticle';">
|
||||
Beitrag erstellen!
|
||||
</button>
|
||||
<?php endif; ?>
|
||||
<?php
|
||||
unset($_SESSION["message"]);
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</main>
|
||||
@@ -0,0 +1,125 @@
|
||||
<?php
|
||||
session_start();
|
||||
?>
|
||||
<!--
|
||||
Seite: Suchergebnisse
|
||||
Inhalt: Zeigt die Ergebnisse einer Suche an
|
||||
-->
|
||||
<div class="s-res-layout-grid">
|
||||
|
||||
<!-- Links: Seitenleiste für Filter und Suche -->
|
||||
<aside class="s-res-sidebar">
|
||||
|
||||
<!-- Suchleiste Box -->
|
||||
<div class="s-res-sidebar-box">
|
||||
<h3 class="s-res-sidebar-title">Suche anpassen</h3>
|
||||
<form action="#" method="GET" class="s-res-search-form">
|
||||
<input type="search" id="site-search" name="q" placeholder="Suchen..." class="nav__search">
|
||||
<button type="submit" class="nav__search-button">Suchen</button>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<!-- Sortierfuntion Box -->
|
||||
<div class="s-res-sidebar-box">
|
||||
<h3 class="s-res-sidebar-title">Sortierung</h3>
|
||||
<div class="s-res-filter-group">
|
||||
<label class="s-res-filter-option">
|
||||
<input type="radio" name="sort" value="alphabet" checked>
|
||||
<span>Alphabetisch</span>
|
||||
</label>
|
||||
<label class="s-res-filter-option">
|
||||
<input type="radio" name="sort" value="likes">
|
||||
<span>Beliebtheit (Likes)</span>
|
||||
</label>
|
||||
<label class="s-res-filter-option">
|
||||
<input type="radio" name="sort" value="newest">
|
||||
<span>Neueste Beiträge</span>
|
||||
</label>
|
||||
<label class="s-res-filter-option">
|
||||
<input type="radio" name="sort" value="oldest">
|
||||
<span>Älteste Beiträge</span>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</aside>
|
||||
|
||||
<main class="s-res-main-content">
|
||||
|
||||
<div class="s-res-header">
|
||||
<h1 class="s-res-main-title">Suchergebnisse</h1>
|
||||
<p class="s-res-meta">3 Treffer für Ihre Suchanfrage</p>
|
||||
</div>
|
||||
|
||||
<!-- Ergebnisliste -->
|
||||
<div class="s-res-list">
|
||||
|
||||
<?php
|
||||
if(isset($_SESSION['message']) && $_SESSION['message'] == "new_search_results"): ?>
|
||||
<!-- TODO: Hier die Beiträge ausgeben. -->
|
||||
<?php elseif (isset($_SESSION["message"]) && $_SESSION["message"] == "missing_parameters"): ?>
|
||||
<p>
|
||||
Bitte überprüfe deine Sucheingabe und versuche es erneut!
|
||||
</p>
|
||||
<?php endif; ?>
|
||||
<?php
|
||||
unset($_SESSION["message"]);
|
||||
?>
|
||||
|
||||
<!-- Beispielbeitrag -->
|
||||
<div class="s-res-item">
|
||||
<div class="s-res-content">
|
||||
<h2 class="s-res-item-title">
|
||||
<a href="#" class="s-res-link">Pythagoras</a>
|
||||
</h2>
|
||||
<p class="s-res-author">Von: <span class="s-res-author-name">Max Mustermann</span></p>
|
||||
</div>
|
||||
<div class="s-res-arrow">→</div>
|
||||
</div>
|
||||
|
||||
<!-- Beispielbeitrag -->
|
||||
<div class="s-res-item">
|
||||
<div class="s-res-content">
|
||||
<h2 class="s-res-item-title">
|
||||
<a href="#" class="s-res-link">Pythagoras</a>
|
||||
</h2>
|
||||
<p class="s-res-author">Von: <span class="s-res-author-name">Max Mustermann</span></p>
|
||||
</div>
|
||||
<div class="s-res-arrow">→</div>
|
||||
</div>
|
||||
|
||||
<!-- Beispielbeitrag -->
|
||||
<div class="s-res-item">
|
||||
<div class="s-res-content">
|
||||
<h2 class="s-res-item-title">
|
||||
<a href="#" class="s-res-link">Pythagoras</a>
|
||||
</h2>
|
||||
<p class="s-res-author">Von: <span class="s-res-author-name">Max Mustermann</span></p>
|
||||
</div>
|
||||
<div class="s-res-arrow">→</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="s-res-pagination-footer">
|
||||
|
||||
<!-- Auswahl der Ergebnisse pro Seite -->
|
||||
<div class="s-res-limit-selector">
|
||||
<label for="s-res-per-page" class="s-res-limit-label">Ergebnisse pro Seite:</label>
|
||||
<select id="s-res-per-page" name="limit" class="s-res-limit-select">
|
||||
<option value="10" selected>10</option>
|
||||
<option value="20">20</option>
|
||||
<option value="50">50</option>
|
||||
<option value="100">100</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="s-res-page-navigation">
|
||||
<button type="button" class="s-res-page-btn" disabled>«</button>
|
||||
<button type="button" class="s-res-page-btn s-res-page-btn-active">1</button>
|
||||
<button type="button" class="s-res-page-btn">»</button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</main>
|
||||
|
||||
</div>
|
||||
+27
-3
@@ -9,13 +9,37 @@ include_once 'php/controller/showArticle-controller.php';
|
||||
|
||||
<!-- Hauptcontainer für die Beitragsansicht (Ausschließlich der Content-Bereich) -->
|
||||
<main class="article-view-container">
|
||||
<?php if (isset($_SESSION["message"]) && $_SESSION["message"] == "internal_error"): ?>
|
||||
<p class="alert-message is-error">
|
||||
Es ist ein interner Fehler aufgetreten. Bitte versuche es erneut.
|
||||
</p>
|
||||
<?php endif; ?>
|
||||
<?php if (isset($_SESSION["message"]) && $_SESSION["message"] == "missing_id"): ?>
|
||||
<p class="alert-message is-error">
|
||||
Es ist ein Fehler aufgetreten. Die ID konnte nicht ausgelesen werden. Bitte versuche es erneut.
|
||||
</p>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if (isset($_SESSION["message"]) && $_SESSION["message"] == "missing_parameters"): ?>
|
||||
<p class="alert-message is-error">
|
||||
Jeder Beitrag muss einen Titel, Kategorie und Inhalt besitzen.
|
||||
</p>
|
||||
<?php endif; ?>
|
||||
<?php if (isset($_SESSION["message"]) && $_SESSION["message"] == "article_updated"): ?>
|
||||
<p class="alert-message is-success">
|
||||
Dein Beitrag wurde erfolgreich bearbeitet!
|
||||
</p>
|
||||
<?php endif; ?>
|
||||
<?php
|
||||
unset($_SESSION["message"]);
|
||||
?>
|
||||
|
||||
<!-- Metadaten & Titel -->
|
||||
<div class="article-view-top-section">
|
||||
|
||||
<?php if (isset($category) && !empty($category)): ?>
|
||||
<span class="article-view-category"><?php echo htmlspecialchars($category); ?></span>
|
||||
<?php endif; ?>
|
||||
|
||||
<h1 class="article-view-title">
|
||||
<?php if (isset($title)) { echo htmlspecialchars($title); } ?>
|
||||
</h1>
|
||||
@@ -28,7 +52,7 @@ include_once 'php/controller/showArticle-controller.php';
|
||||
|
||||
</div>
|
||||
|
||||
<!-- articleikel-Inhalt -->
|
||||
<!-- Beitrags-Inhalt -->
|
||||
<div class="article-view-content">
|
||||
<?php if (isset($content)): ?>
|
||||
<!-- nl2br für Zeilenumbrüche -->
|
||||
@@ -36,7 +60,7 @@ include_once 'php/controller/showArticle-controller.php';
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
||||
<!-- articleikel-Endbereich (Tags) -->
|
||||
<!-- Beitrags-Endbereich (Tags) -->
|
||||
<?php if (isset($tags) && !empty($tags)): ?>
|
||||
<div class="article-view-bottom-section">
|
||||
<div class="article-view-tags-label">Tags:</div>
|
||||
|
||||
@@ -0,0 +1,94 @@
|
||||
<?php
|
||||
include_once 'php/controller/showArticle-controller.php';
|
||||
?>
|
||||
<!--
|
||||
Seite: Beitrag erstellen
|
||||
Inhalt: Formular für die Erstellung eines neuen Beitrags
|
||||
-->
|
||||
<form method="post" action="php/controller/updateArticle-controller.php?id=<?php if(isset($id) && !empty($id)){echo htmlspecialchars($id);}else{$_SESSION["message"] = "missing_id";} ?>" id="editor-form" class="article-editor-scope.editor-container article-editor-scope editor-container">
|
||||
|
||||
<main class="editor-main">
|
||||
<?php if (isset($_SESSION["message"]) && $_SESSION["message"] == "internal_error"): ?>
|
||||
<p class="alert-message is-error">
|
||||
Es ist ein interner Fehler beim Speichern aufgetreten. Bitte versuche es erneut.
|
||||
</p>
|
||||
<?php endif; ?>
|
||||
<?php if (isset($_SESSION["message"]) && $_SESSION["message"] == "missing_id"): ?>
|
||||
<p class="alert-message is-error">
|
||||
Es ist ein Fehler aufgetreten. Die ID konnte nicht ausgelesen werden. Bitte versuche es erneut.
|
||||
</p>
|
||||
<?php endif; ?>
|
||||
<?php if (isset($_SESSION["message"]) && $_SESSION["message"] == "missing_parameters"): ?>
|
||||
<p class="alert-message is-error">
|
||||
Jeder Beitrag muss einen Titel, Kategorie und Inhalt besitzen.
|
||||
</p>
|
||||
<?php endif; ?>
|
||||
<?php
|
||||
unset($_SESSION["message"]);
|
||||
?>
|
||||
<input type="text" id="title" name="title" value="<?php if (isset($title) && !empty($title)){echo htmlspecialchars($title);} ?>" placeholder="Titel hier eingeben" required>
|
||||
<textarea id="content" name="content" placeholder="Schreibe deinen Beitrag...">
|
||||
<?php if (isset($content) && !empty($content)){echo htmlspecialchars($content);} ?>
|
||||
</textarea>
|
||||
</main>
|
||||
|
||||
<!-- Seitenleiste -->
|
||||
<aside class="editor-sidebar">
|
||||
|
||||
<div class="sidebar-block">
|
||||
<button type="submit" class="btn-publish">Änderungen speichern</button>
|
||||
</div>
|
||||
|
||||
<div class="sidebar-block">
|
||||
<label for="category">Kategorie <span class="required">*</span></label>
|
||||
<select id="category" name="category" required>
|
||||
<option disabled selected>Kategorie wählen...</option>
|
||||
|
||||
<optgroup label="Sprachen">
|
||||
<option value="deutsch">Deutsch</option>
|
||||
<option value="englisch">Englisch</option>
|
||||
<option value="franzoesisch">Französisch</option>
|
||||
<option value="latein">Latein</option>
|
||||
<option value="literatur">Literatur</option>
|
||||
</optgroup>
|
||||
|
||||
<optgroup label="MINT">
|
||||
<option value="mathe">Mathematik</option>
|
||||
<option value="biologie">Biologie</option>
|
||||
<option value="chemie">Chemie</option>
|
||||
<option value="physik">Physik</option>
|
||||
<option value="informatik">Informatik</option>
|
||||
<option value="astronomie">Astronomie</option>
|
||||
</optgroup>
|
||||
|
||||
<optgroup label="Gesellschaft & Werte">
|
||||
<option value="geschichte">Geschichte</option>
|
||||
<option value="erdkunde">Erdkunde</option>
|
||||
<option value="sozialkunde">Sozialkunde</option>
|
||||
<option value="wirtschaft">Wirtschaftskunde</option>
|
||||
<option value="religion">Religion</option>
|
||||
<option value="ethik">Ethikunterricht</option>
|
||||
<option value="philosophie">Philosophie</option>
|
||||
<option value="psychologie">Psychologie</option>
|
||||
<option value="kunst">Kunst</option>
|
||||
<option value="musik">Musik</option>
|
||||
<option value="theater">Theater</option>
|
||||
</optgroup>
|
||||
|
||||
<optgroup label="Technik & Praxis">
|
||||
<option value="technik">Technik</option>
|
||||
<option value="werken">Werken</option>
|
||||
<option value="hauswirtschaft">Hauswirtschaft</option>
|
||||
<option value="sport">Sport</option>
|
||||
</optgroup>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="sidebar-block">
|
||||
<label for="tags">Schlagwörter</label>
|
||||
<input type="text" id="tags" name="tags" value="<?php if (isset($tags) && !empty($tags)){echo htmlspecialchars($tags);} ?>" placeholder="z.B. Technik, IT (mit Komma trennen)">
|
||||
</div>
|
||||
|
||||
</aside>
|
||||
|
||||
</form>
|
||||
@@ -6,6 +6,10 @@
|
||||
color: #1e1e1e;
|
||||
background-color: #f0f2f5;
|
||||
box-sizing: border-box;
|
||||
|
||||
max-width: 1200px;
|
||||
margin: 0 auto; /* Zentriert den gesamten Container horizontal */
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.article-editor-scope * {
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
/* Footer‑Grundlayout */
|
||||
footer {
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
width: 100%;
|
||||
background: #333d43;
|
||||
text-align: center;
|
||||
|
||||
+20
-1
@@ -3,12 +3,19 @@ main {
|
||||
max-width:1200px;
|
||||
margin: 0 auto;
|
||||
padding: 20px;
|
||||
|
||||
width: 100%;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
body {
|
||||
background-color: #eef2f7;
|
||||
color: #1f2937;
|
||||
margin: 0;
|
||||
|
||||
min-height: 100vh;
|
||||
display: grid;
|
||||
grid-template-rows: auto 1fr auto; /* Header(auto), Inhalt (bekommt Rest), Footer(auto) */
|
||||
}
|
||||
|
||||
a, button, input, select, textarea, label, main{
|
||||
@@ -17,7 +24,8 @@ a, button, input, select, textarea, label, main{
|
||||
|
||||
.flexbox {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
flex-direction: row;
|
||||
flex-wrap: wrap;
|
||||
gap: 20px;
|
||||
margin-top: 30px;
|
||||
}
|
||||
@@ -29,6 +37,7 @@ a, button, input, select, textarea, label, main{
|
||||
border: 1px solid #dbe3ec;
|
||||
box-shadow: 0 4px 12px rgba(0,0,0,0.08);
|
||||
transition: transform 0.2s, box-shadow 0.2s;
|
||||
flex: 1 1 300px;
|
||||
}
|
||||
|
||||
.container:hover {
|
||||
@@ -203,3 +212,13 @@ a, button, input, select, textarea, label, main{
|
||||
border-radius: 10px;
|
||||
box-shadow: 0 6px 20px rgba(0,0,0,0.1);
|
||||
}
|
||||
|
||||
.form-container {
|
||||
flex: 1 1 450px;
|
||||
padding: 30px;
|
||||
background-color: white;
|
||||
border: 1px solid #dbe3ec;
|
||||
border-radius: 10px;
|
||||
box-shadow: 0 6px 20px rgba(0,0,0,0.1);
|
||||
box-sizing: border-box;
|
||||
}
|
||||
@@ -79,6 +79,8 @@ CSS für die navbar
|
||||
text-decoration: none;
|
||||
font-weight: 600;
|
||||
margin-left: 0.5rem;
|
||||
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.nav__search {
|
||||
@@ -205,6 +207,10 @@ CSS für die navbar
|
||||
margin-left: 4px;
|
||||
}
|
||||
|
||||
.nav__search-button:hover {
|
||||
background-color: #f8f9fa;
|
||||
}
|
||||
|
||||
/* restliche desktop-navbar aus */
|
||||
.nav__center,
|
||||
.nav__right .nav__button,
|
||||
@@ -227,6 +233,9 @@ CSS für die navbar
|
||||
padding: 2rem 1rem;
|
||||
box-shadow: 2px 0 10px rgba(0,0,0,0.5);
|
||||
overflow-y: auto;
|
||||
|
||||
/* Genug Abstand oben rechts, damit Links nicht hinter dem X liegen */
|
||||
padding: 4rem 1.5rem 2rem 1.5rem;
|
||||
}
|
||||
|
||||
.nav__checkbox:checked ~ .nav__mobile-menu {
|
||||
@@ -237,6 +246,18 @@ CSS für die navbar
|
||||
left: 0;
|
||||
}
|
||||
|
||||
.nav__close-btn {
|
||||
position: absolute;
|
||||
top: 1rem;
|
||||
right: 1.5rem;
|
||||
font-size: 2rem;
|
||||
color: #fff;
|
||||
cursor: pointer;
|
||||
line-height: 1;
|
||||
user-select: none;
|
||||
transition: color 0.2s ease, transform 0.2s ease;
|
||||
}
|
||||
|
||||
.nav__mobile-menu a {
|
||||
color: #fff;
|
||||
text-decoration: none;
|
||||
|
||||
@@ -0,0 +1,89 @@
|
||||
/*
|
||||
CSS für die Profilseite
|
||||
*/
|
||||
|
||||
/* Roter Button für Account löschen */
|
||||
.delete-account-button {
|
||||
background-color: #dc2626;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.delete-account-button:hover {
|
||||
background-color: #b91c1c;
|
||||
}
|
||||
|
||||
/* Beitragsliste Styling */
|
||||
.section-title {
|
||||
margin-top: 0;
|
||||
margin-bottom: 25px;
|
||||
font-size: 1.5rem;
|
||||
color: #1f2937;
|
||||
border-bottom: 2px solid #eef2f7;
|
||||
padding-bottom: 10px;
|
||||
}
|
||||
|
||||
.articles-list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 20px;
|
||||
}
|
||||
|
||||
.article-item {
|
||||
padding: 15px;
|
||||
border: 1px solid #e5e7eb;
|
||||
border-radius: 8px;
|
||||
background-color: #f9fafb;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.article-meta {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
font-size: 0.85rem;
|
||||
color: #6b7280;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
.article-category {
|
||||
font-weight: bold;
|
||||
color: #2563eb;
|
||||
}
|
||||
|
||||
.article-title {
|
||||
margin: 0 0 10px 0;
|
||||
font-size: 1.2rem;
|
||||
color: #1f2937;
|
||||
}
|
||||
|
||||
.article-tags {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 6px;
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
|
||||
.tag {
|
||||
font-size: 0.75rem;
|
||||
background-color: #e5e7eb;
|
||||
color: #374151;
|
||||
padding: 3px 8px;
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
/* Bearbeiten-Button als Link deklariert */
|
||||
.edit-link-button {
|
||||
display: inline-block;
|
||||
text-decoration: none;
|
||||
font-size: 0.9rem;
|
||||
font-weight: bold;
|
||||
color: #2563eb;
|
||||
border: 1px solid #2563eb;
|
||||
padding: 6px 12px;
|
||||
border-radius: 6px;
|
||||
transition: background-color 0.2s, color 0.2s;
|
||||
}
|
||||
|
||||
.edit-link-button:hover {
|
||||
background-color: #2563eb;
|
||||
color: white;
|
||||
}
|
||||
@@ -0,0 +1,263 @@
|
||||
/*
|
||||
CSS für die Suchergebnis-Seite
|
||||
*/
|
||||
/* Container und Layout-Schutz vor globalen Styles */
|
||||
.s-res-layout-grid {
|
||||
box-sizing: border-box;
|
||||
max-width: 95%; /* Nutzt jetzt 95% der Bildschirmbreite statt starrer Pixel */
|
||||
width: 95%; /* Erhöht das Limit für extrem große Monitore von 1200px auf 1600px */
|
||||
margin: 2rem auto;
|
||||
padding: 0 1rem;
|
||||
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
|
||||
color: #212529;
|
||||
line-height: 1.5;
|
||||
|
||||
/* Grid für die Zweispaltigkeit */
|
||||
display: grid;
|
||||
grid-template-columns: 320px 1fr; /* Seitenleiste leicht verbreitert, Inhalt nimmt den gesamten Rest ein */
|
||||
gap: 2.5rem; /* Etwas mehr Abstand zwischen Seitenleiste und Inhalt für das breitere Layout */
|
||||
}
|
||||
|
||||
.s-res-layout-grid * {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
/* --- SEITENLEISTE (FILTER & SUCHE) --- */
|
||||
.s-res-sidebar {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 1.5rem;
|
||||
}
|
||||
|
||||
.s-res-sidebar-box {
|
||||
background-color: #ffffff;
|
||||
border: 1px solid #e2e8f0;
|
||||
border-radius: 8px;
|
||||
padding: 1.25rem;
|
||||
}
|
||||
|
||||
.s-res-sidebar-title {
|
||||
font-size: 1rem;
|
||||
font-weight: 700;
|
||||
color: #1a202c;
|
||||
margin: 0 0 1rem 0;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.05em;
|
||||
}
|
||||
|
||||
/* Formular & deine Suchleisten-Klassen */
|
||||
.s-res-search-form {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
/* Filter Radio-Buttons */
|
||||
.s-res-filter-group {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.75rem;
|
||||
}
|
||||
|
||||
.s-res-filter-option {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.5rem;
|
||||
cursor: pointer;
|
||||
font-size: 0.95rem;
|
||||
color: #4a5568;
|
||||
}
|
||||
|
||||
.s-res-filter-option input[type="radio"] {
|
||||
margin: 0;
|
||||
accent-color: #3182ce;
|
||||
}
|
||||
|
||||
/* --- HAUPTINHALT (ERGEBNISSE) --- */
|
||||
.s-res-main-content {
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.s-res-header {
|
||||
margin-bottom: 2rem;
|
||||
border-bottom: 2px solid #dee2e6;
|
||||
padding-bottom: 1rem;
|
||||
}
|
||||
|
||||
.s-res-main-title {
|
||||
font-size: 2rem;
|
||||
color: #1a202c;
|
||||
margin: 0 0 0.5rem 0;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.s-res-meta {
|
||||
color: #6c757d;
|
||||
font-size: 0.95rem;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.s-res-list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 1rem;
|
||||
}
|
||||
|
||||
/* Einzelner Beitrag */
|
||||
.s-res-item {
|
||||
background-color: #ffffff;
|
||||
border: 1px solid #e2e8f0;
|
||||
border-radius: 8px;
|
||||
padding: 1.25rem;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
|
||||
}
|
||||
|
||||
.s-res-item:hover {
|
||||
transform: translateY(-2px);
|
||||
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
|
||||
border-color: #cbd5e1;
|
||||
}
|
||||
|
||||
.s-res-content {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.s-res-item-title {
|
||||
font-size: 1.25rem;
|
||||
margin: 0 0 0.25rem 0;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.s-res-link {
|
||||
color: #3182ce;
|
||||
text-decoration: none;
|
||||
transition: color 0.2s ease;
|
||||
}
|
||||
|
||||
.s-res-link:hover {
|
||||
text-decoration: underline;
|
||||
color: #2b6cb0;
|
||||
}
|
||||
|
||||
.s-res-author {
|
||||
font-size: 0.875rem;
|
||||
color: #4a5568;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.s-res-author-name {
|
||||
font-weight: 600;
|
||||
color: #2d3748;
|
||||
}
|
||||
|
||||
.s-res-arrow {
|
||||
font-size: 1.5rem;
|
||||
color: #a0aec0;
|
||||
padding-left: 1rem;
|
||||
transition: color 0.2s ease, transform 0.2s ease;
|
||||
}
|
||||
|
||||
.s-res-item:hover .s-res-arrow {
|
||||
color: #3182ce;
|
||||
transform: translateX(3px);
|
||||
}
|
||||
|
||||
/* ERGEBNISSE PRO SEITE & PAGINIERUNG */
|
||||
.s-res-pagination-footer {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-top: 2rem;
|
||||
padding-top: 1.5rem;
|
||||
border-top: 1px solid #e2e8f0;
|
||||
}
|
||||
|
||||
/* Dropdown-Auswahl */
|
||||
.s-res-limit-selector {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.5rem;
|
||||
}
|
||||
|
||||
.s-res-limit-label {
|
||||
font-size: 0.9rem;
|
||||
color: #4a5568;
|
||||
}
|
||||
|
||||
.s-res-limit-select {
|
||||
padding: 0.35rem 1.5rem 0.35rem 0.5rem;
|
||||
font-size: 0.9rem;
|
||||
color: #2d3748;
|
||||
background-color: #ffffff;
|
||||
border: 1px solid #cbd5e1;
|
||||
border-radius: 4px;
|
||||
cursor: pointer;
|
||||
outline: none;
|
||||
transition: border-color 0.2s;
|
||||
|
||||
/* Diskreter nativer Pfeil-Style */
|
||||
appearance: none;
|
||||
background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://w3.org' viewBox='0 0 24 24' fill='none' stroke='%234a5568' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
|
||||
background-repeat: no-repeat;
|
||||
background-position: right 0.4rem center;
|
||||
background-size: 1em;
|
||||
}
|
||||
|
||||
.s-res-limit-select:focus {
|
||||
border-color: #3182ce;
|
||||
}
|
||||
|
||||
/* Seitennummern Navigation */
|
||||
.s-res-page-navigation {
|
||||
display: flex;
|
||||
gap: 0.25rem;
|
||||
}
|
||||
|
||||
.s-res-page-btn {
|
||||
background-color: #ffffff;
|
||||
border: 1px solid #cbd5e1;
|
||||
color: #4a5568;
|
||||
padding: 0.35rem 0.75rem;
|
||||
font-size: 0.9rem;
|
||||
font-weight: 500;
|
||||
border-radius: 4px;
|
||||
cursor: pointer;
|
||||
transition: all 0.2s ease;
|
||||
}
|
||||
|
||||
.s-res-page-btn:hover:not(:disabled) {
|
||||
background-color: #f8f9fa;
|
||||
border-color: #cbd5e1;
|
||||
color: #2d3748;
|
||||
}
|
||||
|
||||
.s-res-page-btn-active {
|
||||
background-color: #3182ce;
|
||||
border-color: #3182ce;
|
||||
color: #ffffff;
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
.s-res-page-btn:disabled {
|
||||
background-color: #f1f5f9;
|
||||
border-color: #e2e8f0;
|
||||
color: #94a3b8;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
|
||||
/* Responsive Anpassungen unter 760px (für z.B. Smartphones) */
|
||||
@media (max-width: 768px) {
|
||||
.s-res-layout-grid {
|
||||
grid-template-columns: 1fr; /* Stapelt Seitenleiste und Inhalt untereinander */
|
||||
gap: 1.5rem;
|
||||
margin: 1rem auto;
|
||||
}
|
||||
.s-res-pagination-footer {
|
||||
flex-direction: column;
|
||||
gap: 1rem;
|
||||
align-items: flex-start;
|
||||
}
|
||||
}
|
||||
|
||||
+3
-3
@@ -1,5 +1,5 @@
|
||||
<footer>
|
||||
<a href="impressum.php">Impressum</a>
|
||||
<a href="datenschutz.php">Datenschutz</a>
|
||||
<a href="nutzungsbedingungen.php">Nutzungsbedingungen</a>
|
||||
<a href="index.php?pfad=impressum">Impressum</a>
|
||||
<a href="index.php?pfad=datenschutz">Datenschutz</a>
|
||||
<a href="index.php?pfad=nutzungsbedingungen">Nutzungsbedingungen</a>
|
||||
</footer>
|
||||
@@ -23,7 +23,9 @@ require_once $abs_path . "/php/controller/index-controller.php";
|
||||
<link rel="stylesheet" href="css/main.css">
|
||||
<link rel="stylesheet" href="css/navbar.css">
|
||||
<link rel="stylesheet" href="css/footer.css">
|
||||
<link rel="stylesheet" href="css/search-results.css">
|
||||
<link rel="stylesheet" href="css/createArticle.css">
|
||||
<link rel="stylesheet" href="css/profile.css">
|
||||
<link rel="stylesheet" href="css/showArticle.css">
|
||||
<link rel="stylesheet" href="css/message.css">
|
||||
<title>EduForge</title>
|
||||
|
||||
@@ -8,7 +8,7 @@ if ($_SERVER["REQUEST_METHOD"] === "POST") {
|
||||
$_SESSION["message"] = "missing_parameters";
|
||||
header("location: ../../index.php?pfad=createArticle");
|
||||
} else {
|
||||
|
||||
|
||||
$title = $_POST["title"];
|
||||
$content = $_POST["content"];
|
||||
$category = $_POST["category"];
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
/*
|
||||
* Controller für die Liste der eigenen Beiträge eines Nutzers auf der eigenen Profilseite
|
||||
*/
|
||||
|
||||
session_start();
|
||||
require_once 'php/model/Article.php';
|
||||
require_once 'php/model/ArticleManager.php';
|
||||
|
||||
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";
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
$_SESSION["message"] = "internal_error";
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
session_start();
|
||||
require_once '../model/LocalArticleManager.php';
|
||||
require_once '../model/ArticleManager.php';
|
||||
|
||||
if ($_SERVER["REQUEST_METHOD"] === "POST") {
|
||||
if(!isset($_POST["search"])){
|
||||
$_SESSION["message"] = "missing_parameters";
|
||||
header("location: ../../index.php?pfad=search-results");
|
||||
} else {
|
||||
|
||||
$search = $_POST["search"];
|
||||
|
||||
try {
|
||||
$articleManager = ArticleManager::getInstance();
|
||||
$articleManager->search($search); // TODO: Methode implementieren.
|
||||
} catch (Exception $e){
|
||||
$_SESSION["message"] = "internal_error";
|
||||
}
|
||||
$_SESSION["message"] = "new_search_results";
|
||||
// TODO: Liste mit Artikeln in der Suchreihenfolge übertragen.
|
||||
// Weiterleitung zur Suchergebnisanzeige
|
||||
header("location: ../../index.php?pfad=search-results");
|
||||
exit();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -5,8 +5,9 @@ require_once 'php/model/ArticleManager.php';
|
||||
|
||||
if (isset($_GET["id"])){
|
||||
try {
|
||||
$id = $_GET["id"];
|
||||
$articleManager = ArticleManager::getInstance();
|
||||
$article = $articleManager->getArticle($_GET["id"]);
|
||||
$article = $articleManager->getArticle($id);
|
||||
if($article != null){
|
||||
$title = $article->getTitle();
|
||||
$content = $article->getContent();
|
||||
@@ -15,14 +16,11 @@ if (isset($_GET["id"])){
|
||||
$tags = $article->getTags();
|
||||
}else{
|
||||
$_SESSION["message"] = "article_not_found";
|
||||
echo "article_not_found";
|
||||
}
|
||||
} catch (Exception $e){
|
||||
$_SESSION["message"] = "internal_error";
|
||||
echo "Fehler aufgetreten: " . $e->getMessage();
|
||||
}
|
||||
}else{
|
||||
$_SESSION["message"] = "article_not_found";
|
||||
echo "article_not_found";
|
||||
}
|
||||
?>
|
||||
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
session_start();
|
||||
require_once '../model/LocalArticleManager.php';
|
||||
require_once '../model/ArticleManager.php';
|
||||
require_once '../model/Article.php';
|
||||
|
||||
if ($_SERVER["REQUEST_METHOD"] === "POST") {
|
||||
try {
|
||||
$id = $_GET["id"];
|
||||
} catch (Exception $e){
|
||||
$_SESSION["message"] = "missing_id";
|
||||
}
|
||||
if (!isset($_POST["title"]) ||!isset($_POST["content"]) || !isset($_POST["category"])){
|
||||
$_SESSION["message"] = "missing_parameters";
|
||||
header("location: ../../index.php?pfad=updateArticle");
|
||||
} elseif(!isset($id)) {
|
||||
$_SESSION["message"] = "missing_id";
|
||||
//header("location: ../../index.php?pfad=updateArticle");
|
||||
}else{
|
||||
|
||||
$newTitle = $_POST["title"];
|
||||
$newContent = $_POST["content"];
|
||||
$newCategory = $_POST["category"];
|
||||
$author = "max.mustermann"; // TODO: später aus Session den angemeldeten Nutzer beziehen.
|
||||
$newTags = $_POST["tags"];
|
||||
|
||||
try {
|
||||
$articleManager = ArticleManager::getInstance(); // TODO: Später aus Session den Nutzer auslesen und Autorenrechte prüfen!
|
||||
$article = $articleManager->getArticle($id);
|
||||
$article->setTitle($newTitle);
|
||||
$article->setContent($newContent);
|
||||
$article->setCategory($newCategory);
|
||||
$article->setTags($newTags);
|
||||
$articleManager->updateArticle($id ,$article, $author);
|
||||
} catch (Exception $e){
|
||||
$_SESSION["message"] = "internal_error";
|
||||
}
|
||||
$_SESSION["message"] = "article_updated";
|
||||
// Weiterleitung zur Homepage
|
||||
header("location: ../../index.php?pfad=showArticle&id=$id");
|
||||
|
||||
}
|
||||
exit();
|
||||
}
|
||||
|
||||
?>
|
||||
+21
-11
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/**
|
||||
* Klasse: Artikel
|
||||
* Diese Klasse stellt alle Daten eines Artikels (Beitrag) bereit
|
||||
* Diese Klasse stellt alle Daten eines Beitrags (Beitrag) bereit
|
||||
*
|
||||
* @author Niklas Ortmann
|
||||
*/
|
||||
@@ -38,7 +38,7 @@ class Article
|
||||
}
|
||||
|
||||
/**
|
||||
* Gibt die ID eines Artikels zurück.
|
||||
* Gibt die ID eines Beitrags zurück.
|
||||
* @return int
|
||||
*/
|
||||
public function getId(): int
|
||||
@@ -47,7 +47,7 @@ class Article
|
||||
}
|
||||
|
||||
/**
|
||||
* Gibt den Titel eines Artikels zurück.
|
||||
* Gibt den Titel eines Beitrags zurück.
|
||||
* @return string
|
||||
*/
|
||||
public function getTitle(): string
|
||||
@@ -56,7 +56,7 @@ class Article
|
||||
}
|
||||
|
||||
/**
|
||||
* Setzt den Titel eines Artikels
|
||||
* Setzt den Titel eines Beitrags
|
||||
* @param $title
|
||||
* @return void
|
||||
*/
|
||||
@@ -66,7 +66,7 @@ class Article
|
||||
}
|
||||
|
||||
/**
|
||||
* Gibt den Content eines Artikels zurück.
|
||||
* Gibt den Content eines Beitrags zurück.
|
||||
* TODO: Content muss noch definiert werden.
|
||||
* @return string
|
||||
*/
|
||||
@@ -76,7 +76,7 @@ class Article
|
||||
}
|
||||
|
||||
/**
|
||||
* Setzt den Content eines Artikels.
|
||||
* Setzt den Content eines Beitrags.
|
||||
* TODO: Content muss noch definiert werden.
|
||||
* @param $content
|
||||
* @return void
|
||||
@@ -87,7 +87,7 @@ class Article
|
||||
}
|
||||
|
||||
/**
|
||||
* Gibt den Autor eines Artikels zurück.
|
||||
* Gibt den Autor eines Beitrags zurück.
|
||||
* @return string
|
||||
*/
|
||||
public function getAuthor(): string
|
||||
@@ -96,7 +96,7 @@ class Article
|
||||
}
|
||||
|
||||
/**
|
||||
* Gibt das Veröffentlichungsdatum des Artikels zurück.
|
||||
* Gibt das Veröffentlichungsdatum des Beitrags zurück.
|
||||
* @return string
|
||||
*/
|
||||
public function getCreationDate(): string
|
||||
@@ -105,7 +105,7 @@ class Article
|
||||
}
|
||||
|
||||
/**
|
||||
* Gibt die Kategorie eines Artikels zurück.
|
||||
* Gibt die Kategorie eines Beitrags zurück.
|
||||
* @return string
|
||||
*/
|
||||
public function getCategory(): string
|
||||
@@ -114,7 +114,17 @@ class Article
|
||||
}
|
||||
|
||||
/**
|
||||
* Gibt die Schlagworte eines Artikels zurück.
|
||||
* Setzt die Kategorie eines Beitrags.
|
||||
* @param string $category
|
||||
* @return void
|
||||
*/
|
||||
public function setCategory(string $category)
|
||||
{
|
||||
$this->category = $category;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gibt die Schlagworte eines Beitrags zurück.
|
||||
* @return string
|
||||
*/
|
||||
public function getTags(): string
|
||||
@@ -123,7 +133,7 @@ class Article
|
||||
}
|
||||
|
||||
/**
|
||||
* Setzt die Schlagworte eines Artikels.
|
||||
* Setzt die Schlagworte eines Beitrags.
|
||||
* @param string $tags
|
||||
*/
|
||||
public function setTags(string $tags)
|
||||
|
||||
@@ -21,26 +21,24 @@ interface ArticleManagerDAO
|
||||
public function addArticle($title, $content, $author, $category, $tags);
|
||||
|
||||
/**
|
||||
* Ein angemeldeter Nutzer bearbeitet einen Beitrag.
|
||||
* $id ID des Beitrags
|
||||
* $title Titel des Beitrags
|
||||
* $content Der Inhalt des Beitrags
|
||||
* $author dem Author des des Beitrags (NID oder email)
|
||||
* Ändert den gespeicherten Beitrag eines übergebenen Beitrags und eines Autors.
|
||||
* Es wird geprüft, ob der zu änderne Beitrag existiert und ob der übergebene Autor der Autor des originalen
|
||||
* Beitrages ist.
|
||||
* @param $id
|
||||
* @param $article
|
||||
* @param $author
|
||||
* @return void
|
||||
*
|
||||
* Mögliche Exceptions:
|
||||
* TODO Fehlerbeschreibung hinzufügen
|
||||
* TODO: Fehlerbeschreibung hinzufügen
|
||||
*/
|
||||
public function updateArticle($id, $title, $content, $author);
|
||||
public function updateArticle($id, $article, $author);
|
||||
|
||||
/*
|
||||
* Ein angemeldeter Nutzer löscht einen seiner Beiträge.
|
||||
* $id ID des Beitrags
|
||||
* $title Titel des Beitrags
|
||||
* $content Der Inhalt des Beitrags
|
||||
* $author dem Author des des Beitrags (NID oder email)
|
||||
/**
|
||||
* Löscht einen Beitrag aus übergebener ID.
|
||||
* @param $id
|
||||
* @return void
|
||||
*
|
||||
* Mögliche Exceptions:
|
||||
* TODO Fehlerbeschreibung hinzufügen
|
||||
* TODO: Fehlerbeschreibung hinzufügen
|
||||
*/
|
||||
public function deleteArticle($id);
|
||||
|
||||
@@ -62,6 +60,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);
|
||||
|
||||
}
|
||||
?>
|
||||
@@ -62,14 +62,65 @@ class LocalArticleManager implements ArticleManagerDAO {
|
||||
$this->saveArticle($articles);
|
||||
}
|
||||
|
||||
public function updateArticle($id, $title, $content, $author)
|
||||
public function updateArticle($id, $article, $author)
|
||||
{
|
||||
// TODO: Implement updateArticle() method.
|
||||
if (empty($article)) {
|
||||
// TODO: Implement Exception.
|
||||
return;
|
||||
}
|
||||
|
||||
// Berechtigungsprüfung:
|
||||
if ($article->getAuthor() !== $author) {
|
||||
// TODO: Implement Exception.
|
||||
return;
|
||||
}
|
||||
|
||||
// Beitrag aktualisieren:
|
||||
$articles = $this->getAllArticles();
|
||||
$updated = false;
|
||||
|
||||
foreach ($articles as $index => $storedArticle) {
|
||||
if (isset($storedArticle['id']) && $storedArticle['id'] == $id) {
|
||||
$articles[$index] = [
|
||||
"id" => $id,
|
||||
"title" => $article->getTitle(),
|
||||
"content" => $article->getContent(),
|
||||
"author" => $author,
|
||||
"category" => $article->getCategory(),
|
||||
"tags" => $article->getTags(),
|
||||
"creationDate" => $article->getCreationDate()
|
||||
];
|
||||
$updated = true;
|
||||
break;
|
||||
}else{
|
||||
// TODO: Implement Exception.
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Nur speichern, wenn Beitrag geändert wurde:
|
||||
if ($updated) {
|
||||
$this->saveArticle($articles);
|
||||
}
|
||||
}
|
||||
|
||||
public function deleteArticle($id)
|
||||
{
|
||||
// TODO: Implement deleteArticle() method.
|
||||
$articles = $this->getAllArticles();
|
||||
$articleFound = false;
|
||||
|
||||
foreach ($articles as $index => $article) {
|
||||
if (isset($article['id']) && $article['id'] == $id) {
|
||||
unset($articles[$index]);
|
||||
$articleFound = true;
|
||||
break; // Schleife abbrechen, da die ID eindeutig ist
|
||||
}
|
||||
}
|
||||
|
||||
if ($articleFound) {
|
||||
// array_values stellt sicher, dass die Array-Keys wieder fortlaufend bei 0 beginnen
|
||||
$this->saveArticle(array_values($articles));
|
||||
}
|
||||
}
|
||||
|
||||
public function getArticle($id)
|
||||
@@ -97,5 +148,25 @@ class LocalArticleManager implements ArticleManagerDAO {
|
||||
return is_array($articles) ? $articles : [];
|
||||
}
|
||||
|
||||
public function getArticlesByAuthor($author)
|
||||
{
|
||||
$articles = $this->getAllArticles();
|
||||
$filteredArticles = [];
|
||||
|
||||
foreach ($articles as $article) {
|
||||
if (isset($article['author']) && $article['author'] == $author) {
|
||||
$filteredArticles[] = new Article(
|
||||
intval($article['id']),
|
||||
$article['title'],
|
||||
$article['content'],
|
||||
$article['author'],
|
||||
$article['category'],
|
||||
$article['tags'],
|
||||
$article['creationDate']
|
||||
);
|
||||
}
|
||||
}
|
||||
return $filteredArticles;
|
||||
}
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user