Newer
Older
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
107
<?php
$form = $this->form;
$form->prepare();
$title = $form->getTitle();
$title = !empty($title)
? $this->transEsc($title) : null;
$formUrl = $this->url('feedback-form', ['id' => $this->formId]);
$form->setAttribute('action', $formUrl);
$form->setAttribute('class', 'dynamic-form');
$form->setAttribute('method', 'post');
$help = $form->getHelp();
$helpPre = $helpPost = null;
$helpPre = isset($help['pre']) ? $this->translate($help['pre']) : null;
$helpPost = isset($help['post']) ? $this->translate($help['post']) : null;
?>
<div class="feedback-content">
<?php if ($title): ?>
<?php $this->headTitle($title); ?>
<h1><?=$title?></h1>
<?php endif; ?>
<?=$this->flashmessages()?>
<?php if ($form->showOnlyForLoggedUsers() && !$this->user): ?>
<div class="form-group">
<p><?=$this->translate('feedback_login_required')?></p>
<a href="<?=$this->url('myresearch-userlogin') ?>" class="btn btn-primary" data-lightbox title="Login"><i class="fa fa-sign-in" aria-hidden="true" data-lightbox-onclose="window.location.href='<?=$this->escapeHtmlAttr($formUrl) ?>'"></i> <?=$this->transEsc("Login") ?></a>
</div>
<?php else: ?>
<?= $this->form()->openTag($form); ?>
<?php if ($helpPre): ?>
<div class="form-group">
<div class="form-info pre">
<?=$helpPre?>
</div>
</div>
<?php endif ?>
<?php $currentGroup = null; ?>
<?php $countElements = count($form->getElements()); $counter = 0 ?>
<?php foreach($form->getElements() as $el): ?>
<? $counter++; ?>
<? if($counter == $countElements) : ?>
<div class="form-group">
<input id="confirmPrivacy" name="confirmPrivacy" type="checkbox" class="margin-r-2" required>
<label for="confirmPrivacy">
<?=
$this->translate(
'email_contact_policy',
['%%policy_link%%' => '<a target="_blank" href="'. $this->url('fid/user/policy') . '">' . $this->transEsc('fid::policy') . '</a>']
);
?>*
</label>
</div>
<?php endif ?>
<?php
$formElement = $form->get($el['name']);
// Group form elements into field sets
$handleGroup = $group = null;
if (isset($el['group']) && !empty($el['group'])) {
$group = $el['group'];
}
if ($group && $currentGroup === null) {
$handleGroup = 'open';
$currentGroup = $group;
} elseif ($currentGroup && !$group) {
$handleGroup = 'close';
$currentGroup = null;
} elseif ($currentGroup !== $group) {
$handleGroup = 'openAndClose';
$currentGroup = $group;
}
?>
<?php if (in_array($handleGroup, ['close', 'openAndClose'])): ?>
</div>
<?php endif ?>
<?php if (in_array($handleGroup, ['open', 'openAndClose'])): ?>
<div class="field-set">
<?php endif ?>
<div class="form-group">
<?php if (!empty($el['help'])): ?>
<p class="info"><?= $this->transEsc($el['help']) ?></p>
<?php endif ?>
<?php if ($el['type'] !== 'submit'): ?>
<label for="<?=$this->escapeHtmlAttr($el['name'])?>" class="control-label<?=!empty($el['required']) ? ' required' : ''?>"><?=$this->transEsc($el['label'])?>:</label>
<?php else: ?>
<?php if ($helpPost): ?>
<div class="form-info post">
<?=$helpPost?>
</div>
<?php endif ?>
<?=$this->recaptcha()->html($this->useRecaptcha) ?>
<?php endif ?>
<?= $this->formRow($formElement) ?>
</div>
<?php endforeach ?>
<?= $this->form()->closeTag() ?>
<?php endif ?>
</div>