AdminForm in UserAccountPage gemergt

This commit is contained in:
2025-07-09 11:11:30 +02:00
parent 7ce389d179
commit 449dd10302
8 changed files with 129 additions and 170 deletions

View File

@@ -1,7 +1,3 @@
<?php
include dirname(__DIR__).'/header.phtml';
?>
<h2>Neuer Kurs</h2>
<form method="post">
<?php
@@ -30,25 +26,25 @@ function createInputField($label, $name, $errors, $validData, $type = 'input') {
}
echo '<div style="margin-top: 32px;" class="form-grid-3">';
foreach ($labels as $name => $label) {
if($name === "|") {
if($label === "|") {
echo '</div>';
echo '<div style="margin-top: 32px;" class="form-grid-3">';
} else {
echo createInputField($label, $name, $errors, $validData, $type = $name === 'beschreibung' ? 'textarea' : 'input');
}
}
}
echo '</div>';
?>
<input type="hidden" name="controller" value="admin">
<input type="hidden" name="do" value="validateForm">
<input type="hidden" name="controller" value="user">
<input type="hidden" name="do" value="validateKursForm">
<div class="form-grid-3" style="margin-top: 16px;">
<input style="grid-column: 3;" type="submit" name="submit" value="Absenden">
</div>
</form>
<?php
$adminModel = new \Blog\Model\AdminModel();
$courses = $adminModel->getMyCourses();
$userModel = new \Blog\Model\UserModel();
$courses = $userModel->getMyCourses();
$doc = new DOMDocument('1.0', 'UTF-8');
if (!empty($courses)) {
@@ -95,5 +91,3 @@ if (!empty($courses)) {
echo '<p>Keine Kurse gefunden.</p>';
}
?>
<?php include dirname(__DIR__).'/footer.phtml'; ?>

View File

@@ -30,5 +30,13 @@
</div>
</div>
</div>
<?php
if(isset($_SESSION["user_id"]) && $_SESSION["user_id"] != null) {
include dirname(__DIR__).'/User/showAdminForm.phtml';
}
?>
</div>
</article>
</article>
<?php include dirname(__DIR__).'/footer.phtml'; ?>

View File

@@ -20,21 +20,12 @@
<div style="column-gap: 8px;" class="d-flex-between">
<div style="column-gap: 8px;" class="d-flex-between">
<?php if (isset($_SESSION['user_id']) && $_SESSION['user_id'] !== null): ?>
<?php if($_SESSION['user_role'] == 'leiter'): ?>
<a style="column-gap: 16px;" class="btn" href="?controller=Admin&do=showAdminForm">
<?php echo ($_SESSION['vorname'] ?? "") . " " . ($_SESSION['name'] ?? "") . ", " . ($_SESSION['user_role']) ?>
<span class="btn btn-user">
<span class="material-icons">person</span>
</span>
</a>
<?php else: ?>
<a style="column-gap: 16px;" class="btn" href="?controller=User&do=showUserAccountPage">
<?php echo ($_SESSION['vorname'] ?? "") . " " . ($_SESSION['name'] ?? "") . ", " . ($_SESSION['user_role']) ?>
<span class="btn btn-user">
<span class="material-icons">person</span>
</span>
</a>
<?php endif; ?>
<?php else: ?>
<a class="btn" href="?controller=User&do=showUserLoginForm">Anmeldung</a>
<a class="btn btn-primary" href="?controller=User&do=showUserRegisterForm">Registration</a>