blob: b99e108ca8c9d5e8223acec52fc24e1d851c7fb3 (
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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
|
<?php
/**
* @var Admin_BannerController $controller
* @var Banner $banner
* @var array $target_types
* @var Course $seminar
* @var Institute $institut
* @var User $user
* @var array $priorities
* @var array $assigned
* @var array $rolesStats
* @var Role $roles
*/
?>
<form action="<?= $controller->url_for('admin/banner/edit', $banner->id) ?>" method="post" enctype="multipart/form-data" class="default">
<?= CSRFProtection::tokenTag() ?>
<fieldset>
<label>
<?= _('Banner:') ?><br>
<? if ($banner['banner_path']) : ?>
<?= $banner->toImg(['style' => 'max-width:500px']) ?>
<? else : ?>
<?= _('Noch kein Bild hochgeladen') ?>
<? endif; ?><br>
<label class="file-upload">
<?= _('Bilddatei auswählen') ?>
<input id="imgfile" name="imgfile" type="file" accept="image/*">
<input type="hidden" name="banner_path" value="<?= $banner['banner_path'] ?>">
</label>
</label>
<label>
<?= _('Mobiles Banner (optional):') ?><br>
<? if ($banner['banner_mobile_path']) : ?>
<?= $banner->toImg(['style' => 'max-width:500px'], true) ?>
<? else : ?>
<?= _('Noch kein Bild hochgeladen') ?>
<? endif; ?><br>
<label class="file-upload">
<?= _('Bilddatei auswählen') ?>
<input id="imgfile_mobile" name="imgfile_mobile" type="file" accept="image/*">
<input type="hidden" name="banner_mobile_path" value="<?= $banner['banner_mobile_path'] ?>">
</label>
</label>
<label>
<?= _('Beschreibung:') ?>
<input type="text" id="description" name="description" value="<?= htmlReady($banner['description']) ?>" size="40" maxlength="254">
</label>
<label>
<?= _('Alternativtext:') ?>
<input type="text" id="alttext" name="alttext" value="<?= htmlReady($banner['alttext']) ?>" size="40" maxlength="254">
</label>
<label>
<?= _("Verweis-Typ:") ?>
<? if (!$banner->isNew()) : ?>
<input name="target_type" type="hidden" size="8" value="<?= $banner['target_type'] ?>">
<? endif; ?>
<select id="target_type" name="target_type" <?= $banner->isNew() ?: 'disabled' ?>>
<? foreach ($target_types as $key => $label) : ?>
<option value="<?= $key ?>" <? if ($banner['target_type'] == $key) echo 'selected'; ?>>
<?= $label ?>
</option>
<? endforeach; ?>
</select>
</label>
<label>
<?= _("Verweis-Ziel:") ?>
<? if ($banner->isNew()) : ?>
<input type="url" class="target-url" name="target" placeholder="<?= _('URL eingeben') ?>" value="<?= htmlReady($this->flash['request']['target']) ?>" style="width: 240px;" maxlen="254">
<?= QuickSearch::get('seminar', new StandardSearch('Seminar_id'))
->setInputStyle('width: 240px')
->setInputClass('target-seminar')
->render() ?>
<?= QuickSearch::get('institut', new StandardSearch('Institut_id'))
->setInputStyle('width: 240px')
->setInputClass('target-inst')
->render() ?>
<?= QuickSearch::get('user', new StandardSearch('username'))
->setInputStyle('width: 240px')
->setInputClass('target-user')
->render() ?>
<span class="target-none"><?= _('Kein Verweisziel') ?></span>
<? else : ?>
<? if (in_array($banner['target_type'], words('none url'))) : ?>
<input type="text" name="target" size="40" maxlen="254" value="<?= htmlReady($banner['target']) ?>">
<? elseif ($banner['target_type'] == "seminar") : ?>
<?= $seminar ?>
<? elseif ($banner['target_type'] == "inst") : ?>
<?= $institut ?>
<? else : ?>
<?= $user ?>
<? endif; ?>
<? endif; ?>
</label>
<label>
<?= _('Anzeigen ab:') ?>
<input type="text" size="20" name="start_date" id="start_date" value="<?= $banner['startdate'] ?
date('d.m.Y H:i', $banner['startdate']) : '' ?>" data-datetime-picker>
</label>
<label>
<?= _('Anzeigen bis:') ?>
<input type="text" size="20" name="end_date" id="end_date" value="<?= $banner['enddate'] ?
date('d.m.Y H:i', $banner['enddate']) : '' ?>" data-datetime-picker>
</label>
<label>
<?= _('Priorität:') ?>
<select id="priority" name="priority">
<? foreach ($priorities as $key => $label) : ?>
<option value="<?= $key ?>" <? if ($banner['priority'] == $key) echo 'selected'; ?>>
<?= $label ?>
</option>
<? endforeach; ?>
</select>
</label>
<label>
<?= _('Sichtbarkeit:') ?>
<select id="assignedroles" class="nested-select" name="assignedroles[]" multiple>
<? if ($assigned) : ?>
<? foreach ($assigned as $assignedrole) : ?>
<option value="<?= $assignedrole->getRoleid() ?>" selected>
<?= htmlReady($assignedrole->getRolename()) ?>
<? if ($assignedrole->getSystemtype()) : ?>[<?= _('Systemrolle') ?>]<? endif ?>
(<?= $rolesStats[$assignedrole->getRoleid()]['explicit'] + $rolesStats[$assignedrole->getRoleid()]['implicit'] ?>)
</option>
<? endforeach ?>
<? endif ?>
<? foreach ($roles as $role) : ?>
<option value="<?= $role->getRoleid() ?>">
<?= htmlReady($role->getRolename()) ?>
<? if ($role->getSystemtype()) : ?>[<?= _('Systemrolle') ?>]<? endif ?>
(<?= $rolesStats[$role->getRoleid()]['explicit'] + $rolesStats[$role->getRoleid()]['implicit'] ?>)
</option>
<? endforeach ?>
</select>
</label>
</fieldset>
<footer data-dialog-button>
<?= Studip\Button::create(_('Speichern'), 'speichern') ?>
<?= Studip\LinkButton::createCancel(
_('Abbrechen'),
$controller->index("#banner-{$banner->id}")
) ?>
</footer>
</form>
<? if ($banner->isNew()) : ?>
<script type="text/javascript">
jQuery(function($) {
$('#target_type').change(function() {
var target = $(this).val();
$(this).closest('label').next().find('[class^="target"]').hide().filter('.target-' + target).show();
}).change();
});
</script>
<? endif; ?>
|