Compare commits

..

138 Commits

Author SHA1 Message Date
niklas.ortmann 9eb6feb589 Update createArticle-controller.php 2026-05-29 13:19:49 +02:00
niklas.ortmann 23eee02208 debugging 2026-05-29 13:19:00 +02:00
niklas.ortmann ca4dfd03e4 debugging 2026-05-29 13:16:41 +02:00
niklas.ortmann 5c613a82c0 debugging 2026-05-29 13:15:05 +02:00
niklas.ortmann 34ffad38a6 testing 2026-05-29 13:11:58 +02:00
niklas.ortmann b131523bf3 refactoring 2026-05-29 13:10:05 +02:00
niklas.ortmann db2bd7e195 testing 2026-05-29 13:09:20 +02:00
niklas.ortmann 51ccad038d Update ArticleManagerDAO.php 2026-05-29 13:06:55 +02:00
niklas.ortmann 18810dcfe2 refactoring 2026-05-29 13:05:28 +02:00
niklas.ortmann ed1815b78e Update LocalArticleManager.php 2026-05-29 13:04:59 +02:00
niklas.ortmann 246a2a856c Update ArticleManagerDAO.php 2026-05-29 13:03:19 +02:00
niklas.ortmann 77b3916985 Update ArticleManagerDAO.php 2026-05-29 13:02:09 +02:00
niklas.ortmann 298a9b406a Update showArticle.php 2026-05-29 12:14:15 +02:00
niklas.ortmann e5d6291aac Update showArticle.php 2026-05-29 12:13:50 +02:00
niklas.ortmann 667d009cf8 Update showArticle.php 2026-05-29 12:13:27 +02:00
niklas.ortmann 3edc689e5f home-controller.php 2026-05-29 12:09:04 +02:00
niklas.ortmann 938cca55fe showArticle.css 2026-05-29 12:02:21 +02:00
niklas.ortmann d5e177654f refactoring 2026-05-29 11:58:12 +02:00
niklas.ortmann 59bbbc6bf4 Update home.php 2026-05-29 11:52:31 +02:00
niklas.ortmann ec814c9026 Update ArticleManager.php 2026-05-29 11:51:09 +02:00
niklas.ortmann b390437790 Update ArticleManager.php 2026-05-29 11:50:05 +02:00
niklas.ortmann d08e56bb5a Update ArticleManager.php 2026-05-29 11:49:45 +02:00
niklas.ortmann ccff6ab4cb Update ArticleManager.php 2026-05-29 11:49:25 +02:00
niklas.ortmann 04c1cb00c5 Dummy-Beitrage werden in ArticleManager beim Instanziieren gesetzt. 2026-05-29 11:43:53 +02:00
niklas.ortmann 1f2be8b8ee Update showArticle-controller.php 2026-05-29 11:41:46 +02:00
niklas.ortmann f2c0b4e4b5 Update showArticle-controller.php 2026-05-29 11:39:25 +02:00
niklas.ortmann 77fd9af112 Update showArticle-controller.php 2026-05-29 11:39:04 +02:00
niklas.ortmann 7ea3ce66ce Update showArticle.php 2026-05-29 11:37:27 +02:00
niklas.ortmann a91869bf47 Update showArticle.php 2026-05-29 11:37:12 +02:00
niklas.ortmann 9ae1cd4c34 debugging 2026-05-29 11:36:39 +02:00
niklas.ortmann 475fb00001 Update showArticle-controller.php 2026-05-29 11:36:12 +02:00
niklas.ortmann 168cf68a70 debugging 2026-05-29 11:34:43 +02:00
niklas.ortmann 36d4ac0681 Update index.php 2026-05-29 11:34:11 +02:00
niklas.ortmann 1afc7b480a Update home.php 2026-05-29 11:33:26 +02:00
niklas.ortmann b88046e228 Update home.php 2026-05-29 11:32:01 +02:00
niklas.ortmann 4f00859d1b debugging 2026-05-29 11:31:21 +02:00
niklas.ortmann 1b68f037ae showArticle.php + showArticle-controller.php Implementation 2026-05-29 11:29:52 +02:00
niklas.ortmann 7067303758 Update index.php 2026-05-29 11:09:04 +02:00
niklas.ortmann e499ffba22 "Beitrag erstellt"-Nachricht von index-php nach home.php 2026-05-29 11:08:00 +02:00
niklas.ortmann c4e7ca3ac2 Update LocalArticleManager.php 2026-05-29 11:05:57 +02:00
niklas.ortmann 55367963fb Update home.php 2026-05-29 11:05:27 +02:00
niklas.ortmann 5522f4fc04 Update LocalArticleManager.php 2026-05-29 11:03:38 +02:00
niklas.ortmann 332507d433 debugging 2026-05-29 11:01:55 +02:00
niklas.ortmann fe703d4e89 Update home.php 2026-05-29 10:58:06 +02:00
niklas.ortmann ef6d6d9a91 debugging 2026-05-29 10:54:21 +02:00
niklas.ortmann 128b191af5 Update LocalArticleManager.php 2026-05-29 10:53:07 +02:00
niklas.ortmann 5612bfe0b7 debugging 2026-05-29 10:46:12 +02:00
niklas.ortmann d0f9a97394 Update home.php 2026-05-29 10:35:06 +02:00
niklas.ortmann 67ecf6e870 Update home.php 2026-05-29 10:33:26 +02:00
niklas.ortmann fd27577407 Update home.php 2026-05-29 10:33:08 +02:00
niklas.ortmann 83ccf84da3 Update Article.php 2026-05-29 10:32:43 +02:00
niklas.ortmann 968534d28e Update home.php 2026-05-29 10:30:36 +02:00
niklas.ortmann cd60423f1a debugging 2026-05-29 10:30:09 +02:00
niklas.ortmann 9bb2587c49 debugging 2026-05-29 10:29:48 +02:00
niklas.ortmann ef94a5873c debugging 2026-05-29 10:29:26 +02:00
niklas.ortmann 8dbbe9eaf9 debugging 2026-05-29 10:29:00 +02:00
niklas.ortmann 3afac85222 Update home.php 2026-05-29 10:28:05 +02:00
niklas.ortmann 9eae4985d3 Update LocalArticleManager.php 2026-05-29 10:26:21 +02:00
niklas.ortmann 63c7bb8848 Update home.php 2026-05-29 10:19:25 +02:00
niklas.ortmann 28ef21aa52 Update home.php 2026-05-29 10:18:21 +02:00
niklas.ortmann 6a6ab16e09 Update LocalArticleManager.php 2026-05-29 10:11:22 +02:00
niklas.ortmann 5130a638b9 debugging 2026-05-29 10:09:59 +02:00
niklas.ortmann bc9b5effb2 debugging 2026-05-29 10:07:53 +02:00
niklas.ortmann 5ee412b050 debugging 2026-05-29 10:06:51 +02:00
niklas.ortmann 65412e6df9 debugging 2026-05-29 10:06:18 +02:00
niklas.ortmann 22ca680f3c debugging 2026-05-29 10:04:42 +02:00
niklas.ortmann 83268d3a67 dummy-Beiträge auf Home werden aus ArticleManager bezogen 2026-05-29 10:02:50 +02:00
niklas.ortmann d24bd0aa8b Update LocalArticleManager.php 2026-05-29 09:58:17 +02:00
niklas.ortmann c52834aa0d Article.php + getArticle Anpassungen
Article-Klasse ist nun syntaktisch korrekt.
getArticle gibt nun als Rückgabe einen Typ Article zurück
2026-05-29 09:57:50 +02:00
niklas.ortmann 306b9e8152 Dummy-Beiträge
Beim Instanziieren des ArticleManagers werden drei Dummy-Beiträge erstellt.
2026-05-29 09:43:39 +02:00
niklas.ortmann 30bb0d4657 getArticle by id 2026-05-29 09:32:56 +02:00
niklas.ortmann fdd7408f53 showArticle.php + showArticle-controller.php 2026-05-29 09:31:39 +02:00
NOrtmann1 086596f68c messages-styling 2026-05-28 17:21:29 +02:00
NOrtmann1 7a206674ab Update index.php 2026-05-28 17:16:25 +02:00
NOrtmann1 9698512ccf Update index.php 2026-05-28 17:15:40 +02:00
NOrtmann1 f4d144980d Update index.php 2026-05-28 17:13:21 +02:00
NOrtmann1 1513cbda7f User-Feedback 2026-05-28 17:11:59 +02:00
NOrtmann1 1becb82b1b Update php.xml 2026-05-28 15:50:28 +02:00
NOrtmann1 91880b163d erste funktionale Version 2026-05-27 19:38:38 +02:00
NOrtmann1 81dd452f81 Update createArticle-controller.php 2026-05-27 19:37:37 +02:00
NOrtmann1 24642ad83e testing 2026-05-27 19:36:52 +02:00
NOrtmann1 9b8f4036a9 testing 2026-05-27 19:35:11 +02:00
NOrtmann1 86395f0727 testing 2026-05-27 19:32:22 +02:00
NOrtmann1 e5b617dcba testing 2026-05-27 19:31:38 +02:00
NOrtmann1 581c012a72 testing 2026-05-27 19:28:35 +02:00
NOrtmann1 e5eaaf857e testing 2026-05-27 19:24:57 +02:00
NOrtmann1 e0835b70df Update LocalArticleManager.php 2026-05-27 19:23:15 +02:00
NOrtmann1 ed471cdf94 Update LocalArticleManager.php 2026-05-27 19:22:20 +02:00
NOrtmann1 f825537b52 testing 2026-05-27 19:20:14 +02:00
NOrtmann1 485e08e6c6 testing 2026-05-27 19:18:59 +02:00
NOrtmann1 7ff02a6a94 testing 2026-05-27 19:14:45 +02:00
NOrtmann1 ec0148bb86 Update LocalArticleManager.php 2026-05-27 19:09:37 +02:00
NOrtmann1 9aa0793ab4 testing 2026-05-27 19:03:02 +02:00
NOrtmann1 54220682cf article.json 2026-05-27 18:20:56 +02:00
NOrtmann1 b13cff14dc testing 2026-05-27 18:16:22 +02:00
NOrtmann1 f86bdfd2ea testing 2026-05-27 18:02:30 +02:00
NOrtmann1 3933b9b55c Update createArticle-controller.php 2026-05-27 17:58:58 +02:00
NOrtmann1 7a784c8243 Update createArticle-controller.php 2026-05-27 17:49:11 +02:00
NOrtmann1 10ddf8bf7f Update createArticle-controller.php 2026-05-27 17:48:36 +02:00
NOrtmann1 0779a2c7d4 Update createArticle-controller.php 2026-05-27 17:47:11 +02:00
NOrtmann1 053ae0b52f Update createArticle-controller.php 2026-05-27 17:46:52 +02:00
NOrtmann1 be8b6372db testing 2026-05-27 17:46:03 +02:00
NOrtmann1 6068417fc5 Update createArticle-controller.php 2026-05-27 17:45:23 +02:00
NOrtmann1 14d0b23d06 testing 2026-05-27 17:44:33 +02:00
NOrtmann1 1f6ddcd1fd testing 2026-05-27 17:44:06 +02:00
NOrtmann1 701fda5ab5 testing 2026-05-27 17:42:25 +02:00
NOrtmann1 47731a8d46 testing 2026-05-27 17:41:35 +02:00
NOrtmann1 0ade795415 testing 2026-05-27 17:41:17 +02:00
NOrtmann1 2a9a60ae84 testing 2026-05-27 17:40:52 +02:00
NOrtmann1 efdc9b4175 testing 2026-05-27 17:40:29 +02:00
NOrtmann1 6076903b42 testing 2026-05-27 17:39:58 +02:00
NOrtmann1 d43218fdb2 Update createArticle-controller.php 2026-05-27 17:39:06 +02:00
NOrtmann1 554dbd677a testing 2026-05-27 17:38:41 +02:00
NOrtmann1 6a7e961cf6 testing 2026-05-27 17:34:56 +02:00
NOrtmann1 e49e614958 Update createArticle-controller.php 2026-05-27 17:32:58 +02:00
NOrtmann1 70fe6ff807 testing 2026-05-27 17:31:42 +02:00
NOrtmann1 f6932afcb8 testing 2026-05-27 17:31:19 +02:00
NOrtmann1 e3901265d8 path-refactoring 2026-05-27 17:29:45 +02:00
NOrtmann1 368a4948ec testing 2026-05-27 17:22:05 +02:00
NOrtmann1 6c07502866 testing 2026-05-27 17:19:36 +02:00
NOrtmann1 c1c8bc47d7 testing 2026-05-27 17:19:11 +02:00
NOrtmann1 8466a857c3 path-refactoring + getter & setter 2026-05-27 17:18:32 +02:00
NOrtmann1 68d9224ea3 testing 2026-05-27 17:03:40 +02:00
NOrtmann1 aac26b0e50 testing 2026-05-27 17:03:10 +02:00
NOrtmann1 a1a9fa9d3e testing 2026-05-27 17:02:21 +02:00
NOrtmann1 5625326f38 testing 2026-05-27 17:01:48 +02:00
NOrtmann1 8841cffb25 testing 2026-05-27 17:01:07 +02:00
NOrtmann1 d72bf8c3e2 testing 2026-05-27 17:00:24 +02:00
NOrtmann1 04195f5d92 Pfadanpassung (test) 2026-05-27 16:59:04 +02:00
NOrtmann1 24a3ad0639 Update createArticle.php 2026-05-27 16:56:27 +02:00
NOrtmann1 72097f891d Update createArticle.php 2026-05-27 16:55:51 +02:00
NOrtmann1 0686e98384 first test 2026-05-27 16:52:06 +02:00
NOrtmann1 7d9bef932f Update createArticle-controller.php 2026-05-27 16:16:21 +02:00
NOrtmann1 e69cb50a9c Delete UserDAO.php 2026-05-27 16:04:08 +02:00
NOrtmann1 890187cff2 statt txt -> json 2026-05-27 16:03:56 +02:00
NOrtmann1 f2a9d8d1b3 refactoring 2026-05-26 19:04:46 +02:00
NOrtmann1 e128a31a34 refactoring 2026-05-26 18:55:42 +02:00
NOrtmann1 d7acca36fd Update createArticle.php 2026-05-26 18:46:42 +02:00
16 changed files with 573 additions and 147 deletions
Generated
+3
View File
@@ -10,6 +10,9 @@
<option name="highlightLevel" value="WARNING" /> <option name="highlightLevel" value="WARNING" />
<option name="transferred" value="true" /> <option name="transferred" value="true" />
</component> </component>
<component name="PhpProjectSharedConfiguration" php_language_level="7.0">
<option name="suggestChangeDefaultLanguageLevel" value="false" />
</component>
<component name="PhpStanOptionsConfiguration"> <component name="PhpStanOptionsConfiguration">
<option name="transferred" value="true" /> <option name="transferred" value="true" />
</component> </component>
+14 -13
View File
@@ -1,22 +1,23 @@
<?php
session_start();
?>
<!-- <!--
Seite: Beitrag erstellen Seite: Beitrag erstellen
Inhalt: Formular für die Erstellung eines neuen Beitrags Inhalt: Formular für die Erstellung eines neuen Beitrags
--> -->
<?php <form method="post" action="php/controller/createArticle-controller.php" id="editor-form" class="article-editor-scope editor-container">
include_once $abs_path . '/php/model/ArticleManagerDAO.php';
include_once $abs_path . '/php/model/ArticleManager.php';
if(isset($_POST['title']) && isset($_POST['content']) && isset($_POST['category'])) {
}else{
// TODO: Exception werfen.
echo"Fehler!";
}
?>
<form method="post" action="php/controller/createArticle-controller.php" id="editor-form" class="wp-editor-scope editor-container">
<main class="editor-main"> <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.
</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; ?>
<input type="text" id="title" name="title" placeholder="Titel hier eingeben" required> <input type="text" id="title" name="title" placeholder="Titel hier eingeben" required>
<textarea id="content" name="content" placeholder="Schreibe deinen Beitrag..."></textarea> <textarea id="content" name="content" placeholder="Schreibe deinen Beitrag..."></textarea>
</main> </main>
+21 -3
View File
@@ -1,8 +1,25 @@
<?php
include_once 'php/controller/home-controller.php';
?>
<!-- <!--
Seite: Home Seite: Home
Inhalt: Beinhaltet den Inhalt der Startseite Inhalt: Beinhaltet den Inhalt der Startseite
--> -->
<main> <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.
</p>
<?php endif; ?>
<?php if (isset($_SESSION["message"]) && $_SESSION["message"] == "new_article"): ?>
<p class="alert-message is-success">
Dein Beitrag wurde erfolgreich veröffentlicht!
</p>
<?php endif; ?>
<?php
unset($_SESSION["message"]);
?>
<h1>Home</h1> <h1>Home</h1>
<p> <p>
@@ -19,22 +36,23 @@
<div class="container"> <div class="container">
<a href="index.php?pfad=informatik" class="category-link">Informatik</a> <a href="index.php?pfad=informatik" class="category-link">Informatik</a>
<div class="article-link"> <div class="article-link">
<a href="datenschutzVSdatensicherheit.php">Datenschutz vs. Datensicherheit</a> <a href="index.php?pfad=showArticle&id=<?php echo $dummy3->getId()?>"><?php if(isset($dummy3)){echo $dummy3->getTitle();}else{echo "Fehler: Beitrag nicht gefunden!";} ?></a>
</div> </div>
</div> </div>
<div class="container"> <div class="container">
<a href="index.php?pfad=mathe" class="category-link">Mathe</a> <a href="index.php?pfad=mathe" class="category-link">Mathe</a>
<div class="article-link"> <div class="article-link">
<a href="pythagoras.php">Satz des Pythagoras</a> <a href="index.php?pfad=showArticle&id=<?php echo $dummy1->getId()?>"><?php if(isset($dummy1)){echo $dummy1->getTitle();}else{echo "Fehler: Beitrag nicht gefunden!";} ?></a>
</div> </div>
</div> </div>
<div class="container"> <div class="container">
<a href="index.php?pfad=physik" class="category-link">Physik</a> <a href="index.php?pfad=physik" class="category-link">Physik</a>
<div class="article-link"> <div class="article-link">
<a href="tunneleffekt.php">Der Tunneleffekt</a> <a href="index.php?pfad=showArticle&id=<?php echo $dummy2->getId()?>"><?php if(isset($dummy2)){echo $dummy2->getTitle();}else{echo "Fehler: Beitrag nicht gefunden!";} ?></a>
</div> </div>
</div> </div>
</div> </div>
</main> </main>
+61
View File
@@ -0,0 +1,61 @@
<!--
Seite: Anzeige für Beiträge
Funktion: Stellt einen übergebenen Beitrag dar.
-->
<?php
include_once 'php/controller/showArticle-controller.php';
?>
<!-- Hauptcontainer für die Beitragsansicht (Ausschließlich der Content-Bereich) -->
<main class="article-view-container">
<!-- 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>
<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 endif; ?>
</div>
</div>
<!-- articleikel-Inhalt -->
<div class="article-view-content">
<?php if (isset($content)): ?>
<!-- nl2br für Zeilenumbrüche -->
<div class="article-view-body"><?php echo nl2br(htmlspecialchars($content)); ?></div>
<?php endif; ?>
</div>
<!-- articleikel-Endbereich (Tags) -->
<?php 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
// Falls $tags ein String ist (z.B. "Web, CSS"), in ein Array umwandeln
$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; ?>
</main>
+18 -17
View File
@@ -1,5 +1,5 @@
/* editor in Flexbox */ /* editor in Flexbox */
.wp-editor-scope.editor-container { .article-editor-scope.editor-container {
display: flex; display: flex;
min-height: 100vh; min-height: 100vh;
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
@@ -8,14 +8,14 @@
box-sizing: border-box; box-sizing: border-box;
} }
.wp-editor-scope * { .article-editor-scope * {
box-sizing: border-box; box-sizing: border-box;
margin: 0; margin: 0;
padding: 0; padding: 0;
} }
/* Hauptbereich */ /* Hauptbereich */
.wp-editor-scope .editor-main { .article-editor-scope .editor-main {
flex: 1; flex: 1;
padding: 40px; padding: 40px;
display: flex; display: flex;
@@ -24,7 +24,7 @@
background: #ffffff; background: #ffffff;
} }
.wp-editor-scope #title { .article-editor-scope #title {
font-size: 2.5rem; font-size: 2.5rem;
font-weight: 700; font-weight: 700;
border: none; border: none;
@@ -33,7 +33,7 @@
background: transparent; background: transparent;
} }
.wp-editor-scope #content { .article-editor-scope #content {
flex: 1; flex: 1;
font-size: 1.1rem; font-size: 1.1rem;
line-height: 1.6; line-height: 1.6;
@@ -45,7 +45,7 @@
} }
/* Seitenleiste */ /* Seitenleiste */
.wp-editor-scope .editor-sidebar { .article-editor-scope .editor-sidebar {
width: 300px; width: 300px;
background-color: #ffffff; background-color: #ffffff;
border-left: 1px solid #e0e0e0; border-left: 1px solid #e0e0e0;
@@ -55,24 +55,24 @@
gap: 24px; gap: 24px;
} }
.wp-editor-scope .sidebar-block { .article-editor-scope .sidebar-block {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
gap: 8px; gap: 8px;
} }
.wp-editor-scope .sidebar-block label { .article-editor-scope .sidebar-block label {
font-weight: 600; font-weight: 600;
font-size: 0.9rem; font-size: 0.9rem;
} }
.wp-editor-scope .required { .article-editor-scope .required {
color: #d94f4f; color: #d94f4f;
} }
/* Formularelemente innerhalb der Editor-Sidebar */ /* Formularelemente innerhalb der Editor-Sidebar */
.wp-editor-scope .editor-sidebar select, .article-editor-scope .editor-sidebar select,
.wp-editor-scope .editor-sidebar input[type="text"] { .article-editor-scope .editor-sidebar input[type="text"] {
width: 100%; width: 100%;
padding: 8px; padding: 8px;
border: 1px solid #ccc; border: 1px solid #ccc;
@@ -82,7 +82,7 @@
} }
/* Button-Zeugs */ /* Button-Zeugs */
.wp-editor-scope .btn-publish { .article-editor-scope .btn-publish {
background-color: #007cba; background-color: #007cba;
color: white; color: white;
border: none; border: none;
@@ -94,27 +94,28 @@
width: 100%; width: 100%;
} }
.wp-editor-scope .btn-publish:hover { .article-editor-scope .btn-publish:hover {
background-color: #006ba1; background-color: #006ba1;
} }
/* Responsive Anpassungen unter 760px (für z.B. Smartphones) */
@media (max-width: 760px) { @media (max-width: 760px) {
.wp-editor-scope.editor-container { .article-editor-scope.editor-container {
/* Sidebar nach unten */ /* Sidebar nach unten */
flex-direction: column; flex-direction: column;
} }
.wp-editor-scope .editor-main { .article-editor-scope .editor-main {
/* weniger Innenabstand */ /* weniger Innenabstand */
padding: 20px; padding: 20px;
} }
.wp-editor-scope #content { .article-editor-scope #content {
/* Verhindert, dass das Textfeld auf kleinen Displays kollabiert */ /* Verhindert, dass das Textfeld auf kleinen Displays kollabiert */
min-height: 300px; min-height: 300px;
} }
.wp-editor-scope .editor-sidebar { .article-editor-scope .editor-sidebar {
width: 100%; width: 100%;
/* Entfernt den linken Rand und setzt ihn nach oben als Trenner */ /* Entfernt den linken Rand und setzt ihn nach oben als Trenner */
border-left: none; border-left: none;
+29
View File
@@ -0,0 +1,29 @@
.alert-message {
padding: 12px 16px;
margin: 12px 0;
border-radius: 6px;
border: 1px solid transparent;
font-family: sans-serif;
font-size: 14px;
font-weight: 500;
line-height: 1.5;
display: flex;
align-items: center;
gap: 10px;
}
/* Rote Fehlermeldung */
.alert-message.is-error {
color: #ba1a1a;
background-color: #ffeede;
border-color: #ffb4ab;
}
/* Grüne Erfolgsmeldung */
.alert-message.is-success {
color: #006e2c;
background-color: #e8f5e9;
border-color: #b2dfdb;
}
+118
View File
@@ -0,0 +1,118 @@
/* Container für den gesamten articleikel */
.article-view-container {
box-sizing: border-box;
max-width: 900px; /* Angenehme Lesebreite für längere Texte */
margin: 3rem auto;
padding: 0 2rem;
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
color: #212529;
line-height: 1.6;
}
.article-view-container * {
box-sizing: border-box;
}
/* --- KOPFDATEN-BEREICH --- */
.article-view-top-section {
margin-bottom: 2.5rem;
border-bottom: 1px solid #e2e8f0;
padding-bottom: 1.5rem;
}
/* Kategorie-Badge */
.article-view-category {
display: inline-block;
background-color: #ebf8ff;
color: #2b6cb0;
font-size: 0.8rem;
font-weight: 700;
text-transform: uppercase;
letter-spacing: 0.05em;
padding: 0.25rem 0.75rem;
border-radius: 4px;
margin-bottom: 0.75rem;
}
/* Hauptüberschrift */
.article-view-title {
font-size: 2.5rem;
color: #1a202c;
line-height: 1.2;
margin: 0 0 0.75rem 0;
font-weight: 800;
}
/* Autoren-Zeile */
.article-view-meta {
font-size: 0.95rem;
color: #4a5568;
}
.article-view-author strong {
color: #2d3748;
}
/* --- INHALT --- */
.article-view-content {
margin-bottom: 3rem;
}
.article-view-body {
font-size: 1.125rem;
color: #2d3748;
white-space: pre-line;
}
/* --- TAG-BEREICH --- */
.article-view-bottom-section {
border-top: 1px solid #e2e8f0;
padding-top: 1.5rem;
display: flex;
flex-direction: column;
gap: 0.5rem;
}
.article-view-tags-label {
font-size: 0.9rem;
font-weight: 600;
color: #718096;
text-transform: uppercase;
letter-spacing: 0.05em;
}
.article-view-tags-list {
display: flex;
flex-wrap: wrap;
gap: 0.5rem;
}
/* Einzelner Tag */
.article-view-tag-item {
background-color: #f1f5f9;
color: #475569;
font-size: 0.85rem;
font-weight: 500;
padding: 0.35rem 0.75rem;
border-radius: 6px;
border: 1px solid #e2e8f0;
transition: background-color 0.2s, color 0.2s;
}
.article-view-tag-item:hover {
background-color: #e2e8f0;
color: #1e293b;
cursor: default;
}
/* Responsive Anpassungen unter 760px (für z.B. Smarticlephones) */
@media (max-width: 760px) {
.article-view-container {
margin: 1.5rem auto;
padding: 0 1rem;
}
.article-view-title {
font-size: 1.85rem;
}
}
View File
+5 -3
View File
@@ -1,5 +1,6 @@
<?php <?php
session_start();
if (!isset($abs_path)) { if (!isset($abs_path)) {
require_once "path.php"; require_once "path.php";
} }
@@ -22,15 +23,16 @@ require_once $abs_path . "/php/controller/index-controller.php";
<link rel="stylesheet" href="css/main.css"> <link rel="stylesheet" href="css/main.css">
<link rel="stylesheet" href="css/navbar.css"> <link rel="stylesheet" href="css/navbar.css">
<link rel="stylesheet" href="css/footer.css"> <link rel="stylesheet" href="css/footer.css">
<link rel="stylesheet" href="css/article.css"> <link rel="stylesheet" href="css/createArticle.css">
<link rel="stylesheet" href="css/showArticle.css">
<link rel="stylesheet" href="css/message.css">
<title>EduForge</title> <title>EduForge</title>
</head> </head>
<body> <body>
<?php <?php
include_once $abs_path . '/includes/navbar.php'; include_once 'includes/navbar.php';
//Dynamischer Inhalt: //Dynamischer Inhalt:
if (isset($_GET["pfad"])) { if (isset($_GET["pfad"])) {
if (file_exists($abs_path . '/content/' . $_GET["pfad"] . '.php')) { if (file_exists($abs_path . '/content/' . $_GET["pfad"] . '.php')) {
+26 -12
View File
@@ -1,18 +1,32 @@
<?php <?php
session_start();
require_once '../model/LocalArticleManager.php';
require_once '../model/ArticleManager.php';
require_once $abs_path . '/php/model/ArticleManager.php'; if ($_SERVER["REQUEST_METHOD"] === "POST") {
require_once $abs_path . '/php/model/Article.php'; if(!isset($_POST["title"]) ||!isset($_POST["content"]) || !isset($_POST["category"])){
$_SESSION["message"] = "missing_parameters";
header("location: ../../index.php?pfad=createArticle");
} else {
try { $title = $_POST["title"];
$articleManager = new ArticleManager(); $content = $_POST["content"];
}catch (Exception $e){ $category = $_POST["category"];
die("Fehler bei der Initialisierung des Artikel-Managers: " . $e->getMessage()); $author = "max.mustermann"; // TODO: später aus Session den angemeldeten Nutzer beziehen.
$tags = $_POST["tags"];
try {
$articleManager = ArticleManager::getInstance();
$articleManager->addArticle($title, $content, $author, $category, $tags);
} catch (Exception $e){
$_SESSION["message"] = "internal_error";
}
$_SESSION["message"] = "new_article";
// Weiterleitung zur Homepage
header("location: ../../index.php");
exit();
}
} }
try {
$author = "max.mustermann@web.de"; // wird später aus session bezogen.
$articleManager->newArticle($_POST['post-title'], $_POST['post-content'], $author);
} catch (Exception $e) {
echo "Fehler beim Erstellen des Beitrags: " . $e->getMessage();
}
?> ?>
+17
View File
@@ -0,0 +1,17 @@
<?php
session_start();
require_once 'php/model/Article.php';
require_once 'php/model/ArticleManager.php';
require_once 'php/model/LocalArticleManager.php';
try {
$articleManager = ArticleManager::getInstance();
// Beziehen der Dummy-Beiträge aus dem ArticleManager:
$dummy1 = $articleManager->getArticle(1);
$dummy2 = $articleManager->getArticle(2);
$dummy3 = $articleManager->getArticle(3);
} catch (Exception $e){
$_SESSION["message"] = "internal_error";
echo "Fehler aufgetreten: " . $e->getMessage();
}
?>
+28
View File
@@ -0,0 +1,28 @@
<?php
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();
}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";
}
?>
+79 -17
View File
@@ -1,5 +1,5 @@
<?php <?php
/* /**
* Klasse: Artikel * Klasse: Artikel
* Diese Klasse stellt alle Daten eines Artikels (Beitrag) bereit * Diese Klasse stellt alle Daten eines Artikels (Beitrag) bereit
* *
@@ -11,65 +11,127 @@ class Article
private $title; private $title;
private $content; private $content;
private $author; private $author;
private $date; private $creationDate;
private $category;
private $tags;
/* /**
* Gibt die ID eines Artikels zurück. * Konstruktor
*
* @param $id integer ID des Beitrages
* @param $title string Titel des Beitrags
* @param $content string Inhalt des Beitrags
* @param $author string der Autor des des Beitrages NID
* @param $category string Kategorie des Beitrages
* @param $tags string optionale Schlagworte für eine bessere Suche
* @param $creationDate string Datum der Beitragserstellung
*/ */
public function getId() public function __construct(int $id, string $title, string $content, string $author, string $category, string $tags, string $creationDate)
{
$this->id = $id;
$this->title = $title;
$this->content = $content;
$this->author = $author;
$this->creationDate = $creationDate;
$this->category = $category;
$this->tags = $tags;
}
/**
* Gibt die ID eines Artikels zurück.
* @return int
*/
public function getId(): int
{ {
return $this->id; return $this->id;
} }
/* /**
* Gibt den Titel eines Artikels zurück. * Gibt den Titel eines Artikels zurück.
* @return string
*/ */
public function getTitle() public function getTitle(): string
{ {
return $this->title; return $this->title;
} }
/* /**
* Setzt den Titel eines Artikels. * Setzt den Titel eines Artikels
* @param $title
* @return void
*/ */
public function setTitle($title) public function setTitle($title)
{ {
$this->title = $title; $this->title = $title;
} }
/* /**
* Gibt den Content eines Artikels zurück. * Gibt den Content eines Artikels zurück.
* TODO: Content muss noch definiert werden. * TODO: Content muss noch definiert werden.
* @return string
*/ */
public function getContent() public function getContent(): string
{ {
return $this->content; return $this->content;
} }
/* /**
* Setzt den Content eines Artikels. * Setzt den Content eines Artikels.
* TODO: Content muss noch definiert werden. * TODO: Content muss noch definiert werden.
* @param $content
* @return void
*/ */
public function setContent($content) public function setContent($content)
{ {
$this->content = $content; $this->content = $content;
} }
/* /**
* Gibt den Autor eines Artikels zurück. * Gibt den Autor eines Artikels zurück.
* @return string
*/ */
public function getAuthor() public function getAuthor(): string
{ {
return $this->author; return $this->author;
} }
/* /**
* Gibt das Veröffentlichungsdatum des Artikels zurück. * Gibt das Veröffentlichungsdatum des Artikels zurück.
* @return string
*/ */
public function getDate() public function getCreationDate(): string
{ {
return $this->date; return $this->creationDate;
} }
/**
* Gibt die Kategorie eines Artikels zurück.
* @return string
*/
public function getCategory(): string
{
return $this->category;
}
/**
* Gibt die Schlagworte eines Artikels zurück.
* @return string
*/
public function getTags(): string
{
return $this->tags;
}
/**
* Setzt die Schlagworte eines Artikels.
* @param string $tags
*/
public function setTags(string $tags)
{
$this->tags = $tags;
}
} }
?> ?>
+33 -63
View File
@@ -1,77 +1,47 @@
<?php <?php
require_once 'ArticleManagerDAO.php'; require_once 'LocalArticleManager.php';
/* require_once 'Article.php';
* Klasse: Eine lokale Lösung der DatenbankDAO.
* schreibt zunächst Daten lokal in das Verzeichnis und kann diese wieder auslesen. /**
* Die Klasse beinhaltet alle Methoden für die Operation mit den Artikel-Daten.
* *
* @author Niklas Ortmann * @author Niklas Ortmann
*/ */
class ArticleManager implements ArticleManagerDAO { class ArticleManager extends LocalArticleManager
/* {
* Gibt die Datenbank-Instanz zurück.
*/
public static function getInstance() public static function getInstance()
{ {
if (self::$instance == null) { $articleManager = LocalArticleManager::getInstance(); // TODO: später durch DataBaseArticleManager ersetzen.
self::$instance = new ArticleManager();
}
return self::$instance; // Erstellen von Dummy-Beiträgen:
} if($articleManager->getArticle(1) == null ){
$articleManager->addArticle(
"Satz des Pythagoras",
/* "Der Satz des Pythagoras wurde von dem griechischen Philosophen Pythagoras von Samos formuliert und im dritten Jahrhundert vor Christus veröffentlicht. In der beigefügten Abbildung sehen wir ein rechtwinkliges Dreieck...",
* Prüft, ob die lokalen txt-Dateien existieren. "max.mustermann",
* Wenn nicht, werden diese erstellt. "Mathe",
*/ "Dreiecke, Dreiecksseiten berechnen"
public function __construct()
{
}
public function newArticle($title, $content, $author, $category) {
$newData = array(
"title" => $title,
"content" => $content,
"author" => $author,
"category" => $category,
//"tags" => isset($_POST["tags"]) ? $_POST["tags"] : '', TODO: Später hinzufügen
"date" => date("d.m.Y, H:i")
); );
$newData = base64_encode(serialize($newData));
if (!file_exists("articles.txt")) {
$newData = fopen("articles.txt", "xb");
fclose($newData);
} }
$previousData = file_get_contents("articles.txt"); if($articleManager->getArticle(2) == null ){
if (file_put_contents("articles.txt", "$newData\n$previousData")) { $articleManager->addArticle(
// TODO: Vernünftige Rückmeldung implementieren. "Tunneleffekt",
echo "Artikel erfolgreich gespeichert!"; "Der Tunneleffekt ist ein quantenmechanisches Phänomen, bei dem Teilchen...",
} else { "max.mustermann",
// TODO: passende Exceptions werfen. "Physik",
echo "Fehler!"; "Quantenphysik, Energie"
);
} }
if($articleManager->getArticle(3) == null ){
$articleManager->addArticle(
"Datenschutz vs Datensicherheit",
"Datenschutz ist in unserer digital vernetzten Welt allgegenwärtig...",
"max.mustermann",
"Informatik",
"Daten, DSGVO"
);
} }
public function updateArticle($id, $title, $content, $author) return $articleManager;
{
// TODO: Implement updateArticle() method.
} }
public function deleteArticle($id)
{
// TODO: Implement deleteArticle() method.
}
public function getArticle($id)
{
// TODO: Implement getArticle() method.
}
public function getAllArticles()
{
// TODO: Implement getAllArticles() method.
}
} }
?>
+15 -14
View File
@@ -1,26 +1,26 @@
<?php <?php
/* require_once "Article.php";
* Die Klasse binhaltet alle Methoden für die Operation auf der Datenbank. /**
* Die Klasse beinhaltet alle Methoden für die Operation mit den Artikel-Daten.
* *
* @author Niklas Ortmann * @author Niklas Ortmann
*/ */
interface ArticleManagerDAO interface ArticleManagerDAO
{ {
/* /**
* Ein angemeldeter Nutzer erstellt einen neuen Beitrag. * Ein angemeldeter Nutzer erstellt einen neuen Beitrag.
* $title Titel des Beitrags * @param $title string Titel des Beitrags
* $content Der Inhalt des Beitrags * @param $content string Inhalt des Beitrags
* $author dem Author des des Beitrags (NID oder email) * @param $author string der Autor des des Beitrages NID
* $category Kategorie des Beitrags * @param $category string Kategorie des Beitrages
* $tags 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 * TODO Fehlerbeschreibung hinzufügen & tags hinzufügen
*/ */
public function newArticle($title, $content, $author, $category); public function addArticle($title, $content, $author, $category, $tags);
/* /**
* Ein angemeldeter Nutzer bearbeitet einen Beitrag. * Ein angemeldeter Nutzer bearbeitet einen Beitrag.
* $id ID des Beitrags * $id ID des Beitrags
* $title Titel des Beitrags * $title Titel des Beitrags
@@ -44,16 +44,17 @@ interface ArticleManagerDAO
*/ */
public function deleteArticle($id); public function deleteArticle($id);
/* /**
* Beitrag aufrufen. * Beitrag aufrufen.
* $id ID des Beitrags * $id ID des Beitrags
* *
* @return Article
* Mögliche Exceptions: * Mögliche Exceptions:
* TODO Fehlerbeschreibung hinzufügen * TODO Fehlerbeschreibung hinzufügen
*/ */
public function getArticle($id); public function getArticle($id);
/* /**
* Alle Beiträge aufrufen. * Alle Beiträge aufrufen.
* *
* Mögliche Exceptions: * Mögliche Exceptions:
+101
View File
@@ -0,0 +1,101 @@
<?php
require_once 'ArticleManagerDAO.php';
require_once 'Article.php';
/**
* Klasse: Eine lokale Lösung des ArticleManagerDAO.
* Schreibt zunächst Daten lokal in das Verzeichnis und kann diese wieder auslesen.
*
* @author Niklas Ortmann
*/
class LocalArticleManager implements ArticleManagerDAO {
private $file;
private static $instance = null;
/**
* Konstruktor
*/
public function __construct()
{
$this->file = __DIR__ . '/../../data/articles.json';
}
/**
* Gibt die LocalArticleManager-Instanz zurück.
* @return LocalArticleManager
*/
public static function getInstance()
{
if (self::$instance == null) {
self::$instance = new LocalArticleManager();
}
return self::$instance;
}
/**
* Speichert alle Artikel/Beiträge in der Datei.
* @param $articles
* @return void
*/
public function saveArticle($articles)
{
file_put_contents(
$this->file,
json_encode($articles, JSON_PRETTY_PRINT)
);
}
public function addArticle($title, $content, $author, $category, $tags)
{
$articles = $this->getAllArticles();
$articles[] = [
"id" => count($articles)+1,
"title" => $title,
"content" => $content,
"author" => $author,
"category" => $category,
"tags" => $tags,
"creationDate" => date("Y-m-d H:i:s")
];
$this->saveArticle($articles);
}
public function updateArticle($id, $title, $content, $author)
{
// TODO: Implement updateArticle() method.
}
public function deleteArticle($id)
{
// TODO: Implement deleteArticle() method.
}
public function getArticle($id)
{
$articles = $this->getAllArticles();
foreach ($articles as $article) {
if (isset($article['id']) && $article['id'] == $id) {
return new Article(intval($article['id']), $article['title'], $article['content'], $article['author'], $article['category'], $article['tags'], $article['creationDate']);
}
}
return null;
}
public function getAllArticles(): array
{
if (!file_exists($this->file)) {
return [];
}
$json = file_get_contents($this->file);
$articles = json_decode($json, true);
return is_array($articles) ? $articles : [];
}
}
?>