Backup #1726

ID1726
Dateipfad/var/www/dev.campus.systemische-tools.de/src/View/semantic-explorer/relationen/edit.php
Version1
Typ modified
Größe2.8 KB
Hashe6064250d0bd59f8aa2705f33e555fc8085ef7f52747e549796e018fddd52316
Datum2025-12-27 12:35:12
Geändert vonclaude-code-hook
GrundClaude Code Pre-Hook Backup vor Write-Operation
Datei existiert Ja

Dateiinhalt

<?php ob_start(); ?>

<nav class="breadcrumb">
    <a href="/semantic-explorer">Semantic Explorer</a> &raquo;
    <a href="/semantic-explorer/relationen">Relationen</a> &raquo; Bearbeiten
</nav>

<h1>Relation bearbeiten</h1>
<p><?= htmlspecialchars($relation['source_name']) ?> &rarr; <?= htmlspecialchars($relation['target_name']) ?></p>

<form id="relation-form" class="form" style="max-width: 600px;">
    <div class="form-group">
        <label for="relation_type">Beziehungstyp *</label>
        <select id="relation_type" name="relation_type" class="form-select" required>
            <?php foreach ($relationTypes as $t): ?>
            <option value="<?= htmlspecialchars($t) ?>"
                <?= $relation['relation_type'] === $t ? 'selected' : '' ?>><?= htmlspecialchars($t) ?></option>
            <?php endforeach; ?>
        </select>
    </div>

    <div class="form-group">
        <label for="strength">Staerke (0.0 - 1.0)</label>
        <input type="number" id="strength" name="strength" class="form-input"
               min="0" max="1" step="0.1" value="<?= htmlspecialchars($relation['strength']) ?>">
    </div>

    <div class="form-actions">
        <button type="submit" class="btn btn--primary">Speichern</button>
        <a href="/semantic-explorer/relationen" class="btn">Abbrechen</a>
        <button type="button" id="delete-btn" class="btn btn--danger" style="margin-left: auto;">Loeschen</button>
    </div>
</form>
<div id="form-message" class="form-message"></div>

<script>
document.getElementById('relation-form').addEventListener('submit', async (e) => {
    e.preventDefault();
    const form = e.target;
    const formData = new FormData(form);
    const data = Object.fromEntries(formData.entries());

    const response = await fetch('/semantic-explorer/relationen/<?= $relation['id'] ?>', {
        method: 'POST',
        headers: {'Content-Type': 'application/json'},
        body: JSON.stringify(data)
    });
    const result = await response.json();

    if (result.success) {
        window.location.href = '/semantic-explorer/relationen';
    } else {
        document.getElementById('form-message').innerHTML =
            '<span class="form-message--error">Fehler: ' + result.error + '</span>';
    }
});

document.getElementById('delete-btn').addEventListener('click', async () => {
    if (!confirm('Relation wirklich loeschen?')) return;

    const response = await fetch('/semantic-explorer/relationen/<?= $relation['id'] ?>/delete', {
        method: 'POST'
    });
    const result = await response.json();

    if (result.success) {
        window.location.href = '/semantic-explorer/relationen';
    } else {
        document.getElementById('form-message').innerHTML =
            '<span class="form-message--error">Fehler: ' + result.error + '</span>';
    }
});
</script>

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

Vollständig herunterladen

Aktionen

Herunterladen

← Zurück zur Übersicht