Merge branch 'Beitrag-bearbeiten' into dev

This commit is contained in:
2026-06-01 23:14:14 +02:00
17 changed files with 812 additions and 88 deletions
+86 -30
View File
@@ -1,45 +1,101 @@
<?php
include_once 'php/controller/profile-controller.php';
include_once 'php/controller/profileArticles-controller.php';
$user = $user ?? null;
?>
<!--
Content: Profil
Inhalt: Das eigene Profil, wenn man angemeldet ist. Dort hat man die Möglichkeit seine Angaben zu ändern.
-->
<main class="form-page">
<div class="form-container">
<div class="flexbox">
<!-- Linke Spalte: Profildaten -->
<div class="container">
<form>
<label class="input-label">Name</label>
<input type="text"
class="login-input"
readonly
value="<?php echo htmlspecialchars($user["username"] ?? ""); ?>">
<h1>Mein Profil</h1>
<label class="input-label">Email-Adresse</label>
<input type="email"
class="login-input"
readonly
value="<?php echo htmlspecialchars($user["email"] ?? ""); ?>">
<form>
<label class="input-label">Name</label>
<input type="text"
class="login-input"
readonly
value="<?php echo htmlspecialchars($user["username"] ?? ""); ?>">
<label class="input-label">Passwort</label>
<input type="password"
class="login-input"
readonly
value="********">
</form>
<br>
<label class="input-label">Email-Adresse</label>
<input type="email"
class="login-input"
readonly
value="<?php echo htmlspecialchars($user["email"] ?? ""); ?>">
<a href="index.php?pfad=deleteAccount" class="login-button">
Account löschen
</a>
<label class="input-label">Passwort</label>
<input type="password"
class="login-input"
readonly
value="********">
</form>
<br><br>
<br>
<a href="index.php?pfad=logout" class="login-button">
Abmelden
</a>
</div>
<a href="index.php?pfad=deleteAccount" class="login-button">
Account löschen
</a>
<br><br>
<a href="index.php?pfad=logout" class="login-button">
Abmelden
</a>
<!-- 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>