blob: 31979806e582e99110d666a1aa5a6e17c6f49537 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
|
<?php
/**
* @var \Studip\Forms\Form $form
*/
$inputs = [];
$allinputs = $form->getAllInputs();
$required_inputs = [];
$server_validation = false;
foreach ($allinputs as $input) {
foreach ($input->getAllInputNames() as $name) {
$inputs[$name] = $input->getValue();
}
if ($input->required) {
$required_inputs[] = $input->getName();
}
if ($input->hasValidation()) {
$server_validation = true;
}
}
$form_id = md5(uniqid());
?>
<div v-cloak
class="studipform"
data-inputs="<?= htmlReady(json_encode($inputs)) ?>"
data-debugmode="<?= htmlReady(json_encode($form->getDebugMode())) ?>"
data-required="<?= htmlReady(json_encode($required_inputs)) ?>"
data-server_validation="<?= $server_validation ? 1 : 0 ?>"
data-validation_url="<?= htmlReady($_SERVER['REQUEST_URI']) ?>"
data-form-id="<?= htmlReady($form->getId()) ?>"
<? if ($form->isAutoStoring()) : ?>
data-autosave="<?= htmlReady($_SERVER['REQUEST_URI']) ?>"
data-url="<?= htmlReady($form->getURL()) ?>"
<? endif; ?>
<? if ($form->usesStore()) : ?>
data-use-store="true"
<? endif; ?>
>
<form method="post"
<? if (!$form->isAutoStoring()) : ?>
action="<?= htmlReady($form->getURL()) ?>"
<? endif ?>
@submit="submit"
@cancel=""
novalidate
<? if ($form->getDataSecure()): ?>
data-secure
<? endif; ?>
id="<?= htmlReady($form_id) ?>"
class="default <?= $form->isCollapsable() ? ' collapsable' : '' ?>"
<? if ($form->hasFileInput()): ?>
enctype="multipart/form-data"
<? endif; ?>
>
<?= CSRFProtection::tokenTag(['ref' => 'securityToken']) ?>
<article aria-live="assertive"
class="validation_notes studip"
v-if="STUDIPFORM_REQUIRED.length > 0 || STUDIPFORM_VALIDATIONNOTES.length > 0">
<header>
<h1>
<?= Icon::create('info-circle', Icon::ROLE_INFO)->asImg(['class' => 'text-bottom validation_notes_icon']) ?>
<?= _('Hinweise zum Ausfüllen des Formulars') ?>
</h1>
</header>
<div class="required_note" v-if="STUDIPFORM_REQUIRED.length > 0">
<div aria-hidden="true">
<?= _('Pflichtfelder sind mit Sternchen gekennzeichnet.') ?>
</div>
<div class="sr-only">
<?= _('Dieses Formular enthält Pflichtfelder.') ?>
</div>
</div>
<div v-if="STUDIPFORM_DISPLAYVALIDATION && (STUDIPFORM_VALIDATIONNOTES.length > 0)">
<?= _('Folgende Angaben müssen korrigiert werden, um das Formular abschicken zu können:') ?>
<ul>
<template v-for="note in ordererValidationNotes" :key="note.label + note.description">
<li v-if="note.label" :aria-describedby="note.describedby">
{{ note.label.trim() + ": " + note.description }}
</li>
</template>
</ul>
</div>
</article>
<div aria-live="polite">
<?
foreach ($form->getParts() as $part) : ?>
<?= $part->renderWithCondition() ?>
<?
endforeach ?>
</div>
<? if ($form->hasButtons()) : ?>
<footer data-dialog-button>
<?= \Studip\Button::create($form->getSaveButtonText(), $form->getSaveButtonName(), ['form' => $form_id]) ?>
<? foreach ($form->getButtons() as $button): ?>
<?
$button->attributes['form'] = $form_id;
echo $button;
?>
<? endforeach ?>
<?= \Studip\LinkButton::createCancel($form->getCancelButtonText(), Request::url()) ?>
</footer>
<? endif ?>
</form>
</div>
|