119 lines
5.5 KiB
PHP
119 lines
5.5 KiB
PHP
<?php
|
|
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 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_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"] == "invalid_title"): ?>
|
|
<p class="alert-message is-error">
|
|
Der Titel enthält ungültige Zeichen oder erfüllt die Länge von 5-120 Zeichen nicht.
|
|
</p>
|
|
<?php endif; ?>
|
|
<?php if (isset($_SESSION["message"]) && $_SESSION["message"] == "invalid_content"): ?>
|
|
<p class="alert-message is-error">
|
|
Der Text erlaubt eine Länge von 10 bis maximal 7.000 Zeichen (ca. 1.000 Wörter).
|
|
</p>
|
|
<?php endif; ?>
|
|
<?php if (isset($_SESSION["message"]) && $_SESSION["message"] == "invalid_category"): ?>
|
|
<p class="alert-message is-error">
|
|
Die ausgewählte Kategorie ist ungültig.
|
|
</p>
|
|
<?php endif; ?>
|
|
<?php if (isset($_SESSION["message"]) && $_SESSION["message"] == "invalid_tags"): ?>
|
|
<p class="alert-message is-error">
|
|
Ungültige Schlagworte gefunden. Erlaubt sind nur Buchstaben, Zahlen, Leerzeichen und Bindestriche (2-20 Zeichen).
|
|
</p>
|
|
<?php endif; ?>
|
|
<?php if (isset($_SESSION["message"]) && $_SESSION["message"] == "validation_missing"): ?>
|
|
<p class="alert-message is-error">
|
|
Bei der Validierung deiner Daten ist ein Fehler aufgetreten. Bitte versuche es erneut.
|
|
</p>
|
|
<?php endif; ?>
|
|
<?php
|
|
unset($_SESSION["message"]);
|
|
?>
|
|
<input type="text" id="title" name="title"
|
|
value="<?php echo htmlspecialchars($_SESSION['old_title'] ?? ''); unset($_SESSION['old_title']); ?>"
|
|
placeholder="Titel hier eingeben" required>
|
|
<textarea id="content" name="content" placeholder="Schreibe deinen Beitrag...">
|
|
<?php echo htmlspecialchars($_SESSION['old_content'] ?? ''); unset($_SESSION['old_content']); ?>
|
|
</textarea>
|
|
</main>
|
|
|
|
<!-- Seitenleiste -->
|
|
<aside class="editor-sidebar">
|
|
|
|
<div class="sidebar-block">
|
|
<button type="submit" class="btn-publish">Veröffentlichen</button>
|
|
</div>
|
|
|
|
<div class="sidebar-block">
|
|
<label for="category">Kategorie <span class="required">*</span></label>
|
|
<select id="category" name="category" required>
|
|
<option value="" 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 echo htmlspecialchars($_SESSION['old_tags'] ?? ''); unset($_SESSION['old_tags']); ?>"
|
|
placeholder="z.B. Technik, IT (mit Komma trennen)">
|
|
</div>
|
|
|
|
</aside>
|
|
|
|
</form>
|