Feature/languages #4

Merged
deepDiverPaul merged 6 commits from feature/languages into main 2026-11-24 17:53:30 +00:00
11 changed files with 70 additions and 112 deletions
Showing only changes of commit 80e60d6823 - Show all commits
-21
View File
@@ -1,21 +0,0 @@
MIT License
Copyright (c) 2023 Paul Spenke
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
@@ -8,7 +8,7 @@ class SendEmailToAdmin extends DefaultFinisher
public function execute(): bool public function execute(): bool
{ {
$to = Extensions::getSettings('form')['email']['value']; $to = Extensions::getSettings('form')['email']['value'];
$subject = 'Formulareinsendung: '.$this->getFormName(); $subject = 'Form submission: '.$this->getFormName();
$message = $this->getNiceFields(); $message = $this->getNiceFields();
return mail( return mail(
$to, $to,
@@ -4,11 +4,11 @@ return [
'finishers' => [ 'finishers' => [
'saveToDatabase' => [ 'saveToDatabase' => [
'class' => \Plugi\Extensions\Form\Finishers\SaveEntryToDatabase::class, 'class' => \Plugi\Extensions\Form\Finishers\SaveEntryToDatabase::class,
'label' => 'In Datenbank speichern' 'label' => 'Save to database'
], ],
'sendMailToAdmin' => [ 'sendMailToAdmin' => [
'class' => \Plugi\Extensions\Form\Finishers\SendEmailToAdmin::class, 'class' => \Plugi\Extensions\Form\Finishers\SendEmailToAdmin::class,
'label' => 'Email an Admin senden' 'label' => 'Send email to admin'
] ]
] ]
]; ];
@@ -5,7 +5,7 @@ use Plugi\Extensions\Form\DefinitionsRepository;
$formsRepository = new DefinitionsRepository(); $formsRepository = new DefinitionsRepository();
$form = [ $form = [
'name' => "Neues Formular", 'name' => "New Form",
'fields' => "[]", 'fields' => "[]",
'finishers' => "[]", 'finishers' => "[]",
]; ];
@@ -22,8 +22,8 @@ $isEditing = isset($form['id']) && $form['id'] > 0;
<i class="ph-duotone ph-arrow-left text-xl"></i> <i class="ph-duotone ph-arrow-left text-xl"></i>
</a> </a>
<div> <div>
<h2 class="text-xl font-bold"><?= $isEditing ? 'Formular bearbeiten' : 'Neues Formular' ?></h2> <h2 class="text-xl font-bold"><?= $isEditing ? 'Edit form' : 'New form' ?></h2>
<p class="text-sm text-base-content/60"><?= $isEditing ? 'Ändere die Einstellungen deines Formulars.' : 'Erstelle ein neues Formular mit Feldern und Aktionen.' ?></p> <p class="text-sm text-base-content/60"><?= $isEditing ? 'Change your form settings.' : 'Create a new form with fields and actions.' ?></p>
</div> </div>
</div> </div>
</div> </div>
@@ -36,14 +36,14 @@ $isEditing = isset($form['id']) && $form['id'] > 0;
<form action="/ext--form/save-form" method="post" x-data="{ <form action="/ext--form/save-form" method="post" x-data="{
fields: fields, fields: fields,
finishers: finishers, finishers: finishers,
defaultField: {name: 'formularfeld', label: 'Formularfeld', type: 'text', required: false, options: []}, defaultField: {name: 'form_field', label: 'Form field', type: 'text', required: false, options: []},
defaultFinisher: {type: 'saveToDatabase'}, defaultFinisher: {type: 'saveToDatabase'},
dragIndex: null, dragIndex: null,
addField() { addField() {
const nextNum = this.fields.length + 1; const nextNum = this.fields.length + 1;
this.fields.push({ this.fields.push({
name: 'feld_' + nextNum, name: 'field_' + nextNum,
label: 'Feld ' + nextNum, label: 'Field ' + nextNum,
type: 'text', type: 'text',
required: false, required: false,
options: [] options: []
@@ -52,23 +52,23 @@ $isEditing = isset($form['id']) && $form['id'] > 0;
getValidationErrors(field, index) { getValidationErrors(field, index) {
const errors = []; const errors = [];
if (!field.name || !field.name.trim()) { if (!field.name || !field.name.trim()) {
errors.push('Feldname darf nicht leer sein.'); errors.push('Field name cannot be empty.');
} }
if (!field.label || !field.label.trim()) { if (!field.label || !field.label.trim()) {
errors.push('Beschriftung darf nicht leer sein.'); errors.push('Label cannot be empty.');
} }
// Check for duplicate names // Check for duplicate names
const nameCount = this.fields.filter((f, i) => i !== index && f.name && f.name.trim() === field.name && field.name.trim() !== '').length; const nameCount = this.fields.filter((f, i) => i !== index && f.name && f.name.trim() === field.name && field.name.trim() !== '').length;
if (nameCount > 0) { if (nameCount > 0) {
errors.push('Feldname wird bereits verwendet.'); errors.push('Field name is already in use.');
} }
return errors; return errors;
}, },
getOptionsLabel(type) { getOptionsLabel(type) {
if (type === 'select') return 'Dropdown-Optionen'; if (type === 'select') return 'Dropdown options';
if (type === 'checkbox') return 'Checkbox-Optionen (mehrfach wählbar)'; if (type === 'checkbox') return 'Checkbox options (multiple selections)';
if (type === 'radio') return 'Radio-Optionen (einzeln wählbar)'; if (type === 'radio') return 'Radio options (single selection)';
return 'Optionen'; return 'Options';
}, },
moveField(fromIndex, toIndex) { moveField(fromIndex, toIndex) {
if (toIndex < 0 || toIndex >= this.fields.length) return; if (toIndex < 0 || toIndex >= this.fields.length) return;
@@ -84,14 +84,14 @@ $isEditing = isset($form['id']) && $form['id'] > 0;
<div class="card-body"> <div class="card-body">
<div class="flex items-center gap-2 mb-4"> <div class="flex items-center gap-2 mb-4">
<i class="ph-duotone ph-text-aa text-2xl text-base-content/60"></i> <i class="ph-duotone ph-text-aa text-2xl text-base-content/60"></i>
<h3 class="card-title text-lg">Grundlegendes</h3> <h3 class="card-title text-lg">Basics</h3>
</div> </div>
<div class="form-control"> <div class="form-control">
<label class="label"> <label class="label">
<span class="label-text font-medium">Formularname</span> <span class="label-text font-medium">Form name</span>
</label> </label>
<input type="text" name="name" value="<?= $form['name'] ?>" placeholder="z.B. Kontaktformular" class="input input-bordered w-full" required /> <input type="text" name="name" value="<?= $form['name'] ?>" placeholder="e.g. Contact form" class="input input-bordered w-full" required />
<span class="label-text-alt text-base-content/60">Ein eindeutiger Name für dein Formular.</span> <span class="label-text-alt text-base-content/60">A unique name for your form.</span>
</div> </div>
</div> </div>
</div> </div>
@@ -100,16 +100,16 @@ $isEditing = isset($form['id']) && $form['id'] > 0;
<div class="card-body"> <div class="card-body">
<div class="flex items-center gap-2 mb-4"> <div class="flex items-center gap-2 mb-4">
<i class="ph-duotone ph-list-dashes text-2xl text-base-content/60"></i> <i class="ph-duotone ph-list-dashes text-2xl text-base-content/60"></i>
<h3 class="card-title text-lg">Formularfelder</h3> <h3 class="card-title text-lg">Form fields</h3>
</div> </div>
<p class="text-sm text-base-content/60 mb-4">Definiere die Felder, die Nutzer ausfüllen können.</p> <p class="text-sm text-base-content/60 mb-4">Define the fields users can fill out.</p>
<input type="hidden" name="fields" :value="JSON.stringify(fields)"> <input type="hidden" name="fields" :value="JSON.stringify(fields)">
<div x-show="fields.length === 0" class="text-center py-8 border-2 border-dashed border-base-300 rounded-lg"> <div x-show="fields.length === 0" class="text-center py-8 border-2 border-dashed border-base-300 rounded-lg">
<i class="ph-duotone ph-plus-circle text-4xl text-base-content/30"></i> <i class="ph-duotone ph-plus-circle text-4xl text-base-content/30"></i>
<p class="text-sm text-base-content/50 mt-2">Noch keine Felder hinzugefügt</p> <p class="text-sm text-base-content/50 mt-2">No fields added yet</p>
<a href="javascript:void(0)" @click="addField()" class="btn btn-sm btn-primary mt-2">Erstes Feld hinzufügen</a> <a href="javascript:void(0)" @click="addField()" class="btn btn-sm btn-primary mt-2">Add your first field</a>
</div> </div>
<div x-show="fields.length > 0" class="space-y-3"> <div x-show="fields.length > 0" class="space-y-3">
@@ -129,7 +129,7 @@ $isEditing = isset($form['id']) && $form['id'] > 0;
> >
<div class="flex items-center gap-2 mb-2"> <div class="flex items-center gap-2 mb-2">
<!-- Drag handle --> <!-- Drag handle -->
<button type="button" class="btn btn-ghost btn-xs btn-square cursor-grab active:cursor-grabbing text-base-content/40 hover:text-base-content" title="Ziehen zum Verschieben"> <button type="button" class="btn btn-ghost btn-xs btn-square cursor-grab active:cursor-grabbing text-base-content/40 hover:text-base-content" title="Drag to move">
<i class="ph-duotone ph-dots-six-vertical text-lg"></i> <i class="ph-duotone ph-dots-six-vertical text-lg"></i>
</button> </button>
<span class="text-xs font-mono text-base-content/40 w-6">#[<span x-text="index + 1"></span>]</span> <span class="text-xs font-mono text-base-content/40 w-6">#[<span x-text="index + 1"></span>]</span>
@@ -137,18 +137,18 @@ $isEditing = isset($form['id']) && $form['id'] > 0;
<input <input
type="text" type="text"
x-model="field.name" x-model="field.name"
placeholder="Feldname" placeholder="Field name"
class="input input-bordered input-sm w-full" class="input input-bordered input-sm w-full"
:class="{'input-error': getValidationErrors(field, index).some(e => e.includes('Feldname'))}" :class="{'input-error': getValidationErrors(field, index).some(e => e.includes('Field name'))}"
/> />
</div> </div>
<div class="flex-1"> <div class="flex-1">
<input <input
type="text" type="text"
x-model="field.label" x-model="field.label"
placeholder="Beschriftung" placeholder="Label"
class="input input-bordered input-sm w-full" class="input input-bordered input-sm w-full"
:class="{'input-error': getValidationErrors(field, index).some(e => e.includes('Beschriftung'))}" :class="{'input-error': getValidationErrors(field, index).some(e => e.includes('Label'))}"
/> />
</div> </div>
</div> </div>
@@ -165,16 +165,16 @@ $isEditing = isset($form['id']) && $form['id'] > 0;
<select x-model="field.type" class="select select-bordered select-sm flex-1"> <select x-model="field.type" class="select select-bordered select-sm flex-1">
<option value="text">Text</option> <option value="text">Text</option>
<option value="email">Email</option> <option value="email">Email</option>
<option value="textarea">Textbereich</option> <option value="textarea">Text area</option>
<option value="checkbox">Checkbox</option> <option value="checkbox">Checkbox</option>
<option value="radio">Radio</option> <option value="radio">Radio</option>
<option value="select">Auswahl</option> <option value="select">Select</option>
</select> </select>
<label class="label cursor-pointer gap-2"> <label class="label cursor-pointer gap-2">
<span class="label-text text-sm">Pflichtfeld</span> <span class="label-text text-sm">Required</span>
<input type="checkbox" x-model="field.required" class="checkbox checkbox-sm checkbox-primary" /> <input type="checkbox" x-model="field.required" class="checkbox checkbox-sm checkbox-primary" />
</label> </label>
<button @click="fields.splice(index, 1)" type="button" class="btn btn-ghost btn-sm btn-circle text-error" title="Entfernen"> <button @click="fields.splice(index, 1)" type="button" class="btn btn-ghost btn-sm btn-circle text-error" title="Remove">
<i class="ph-duotone ph-trash"></i> <i class="ph-duotone ph-trash"></i>
</button> </button>
</div> </div>
@@ -183,16 +183,16 @@ $isEditing = isset($form['id']) && $form['id'] > 0;
<span class="text-xs font-medium text-base-content/60 uppercase tracking-wide" x-text="getOptionsLabel(field.type)"></span> <span class="text-xs font-medium text-base-content/60 uppercase tracking-wide" x-text="getOptionsLabel(field.type)"></span>
<a href="javascript:void(0)" @click="field.options.push({label: 'Option', value: 'option'})" class="btn btn-xs btn-ghost btn-primary"> <a href="javascript:void(0)" @click="field.options.push({label: 'Option', value: 'option'})" class="btn btn-xs btn-ghost btn-primary">
<i class="ph-duotone ph-plus"></i> <i class="ph-duotone ph-plus"></i>
Neu Add
</a> </a>
</div> </div>
<div class="space-y-1"> <div class="space-y-1">
<template x-for="(option, optIndex) in field.options"> <template x-for="(option, optIndex) in field.options">
<div class="flex items-center gap-2"> <div class="flex items-center gap-2">
<span class="text-xs text-base-content/40 w-4">#[<span x-text="optIndex + 1"></span>]</span> <span class="text-xs text-base-content/40 w-4">#[<span x-text="optIndex + 1"></span>]</span>
<input type="text" x-model="option.label" placeholder="Beschriftung" class="input input-bordered input-sm flex-1" /> <input type="text" x-model="option.label" placeholder="Label" class="input input-bordered input-sm flex-1" />
<input type="text" x-model="option.value" placeholder="Wert" class="input input-bordered input-sm flex-1" /> <input type="text" x-model="option.value" placeholder="Value" class="input input-bordered input-sm flex-1" />
<button @click="field.options.splice(optIndex, 1)" type="button" class="btn btn-ghost btn-xs btn-circle text-error" title="Entfernen"> <button @click="field.options.splice(optIndex, 1)" type="button" class="btn btn-ghost btn-xs btn-circle text-error" title="Remove">
<i class="ph-duotone ph-x"></i> <i class="ph-duotone ph-x"></i>
</button> </button>
</div> </div>
@@ -206,7 +206,7 @@ $isEditing = isset($form['id']) && $form['id'] > 0;
<div class="mt-4"> <div class="mt-4">
<a href="javascript:void(0)" @click="addField()" class="btn btn-outline btn-sm btn-primary"> <a href="javascript:void(0)" @click="addField()" class="btn btn-outline btn-sm btn-primary">
<i class="ph-duotone ph-plus"></i> <i class="ph-duotone ph-plus"></i>
Feld hinzufügen Add field
</a> </a>
</div> </div>
</div> </div>
@@ -216,16 +216,16 @@ $isEditing = isset($form['id']) && $form['id'] > 0;
<div class="card-body"> <div class="card-body">
<div class="flex items-center gap-2 mb-4"> <div class="flex items-center gap-2 mb-4">
<i class="ph-duotone ph-gear text-2xl text-base-content/60"></i> <i class="ph-duotone ph-gear text-2xl text-base-content/60"></i>
<h3 class="card-title text-lg">Aktionen</h3> <h3 class="card-title text-lg">Actions</h3>
</div> </div>
<p class="text-sm text-base-content/60 mb-4">Was soll passieren, wenn ein Formular abgeschickt wird?</p> <p class="text-sm text-base-content/60 mb-4">What should happen when a form is submitted?</p>
<input type="hidden" name="finishers" :value="JSON.stringify(finishers)"> <input type="hidden" name="finishers" :value="JSON.stringify(finishers)">
<div x-show="finishers.length === 0" class="text-center py-8 border-2 border-dashed border-base-300 rounded-lg"> <div x-show="finishers.length === 0" class="text-center py-8 border-2 border-dashed border-base-300 rounded-lg">
<i class="ph-duotone ph-plus-circle text-4xl text-base-content/30"></i> <i class="ph-duotone ph-plus-circle text-4xl text-base-content/30"></i>
<p class="text-sm text-base-content/50 mt-2">Noch keine Aktionen hinzugefügt</p> <p class="text-sm text-base-content/50 mt-2">No actions added yet</p>
<a href="javascript:void(0)" @click="finishers.push({...defaultFinisher})" class="btn btn-sm btn-primary mt-2">Erste Aktion hinzufügen</a> <a href="javascript:void(0)" @click="finishers.push({...defaultFinisher})" class="btn btn-sm btn-primary mt-2">Add your first action</a>
</div> </div>
<div x-show="finishers.length > 0" class="space-y-2"> <div x-show="finishers.length > 0" class="space-y-2">
@@ -233,10 +233,10 @@ $isEditing = isset($form['id']) && $form['id'] > 0;
<div class="flex items-center gap-3 p-3 border border-base-300 rounded-lg bg-base-200/50"> <div class="flex items-center gap-3 p-3 border border-base-300 rounded-lg bg-base-200/50">
<span class="text-xs font-mono text-base-content/40">#[<span x-text="index + 1"></span>]</span> <span class="text-xs font-mono text-base-content/40">#[<span x-text="index + 1"></span>]</span>
<select x-model="finisher.type" class="select select-bordered select-sm flex-1"> <select x-model="finisher.type" class="select select-bordered select-sm flex-1">
<option value="saveToDatabase">In Datenbank speichern</option> <option value="saveToDatabase">Save to database</option>
<option value="sendMailToAdmin">Email an Admin senden</option> <option value="sendMailToAdmin">Send email to admin</option>
</select> </select>
<button @click="finishers.splice(index, 1)" type="button" class="btn btn-ghost btn-sm btn-circle text-error" title="Entfernen"> <button @click="finishers.splice(index, 1)" type="button" class="btn btn-ghost btn-sm btn-circle text-error" title="Remove">
<i class="ph-duotone ph-trash"></i> <i class="ph-duotone ph-trash"></i>
</button> </button>
</div> </div>
@@ -246,7 +246,7 @@ $isEditing = isset($form['id']) && $form['id'] > 0;
<div class="mt-4"> <div class="mt-4">
<a href="javascript:void(0)" @click="finishers.push({...defaultFinisher})" class="btn btn-outline btn-sm btn-primary"> <a href="javascript:void(0)" @click="finishers.push({...defaultFinisher})" class="btn btn-outline btn-sm btn-primary">
<i class="ph-duotone ph-plus"></i> <i class="ph-duotone ph-plus"></i>
Aktion hinzufügen Add action
</a> </a>
</div> </div>
</div> </div>
@@ -254,11 +254,11 @@ $isEditing = isset($form['id']) && $form['id'] > 0;
<div class="flex justify-end gap-2"> <div class="flex justify-end gap-2">
<a href="?tab=ext--form" class="btn btn-ghost btn-sm"> <a href="?tab=ext--form" class="btn btn-ghost btn-sm">
Abbrechen Cancel
</a> </a>
<button type="submit" class="btn btn-primary btn-sm"> <button type="submit" class="btn btn-primary btn-sm">
<i class="ph-duotone ph-floppy-disk"></i> <i class="ph-duotone ph-floppy-disk"></i>
Speichern Save
</button> </button>
</div> </div>
</form> </form>
@@ -2,9 +2,9 @@
<div class="card-body"> <div class="card-body">
<div class="flex items-center gap-2 mb-4"> <div class="flex items-center gap-2 mb-4">
<i class="ph-duotone ph-gear text-2xl text-base-content/60"></i> <i class="ph-duotone ph-gear text-2xl text-base-content/60"></i>
<h3 class="card-title text-lg">Einstellungen</h3> <h3 class="card-title text-lg">Settings</h3>
</div> </div>
<p class="text-sm text-base-content/60 mb-4">Konfiguriere die globalen Einstellungen für das Formulare-Extension.</p> <p class="text-sm text-base-content/60 mb-4">Configure the global settings for the Form extension.</p>
<div class="space-y-4"> <div class="space-y-4">
<?php <?php
foreach (\Plugi\Extensions::getSettings('form') as $setting) { foreach (\Plugi\Extensions::getSettings('form') as $setting) {
@@ -20,7 +20,7 @@ $entries = $entriesRepository->findWhere('formId', $id);
</a> </a>
<div> <div>
<h2 class="text-xl font-bold"><?= phpb_e($form['name']) ?></h2> <h2 class="text-xl font-bold"><?= phpb_e($form['name']) ?></h2>
<p class="text-sm text-base-content/60"><?= count($entries) ?> Eintrag<?= count($entries) !== 1 ? 'e' : '' ?> für dieses Formular</p> <p class="text-sm text-base-content/60"><?= count($entries) ?> submission<?= count($entries) !== 1 ? 's' : '' ?> for this form</p>
</div> </div>
</div> </div>
</div> </div>
@@ -29,8 +29,8 @@ $entries = $entriesRepository->findWhere('formId', $id);
<div class="card bg-base-100 shadow"> <div class="card bg-base-100 shadow">
<div class="card-body items-center text-center py-16"> <div class="card-body items-center text-center py-16">
<i class="ph-duotone ph-inbox text-6xl text-base-content/20"></i> <i class="ph-duotone ph-inbox text-6xl text-base-content/20"></i>
<h3 class="card-title text-lg mt-4">Noch keine Einträge</h3> <h3 class="card-title text-lg mt-4">No submissions yet</h3>
<p class="text-base-content/60 mt-1">Wenn jemand das Formular ausfüllt, erscheint die Eintragung hier.</p> <p class="text-base-content/60 mt-1">Submissions will appear here when someone fills out the form.</p>
</div> </div>
</div> </div>
<?php else: ?> <?php else: ?>
@@ -41,7 +41,7 @@ $entries = $entriesRepository->findWhere('formId', $id);
<thead> <thead>
<tr class="bg-base-200/50"> <tr class="bg-base-200/50">
<th class="w-16">ID</th> <th class="w-16">ID</th>
<th class="w-40">Erstellt</th> <th class="w-40">Created</th>
<?php foreach ($fields as $field): ?> <?php foreach ($fields as $field): ?>
<th><?= phpb_e($field['label']) ?></th> <th><?= phpb_e($field['label']) ?></th>
<?php endforeach; ?> <?php endforeach; ?>
@@ -8,12 +8,12 @@ $forms = $formsRepository->getAll();
<div class="flex items-center justify-between mb-6"> <div class="flex items-center justify-between mb-6">
<div> <div>
<h2 class="text-xl font-bold">Formulare</h2> <h2 class="text-xl font-bold">Forms</h2>
<p class="text-sm text-base-content/60"><?= count($forms) ?> Formular<?= count($forms) !== 1 ? 'e' : '' ?> vorhanden</p> <p class="text-sm text-base-content/60"><?= count($forms) ?> form<?= count($forms) !== 1 ? 's' : '' ?> available</p>
</div> </div>
<a href="<?= phpb_url('website_manager', ['tab' => 'ext--form', 'action' => 'editForm']) ?>" class="btn btn-primary btn-sm"> <a href="<?= phpb_url('website_manager', ['tab' => 'ext--form', 'action' => 'editForm']) ?>" class="btn btn-primary btn-sm">
<i class="ph-duotone ph-plus"></i> <i class="ph-duotone ph-plus"></i>
Neues Formular New form
</a> </a>
</div> </div>
@@ -21,11 +21,11 @@ $forms = $formsRepository->getAll();
<div class="card bg-base-100 shadow"> <div class="card bg-base-100 shadow">
<div class="card-body items-center text-center py-16"> <div class="card-body items-center text-center py-16">
<i class="ph-duotone ph-notebook text-6xl text-base-content/20"></i> <i class="ph-duotone ph-notebook text-6xl text-base-content/20"></i>
<h3 class="card-title text-lg mt-4">Noch keine Formulare</h3> <h3 class="card-title text-lg mt-4">No forms yet</h3>
<p class="text-base-content/60 mt-1">Erstelle dein erstes Formular, um Einträge von deiner Website zu sammeln.</p> <p class="text-base-content/60 mt-1">Create your first form to collect submissions from your website.</p>
<a href="<?= phpb_url('website_manager', ['tab' => 'ext--form', 'action' => 'editForm']) ?>" class="btn btn-primary mt-4"> <a href="<?= phpb_url('website_manager', ['tab' => 'ext--form', 'action' => 'editForm']) ?>" class="btn btn-primary mt-4">
<i class="ph-duotone ph-plus"></i> <i class="ph-duotone ph-plus"></i>
Erstes Formular erstellen Create your first form
</a> </a>
</div> </div>
</div> </div>
@@ -50,7 +50,7 @@ $forms = $formsRepository->getAll();
</td> </td>
<td> <td>
<div class="flex items-center justify-center gap-1"> <div class="flex items-center justify-center gap-1">
<a href="<?= phpb_url('website_manager', ['tab' => 'ext--form', 'action' => 'listEntries', 'id' => $form['id']]) ?>" class="btn btn-ghost btn-sm btn-circle" title="Einträge ansehen"> <a href="<?= phpb_url('website_manager', ['tab' => 'ext--form', 'action' => 'listEntries', 'id' => $form['id']]) ?>" class="btn btn-ghost btn-sm btn-circle" title="View entries">
<i class="ph-duotone ph-eye text-lg"></i> <i class="ph-duotone ph-eye text-lg"></i>
</a> </a>
<a href="<?= phpb_url('website_manager', ['tab' => 'ext--form', 'action' => 'editForm', 'id' => $form['id']]) ?>" class="btn btn-ghost btn-sm btn-circle" title="<?= phpb_trans('website-manager.edit') ?>"> <a href="<?= phpb_url('website_manager', ['tab' => 'ext--form', 'action' => 'editForm', 'id' => $form['id']]) ?>" class="btn btn-ghost btn-sm btn-circle" title="<?= phpb_trans('website-manager.edit') ?>">
+2 -2
View File
@@ -2,14 +2,14 @@
$modules = [ $modules = [
'listForms' => [ 'listForms' => [
'include' => __DIR__ . '/Views/ListForms.php', 'include' => __DIR__ . '/Views/ListForms.php',
'label' => 'Formulare', 'label' => 'Forms',
'icon' => 'ph-list-dashes', 'icon' => 'ph-list-dashes',
'showTabs' => true, 'showTabs' => true,
'inMenu' => true, 'inMenu' => true,
], ],
'settings' => [ 'settings' => [
'include' => __DIR__ . '/Views/ExtSettings.php', 'include' => __DIR__ . '/Views/ExtSettings.php',
'label' => 'Einstellungen', 'label' => 'Settings',
'icon' => 'ph-gear', 'icon' => 'ph-gear',
'showTabs' => true, 'showTabs' => true,
'inMenu' => true, 'inMenu' => true,
@@ -18,7 +18,7 @@ return [
"settings" => [ "settings" => [
"formId" => [ "formId" => [
"type" => "select", "type" => "select",
"label" => "Formular", "label" => "Form",
"value" => 0, "value" => 0,
"options" => $formOptions, "options" => $formOptions,
], ],
@@ -43,7 +43,7 @@ if ($id > 0):
<select x-model="data.fields.<?= $fieldName ?>" class="select select-bordered w-full" <?= $fieldRequired <select x-model="data.fields.<?= $fieldName ?>" class="select select-bordered w-full" <?= $fieldRequired
? "required" ? "required"
: "" ?>> : "" ?>>
<option value="" disabled selected>Bitte wählen</option> <option value="" disabled selected>Please select</option>
<?php foreach ($fieldOptions as $option): ?> <?php foreach ($fieldOptions as $option): ?>
<option value="<?= $option[ <option value="<?= $option[
"value" "value"
@@ -92,11 +92,11 @@ if ($id > 0):
<button type="submit" class="btn btn-primary w-full" :disabled="status === 'busy'"> <button type="submit" class="btn btn-primary w-full" :disabled="status === 'busy'">
<span x-show="status === 'idle'"> <span x-show="status === 'idle'">
<i class="ph-duotone ph-paper-plane-tilt"></i> <i class="ph-duotone ph-paper-plane-tilt"></i>
Absenden Submit
</span> </span>
<span x-show="status === 'busy'"> <span x-show="status === 'busy'">
<span class="loading loading-spinner loading-sm"></span> <span class="loading loading-spinner loading-sm"></span>
Wird gesendet... Sending...
</span> </span>
</button> </button>
</div> </div>
@@ -106,8 +106,8 @@ if ($id > 0):
<div class="w-16 h-16 rounded-full bg-success/20 flex items-center justify-center mb-2"> <div class="w-16 h-16 rounded-full bg-success/20 flex items-center justify-center mb-2">
<i class="ph-duotone ph-check text-3xl text-success"></i> <i class="ph-duotone ph-check text-3xl text-success"></i>
</div> </div>
<h3 class="card-title text-lg">Vielen Dank!</h3> <h3 class="card-title text-lg">Thank you!</h3>
<p class="text-base-content/60">Ihre Nachricht wurde erfolgreich gesendet.</p> <p class="text-base-content/60">Your message has been sent successfully.</p>
</div> </div>
</div> </div>
</div> </div>
@@ -119,7 +119,7 @@ else:
<div class="card bg-base-200 border-2 border-dashed border-base-300"> <div class="card bg-base-200 border-2 border-dashed border-base-300">
<div class="card-body items-center text-center py-8"> <div class="card-body items-center text-center py-8">
<i class="ph-duotone ph-plus-circle text-4xl text-base-content/30"></i> <i class="ph-duotone ph-plus-circle text-4xl text-base-content/30"></i>
<p class="text-sm text-base-content/50 mt-2">Wählen Sie ein Formular in den Einstellungen aus</p> <p class="text-sm text-base-content/50 mt-2">Select a form in the settings</p>
</div> </div>
</div> </div>
</div> </div>
-21
View File
@@ -1,21 +0,0 @@
MIT License
Copyright (c) 2023 Paul Spenke
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.