From ca0acf65e24c7e2882f7f3deb9e60dd686b98ba2 Mon Sep 17 00:00:00 2001
From: Jan-Hendrik Willms <tleilax+studip@gmail.com>
Date: Thu, 24 Nov 2022 09:48:55 +0000
Subject: [PATCH] fixes #1810
Closes #1810
Merge request studip/studip!1190
---
app/views/course/members/additional.php | 36 ++++++++++++--------
lib/models/AuxLockRule.php | 11 ++++--
resources/assets/stylesheets/less/forms.less | 6 ----
3 files changed, 29 insertions(+), 24 deletions(-)
diff --git a/app/views/course/members/additional.php b/app/views/course/members/additional.php
index d1af456c521..0c794584d8a 100644
--- a/app/views/course/members/additional.php
+++ b/app/views/course/members/additional.php
@@ -1,34 +1,40 @@
-<? if (!empty($aux['rows'])) : ?>
- <form method="post" action="<?= $controller->url_for('course/members/store_additional')?>">
+<?php
+/**
+ * @var array $aux
+ * @var Course_MembersController $controller
+ */
+?>
+<? if (count($aux['rows']) === 0) : ?>
+ <?= MessageBox::info(_('Keine Zusatzangaben oder Teilnehmende vorhanden.')) ?>
+<? else : ?>
+ <form method="post" action="<?= $controller->store_additional() ?>">
<?= CSRFProtection::tokenTag()?>
- <table class="default hide_datafield_title">
+ <table class="default">
<caption><?= _('Zusatzangaben bearbeiten') ?></caption>
<thead>
- <tr>
+ <tr>
<? foreach ($aux['head'] as $head): ?>
<th><?= htmlReady($head) ?></th>
<? endforeach; ?>
- </tr>
+ </tr>
</thead>
<tbody>
<? foreach ($aux['rows'] as $entry): ?>
<tr>
- <? foreach ($aux['head'] as $key => $value): ?>
- <td><?= $key === 'name' ? htmlReady($entry[$key]) : $entry[$key] ?></td>
- <? endforeach; ?>
+ <? foreach ($aux['head'] as $key => $value): ?>
+ <td><?= $key === 'name' ? htmlReady($entry[$key]) : $entry[$key] ?></td>
+ <? endforeach; ?>
</tr>
<? endforeach; ?>
</tbody>
<tfoot>
- <tr>
- <td colspan="<?= count($aux['head']) ?>">
- <?= \Studip\Button::create(_('Speichern'), 'save') ?>
- </td>
- </tr>
+ <tr>
+ <td colspan="<?= count($aux['head']) ?>">
+ <?= Studip\Button::create(_('Speichern'), 'save') ?>
+ </td>
+ </tr>
</tfoot>
</table>
</form>
-<? else : ?>
- <?= MessageBox::info(_('Keine Zusatzangaben oder Teilnehmende vorhanden.')) ?>
<? endif ?>
diff --git a/lib/models/AuxLockRule.php b/lib/models/AuxLockRule.php
index 3b08a8cc9de..80f1e46dcd8 100644
--- a/lib/models/AuxLockRule.php
+++ b/lib/models/AuxLockRule.php
@@ -109,7 +109,12 @@ class AuxLockRule extends SimpleORMap
];
// start collecting entries
- $result['head']['name'] = _('Name');
+ $result = [
+ 'head' => [
+ 'name' => _('Name'),
+ ],
+ 'rows' => [],
+ ];
// get all autors and users
foreach ($course->members->findBy('status', ['autor', 'user'])->orderBy('nachname,vorname') as $member) {
@@ -121,7 +126,7 @@ class AuxLockRule extends SimpleORMap
// if standard get it from the mapping else get it from the datafield
if ($mapping[$field]) {
$result['head'][$field] = $head_mapping[$field];
- $new[$field] = $mapping[$field];
+ $new[$field] = htmlReady($mapping[$field]);
} else {
$datafield = $this->getDatafield($member, $field);
if ($datafield && current($datafield)->isVisible()) {
@@ -129,7 +134,7 @@ class AuxLockRule extends SimpleORMap
if (!$display_only && current($datafield)->isEditable() && $this->datafieldCache[$field]->object_type == 'usersemdata') {
$new[$field] = current($datafield)->getHTML($member->user_id);
} else {
- $new[$field] = current($datafield)->getDisplayValue(false);
+ $new[$field] = htmlReady(current($datafield)->getDisplayValue(false));
}
}
}
diff --git a/resources/assets/stylesheets/less/forms.less b/resources/assets/stylesheets/less/forms.less
index e4f75bafa43..21bb8d0166c 100644
--- a/resources/assets/stylesheets/less/forms.less
+++ b/resources/assets/stylesheets/less/forms.less
@@ -476,12 +476,6 @@ form.narrow {
}
});
-table.hide_datafield_title {
- .datafield_title {
- display: none;
- }
-}
-
.content-title {
background-color: transparent;
padding-top: 0px;
--
GitLab