Skip to content
Snippets Groups Projects
Commit 9f1ffc3f authored by Jan-Hendrik Willms's avatar Jan-Hendrik Willms Committed by David Siegfried
Browse files

prevent php8 warnings, fixes #2402

Closes #2402

Merge request studip/studip!1595
parent bf5dd7d8
No related branches found
No related tags found
No related merge requests found
<form method="post" action="<?= $controller->url_for('my_courses/store_groups/'.$studygroups) ?>" class="default">
<form method="post" action="<?= $controller->link_for('my_courses/store_groups/'.$studygroups) ?>" class="default">
<?= CSRFProtection::tokenTag() ?>
<input type="hidden" name="cid" value="<?= $cid ?>">
<input type="hidden" name="cid" value="<?= htmlReady($cid) ?>">
<table class="default collapsable">
<caption><?= _('Gruppenzuordnung') ?></caption>
<colgroup>
......@@ -17,7 +17,7 @@
</tr>
</thead>
<? foreach ($groups as $group_id => $group_members): ?>
<tbody class="<?= $current_semester != $semesters[$group_id]['semester_id'] ? 'collapsed' : ''?>">
<tbody <? if (isset($semesters[$group_id]['semester_id']) && $current_semester != $semesters[$group_id]['semester_id']) echo 'class="collapsed"'; ?>>
<? if ($group_field !== 'not_grouped'): ?>
<tr class="table_header header-row">
......
......@@ -21,6 +21,14 @@ if ($numTaskAnswers > 0) {
}
} else {
if (isset($answer['answerdata']['answers'])) {
if (!isset($results[(int) $answer['answerdata']['answers']])) {
$results[(int) $answer['answerdata']['answers']] = 0;
}
$results[(int) $answer['answerdata']['answers']]++;
if (!isset($results_users[(int) $answer['answerdata']['answers']])) {
$results_users[(int) $answer['answerdata']['answers']] = [];
}
$results[(int) $answer['answerdata']['answers']]++;
$results_users[(int) $answer['answerdata']['answers']][] = $answer['user_id'];
}
......@@ -76,7 +84,7 @@ rsort($ordered_results);
<? $countAnswers = $vote->questionnaire->countAnswers() ?>
<? foreach ($options as $key => $answer) : ?>
<tr>
<? $percentage = $countAnswers ? round((int) $results[$key] / $countAnswers * 100) : 0 ?>
<? $percentage = ($countAnswers && isset($results[$key])) ? round((int) $results[$key] / $countAnswers * 100) : 0 ?>
<td style="text-align: right; background-size: <?= $percentage ?>% 100%; background-position: right center; background-image: url('<?= Assets::image_path("vote_lightgrey.png") ?>'); background-repeat: no-repeat;" width="50%">
<strong><?= formatReady($answer) ?></strong>
......
......@@ -22,7 +22,7 @@
aria-labelledby="pagination-label-<?= $random_id ?>">
<? if ($cur_page > 1): ?>
<li class="prev">
<a class="pagination--link" href="<?= URLHelper::getLink(sprintf($pagelink, $cur_page - 1), $pageparams) ?>" rel="prev" <?= $dialog ?: ''?>>
<a class="pagination--link" href="<?= URLHelper::getLink(sprintf($pagelink, $cur_page - 1), $pageparams) ?>" rel="prev" <?= $dialog ?? '' ?>>
<span class="audible"><?= _('Eine Seite') ?></span>
<?= _('zurück') ?>
</a>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment