new.php

Code Hygiene Score: 100

Keine Issues gefunden.

Versionen 3

Code

<?php

declare(strict_types=1);

// @responsibility: View für neue Entität mit HTMX-Formular

ob_start();
?>

<nav class="breadcrumb">
    <a href="/">Campus KI</a> &raquo;
    <a href="/semantic-explorer">Semantic Explorer</a> &raquo;
    <a href="/semantic-explorer/entitaeten">Entitäten</a> &raquo; Neu
</nav>

<h1>Neue Entität</h1>

<form id="entity-form" class="form" style="max-width: 600px;"
      hx-post="/semantic-explorer/entitaeten"
      hx-headers='{"X-CSRF-TOKEN": "<?= $csrfToken ?>"}'
      hx-disabled-elt="button[type=submit]">
    <div class="form-group">
        <label for="name">Name *</label>
        <input type="text" id="name" name="name" class="form-input" required>
    </div>

    <div class="form-group">
        <label for="type">Typ *</label>
        <select id="type" name="type" class="form-select" required>
            <?php foreach ($types as $t): ?>
            <option value="<?= htmlspecialchars($t) ?>"><?= ucfirst(htmlspecialchars($t)) ?></option>
            <?php endforeach; ?>
        </select>
    </div>

    <div class="form-group">
        <label for="description">Beschreibung</label>
        <textarea id="description" name="description" class="form-textarea" rows="4"></textarea>
    </div>

    <div class="form-actions">
        <button type="submit" class="btn btn--primary">Entität erstellen</button>
        <a href="/semantic-explorer/entitaeten" class="btn">Abbrechen</a>
    </div>
</form>

<?php $content = ob_get_clean(); ?>
<?php require VIEW_PATH . '/layout.php'; ?>
← Übersicht