|
@@ -6,7 +6,7 @@ $form_created = false;
|
|
|
$output_links = [];
|
|
$output_links = [];
|
|
|
|
|
|
|
|
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
|
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
|
|
- $title = trim($_POST['title'] ?? 'Untitled Form');
|
|
|
|
|
|
|
+ $title = trim($_POST['title'] ?? 'Unbenanntes Formular');
|
|
|
$description = trim($_POST['description'] ?? '');
|
|
$description = trim($_POST['description'] ?? '');
|
|
|
$admin_email = trim($_POST['admin_email'] ?? '');
|
|
$admin_email = trim($_POST['admin_email'] ?? '');
|
|
|
$questions_json = $_POST['questions'] ?? '[]';
|
|
$questions_json = $_POST['questions'] ?? '[]';
|
|
@@ -14,7 +14,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
|
|
$questions = json_decode($questions_json, true);
|
|
$questions = json_decode($questions_json, true);
|
|
|
|
|
|
|
|
if (empty($questions) || !is_array($questions)) {
|
|
if (empty($questions) || !is_array($questions)) {
|
|
|
- $message = '<div class="alert alert-error">Please add at least one question.</div>';
|
|
|
|
|
|
|
+ $message = '<div class="alert alert-error">Bitte fügen Sie mindestens eine Frage hinzu.</div>';
|
|
|
} else {
|
|
} else {
|
|
|
$form_id = uniqid('form_');
|
|
$form_id = uniqid('form_');
|
|
|
$admin_token = bin2hex(random_bytes(16));
|
|
$admin_token = bin2hex(random_bytes(16));
|
|
@@ -53,11 +53,11 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
|
|
|
|
|
|
|
// Send email if provided
|
|
// Send email if provided
|
|
|
if (!empty($admin_email) && filter_var($admin_email, FILTER_VALIDATE_EMAIL)) {
|
|
if (!empty($admin_email) && filter_var($admin_email, FILTER_VALIDATE_EMAIL)) {
|
|
|
- $subject = "Your Intranet Form is Ready: $title";
|
|
|
|
|
- $email_body = "Hello,\n\nYour form '$title' has been created.\n\n";
|
|
|
|
|
- $email_body .= "Public Link for respondents:\n$answer_link\n\n";
|
|
|
|
|
- $email_body .= "Secret Admin Link for you to view responses:\n$admin_link\n\n";
|
|
|
|
|
- $email_body .= "Do not share the admin link.\n\nThank you.";
|
|
|
|
|
|
|
+ $subject = "Ihr Intranet Formular ist bereit: $title";
|
|
|
|
|
+ $email_body = "Guten Tag,\n\nIhr Formular '$title' wurde erfolgreich erstellt.\n\n";
|
|
|
|
|
+ $email_body .= "Öffentlicher Link (zum Teilen):\n$answer_link\n\n";
|
|
|
|
|
+ $email_body .= "Geheimer Admin-Link (für Antworten):\n$admin_link\n\n";
|
|
|
|
|
+ $email_body .= "Bitte geben Sie den Admin-Link nicht weiter.\n\nVielen Dank.";
|
|
|
$headers = "From: no-reply@" . $host . "\r\n";
|
|
$headers = "From: no-reply@" . $host . "\r\n";
|
|
|
@mail($admin_email, $subject, $email_body, $headers);
|
|
@mail($admin_email, $subject, $email_body, $headers);
|
|
|
}
|
|
}
|
|
@@ -67,18 +67,18 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
|
|
}
|
|
}
|
|
|
?>
|
|
?>
|
|
|
<!DOCTYPE html>
|
|
<!DOCTYPE html>
|
|
|
-<html lang="en">
|
|
|
|
|
|
|
+<html lang="de">
|
|
|
<head>
|
|
<head>
|
|
|
<meta charset="UTF-8">
|
|
<meta charset="UTF-8">
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
|
- <title>Create Form</title>
|
|
|
|
|
|
|
+ <title>Formular erstellen</title>
|
|
|
<link rel="stylesheet" href="assets/css/style.css">
|
|
<link rel="stylesheet" href="assets/css/style.css">
|
|
|
</head>
|
|
</head>
|
|
|
<body>
|
|
<body>
|
|
|
<header class="site-header">
|
|
<header class="site-header">
|
|
|
<div class="container header-inner">
|
|
<div class="container header-inner">
|
|
|
<div class="brand">
|
|
<div class="brand">
|
|
|
- <a href="index.php" class="brand-title" style="color:white;">Intranet Forms</a>
|
|
|
|
|
|
|
+ <a href="index.php" class="brand-title" style="color:white;">Intranet Formulare</a>
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
</header>
|
|
</header>
|
|
@@ -86,23 +86,23 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
|
|
<main class="container">
|
|
<main class="container">
|
|
|
<?php if ($form_created): ?>
|
|
<?php if ($form_created): ?>
|
|
|
<div class="panel">
|
|
<div class="panel">
|
|
|
- <h2 class="card-title" style="color: var(--brand-accent)">Form Created Successfully!</h2>
|
|
|
|
|
|
|
+ <h2 class="card-title" style="color: var(--brand-accent)">Formular erfolgreich erstellt!</h2>
|
|
|
<div class="alert alert-success mt-2">
|
|
<div class="alert alert-success mt-2">
|
|
|
- <strong>Public Answering Link (Share this):</strong><br>
|
|
|
|
|
|
|
+ <strong>Öffentlicher Link (um Antworten zu sammeln):</strong><br>
|
|
|
<a href="<?= htmlspecialchars($output_links['answer']) ?>" target="_blank"><?= htmlspecialchars($output_links['answer']) ?></a>
|
|
<a href="<?= htmlspecialchars($output_links['answer']) ?>" target="_blank"><?= htmlspecialchars($output_links['answer']) ?></a>
|
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
<div class="alert alert-info mt-2">
|
|
<div class="alert alert-info mt-2">
|
|
|
- <strong>Secret Admin Link (Keep this safe):</strong><br>
|
|
|
|
|
|
|
+ <strong>Geheimer Admin-Link (Muss sicher aufbewahrt werden):</strong><br>
|
|
|
<a href="<?= htmlspecialchars($output_links['admin']) ?>" target="_blank"><?= htmlspecialchars($output_links['admin']) ?></a>
|
|
<a href="<?= htmlspecialchars($output_links['admin']) ?>" target="_blank"><?= htmlspecialchars($output_links['admin']) ?></a>
|
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
<?php if (!empty($admin_email)): ?>
|
|
<?php if (!empty($admin_email)): ?>
|
|
|
- <p class="mt-2 text-center text-muted">A notification with these links has been sent to <?= htmlspecialchars($admin_email) ?></p>
|
|
|
|
|
|
|
+ <p class="mt-2 text-center text-muted">Eine Benachrichtigung mit diesen Links wurde an <?= htmlspecialchars($admin_email) ?> gesendet.</p>
|
|
|
<?php endif; ?>
|
|
<?php endif; ?>
|
|
|
|
|
|
|
|
<div class="mt-3 text-center">
|
|
<div class="mt-3 text-center">
|
|
|
- <a href="index.php" class="btn btn-secondary">Return Home</a>
|
|
|
|
|
|
|
+ <a href="index.php" class="btn btn-secondary">Zurück zur Startseite</a>
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
<?php else: ?>
|
|
<?php else: ?>
|
|
@@ -111,43 +111,43 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
|
|
|
|
|
|
|
<form method="POST" id="form-builder-form">
|
|
<form method="POST" id="form-builder-form">
|
|
|
<div class="panel">
|
|
<div class="panel">
|
|
|
- <h2 class="card-title">Form Settings</h2>
|
|
|
|
|
|
|
+ <h2 class="card-title">Formulareinstellungen</h2>
|
|
|
<div class="form-group">
|
|
<div class="form-group">
|
|
|
- <label for="title">Form Title *</label>
|
|
|
|
|
- <input type="text" id="title" name="title" required placeholder="e.g. Employee Satisfaction Survey">
|
|
|
|
|
|
|
+ <label for="title">Formulartitel *</label>
|
|
|
|
|
+ <input type="text" id="title" name="title" required placeholder="z.B. Mitarbeiterbefragung">
|
|
|
</div>
|
|
</div>
|
|
|
<div class="form-group">
|
|
<div class="form-group">
|
|
|
- <label for="description">Description (Optional)</label>
|
|
|
|
|
- <textarea id="description" name="description" rows="3" placeholder="Explain the purpose of this form"></textarea>
|
|
|
|
|
|
|
+ <label for="description">Beschreibung (Optional)</label>
|
|
|
|
|
+ <textarea id="description" name="description" rows="3" placeholder="Erklären Sie den Zweck dieses Formulars"></textarea>
|
|
|
</div>
|
|
</div>
|
|
|
<div class="form-group">
|
|
<div class="form-group">
|
|
|
- <label for="admin_email">Admin Email (Optional)</label>
|
|
|
|
|
- <input type="email" id="admin_email" name="admin_email" placeholder="We'll send the admin link here">
|
|
|
|
|
|
|
+ <label for="admin_email">Admin-E-Mail (Optional)</label>
|
|
|
|
|
+ <input type="email" id="admin_email" name="admin_email" placeholder="Wir senden den Admin-Link hierher">
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
<div class="panel">
|
|
<div class="panel">
|
|
|
<div style="display:flex; justify-content:space-between; align-items:center; margin-bottom: 1rem; flex-wrap:wrap; gap: 0.5rem">
|
|
<div style="display:flex; justify-content:space-between; align-items:center; margin-bottom: 1rem; flex-wrap:wrap; gap: 0.5rem">
|
|
|
- <h2 class="card-title">Questions</h2>
|
|
|
|
|
|
|
+ <h2 class="card-title">Fragen</h2>
|
|
|
<div>
|
|
<div>
|
|
|
<button type="button" class="btn btn-small btn-secondary text-center mb-1" onclick="addQuestion('text')">+ Text</button>
|
|
<button type="button" class="btn btn-small btn-secondary text-center mb-1" onclick="addQuestion('text')">+ Text</button>
|
|
|
- <button type="button" class="btn btn-small btn-secondary text-center mb-1" onclick="addQuestion('textarea')">+ Text Area</button>
|
|
|
|
|
- <button type="button" class="btn btn-small btn-secondary text-center mb-1" onclick="addQuestion('single_choice')">+ Single Choice</button>
|
|
|
|
|
- <button type="button" class="btn btn-small btn-secondary text-center mb-1" onclick="addQuestion('multiple_choice')">+ Multi Choice</button>
|
|
|
|
|
|
|
+ <button type="button" class="btn btn-small btn-secondary text-center mb-1" onclick="addQuestion('textarea')">+ Textbereich</button>
|
|
|
|
|
+ <button type="button" class="btn btn-small btn-secondary text-center mb-1" onclick="addQuestion('single_choice')">+ Einzelauswahl</button>
|
|
|
|
|
+ <button type="button" class="btn btn-small btn-secondary text-center mb-1" onclick="addQuestion('multiple_choice')">+ Mehrfachauswahl</button>
|
|
|
<button type="button" class="btn btn-small btn-secondary text-center mb-1" onclick="addQuestion('dropdown')">+ Dropdown</button>
|
|
<button type="button" class="btn btn-small btn-secondary text-center mb-1" onclick="addQuestion('dropdown')">+ Dropdown</button>
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
<div id="builder-canvas">
|
|
<div id="builder-canvas">
|
|
|
- <div class="alert alert-info" id="empty-state">No questions added yet. Use the buttons above to add one.</div>
|
|
|
|
|
|
|
+ <div class="alert alert-info" id="empty-state">Noch keine Fragen hinzugefügt. Verwenden Sie die Schaltflächen oben, um eine Frage hinzuzufügen.</div>
|
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
<input type="hidden" name="questions" id="questions_input" value="[]">
|
|
<input type="hidden" name="questions" id="questions_input" value="[]">
|
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
<div class="panel" style="text-align: right;">
|
|
<div class="panel" style="text-align: right;">
|
|
|
- <a href="index.php" class="btn btn-secondary">Cancel</a>
|
|
|
|
|
- <button type="submit" class="btn" style="margin-left: 10px;" onclick="prepareSubmission(event)">Save Form</button>
|
|
|
|
|
|
|
+ <a href="index.php" class="btn btn-secondary">Abbrechen</a>
|
|
|
|
|
+ <button type="submit" class="btn" style="margin-left: 10px;" onclick="prepareSubmission(event)">Speichern</button>
|
|
|
</div>
|
|
</div>
|
|
|
</form>
|
|
</form>
|
|
|
<?php endif; ?>
|
|
<?php endif; ?>
|