Skip to content
Snippets Groups Projects
Commit 4d4ec44c authored by André Noack's avatar André Noack Committed by Jan-Hendrik Willms
Browse files

Resolve #962 Checkboxen funktionieren nicht richtig in Profil->Einstellungen->Benachrichtigung

Closes #962

Merge request studip/studip!585
parent 7db0ed60
No related branches found
No related tags found
No related merge requests found
......@@ -53,28 +53,17 @@ class Settings_NotificationController extends Settings_SettingsController
{
$group_field = 'sem_number';
$add_fields = $add_query = '';
if ($group_field == 'sem_tree_id') {
$add_fields = ',sem_tree_id';
$add_query = "LEFT JOIN seminar_sem_tree sst ON (sst.seminar_id=seminare.Seminar_id)";
} else if ($group_field == 'dozent_id') {
$add_fields = ', su1.user_id as dozent_id';
$add_query = "LEFT JOIN seminar_user as su1 ON (su1.seminar_id=seminare.Seminar_id AND su1.status='dozent')";
}
$dbv = DbView::getView('sem_tree');
$query = "SELECT seminare.VeranstaltungsNummer AS sem_nr, seminare.Name, seminare.Seminar_id,
seminare.status AS sem_status, seminar_user.gruppe, seminare.visible,
{$dbv->sem_number_sql} AS sem_number, {$dbv->sem_number_end_sql} AS sem_number_end
{$add_fields}
FROM seminar_user
LEFT JOIN seminare USING (Seminar_id)
{$add_query}
WHERE seminar_user.user_id = ?";
if (Config::get()->DEPUTIES_ENABLE) {
$query .= " UNION " . Deputy::getMySeminarsQuery(
'notification', $dbv->sem_number_sql, $dbv->sem_number_end_sql, $add_fields, $add_query
'notification', $dbv->sem_number_sql, $dbv->sem_number_end_sql, '', ''
);
}
$query .= " ORDER BY sem_nr ASC";
......@@ -116,11 +105,7 @@ class Settings_NotificationController extends Settings_SettingsController
}
}
if ($group_field == 'sem_number') {
correct_group_sem_number($groups, $my_sem);
} else {
add_sem_name($my_sem);
}
correct_group_sem_number($groups, $my_sem);
sort_groups($group_field, $groups);
......@@ -129,7 +114,7 @@ class Settings_NotificationController extends Settings_SettingsController
$open = UserConfig::get($this->user->user_id)->MY_COURSES_OPEN_GROUPS;
$checked = [];
foreach ($groups as $group_id => $group_members) {
if ($group_id !== 'not_grouped' && !isset($open[$group_id])) {
if (!in_array($group_id, $open)) {
continue;
}
foreach ($group_members as $member) {
......
......@@ -26,12 +26,13 @@
<td colspan="2">
<?= _('Benachrichtigung für unten aufgeführte Veranstaltungen:') ?>
</td>
<? for ($i = 0; $i < count($modules); $i += 1): ?>
<? $i = 0; ?>
<? foreach ($modules as $index => $data): ?>
<td>
<input type="checkbox" name="all[columns][]" value="<?= $i ?>"
<? if (!empty($checked) && count(array_filter($checked, function ($item) use ($i) { return $item[$i]; })) == count($checked)) echo 'checked'; ?>>
<input type="checkbox" name="all[columns][]" value="<?= $i++ ?>"
<? if (!empty($checked) && count(array_filter($checked, function ($item) use ($index) { return $item[$index]; })) == count($checked)) echo 'checked'; ?>>
</td>
<? endfor; ?>
<? endforeach; ?>
<td>
<input type="checkbox" name="all[all]" value="all"
<? if (!empty($checked) && count(array_filter($checked, function ($item) { return $item['all']; })) == count($checked)) echo 'checked'; ?>>
......@@ -44,7 +45,7 @@
<? if ($group_field !== 'not_grouped'): ?>
<tr>
<th colspan="<?= 3 + count($modules) ?>">
<? if (isset($open[$id])): ?>
<? if (in_array($id, $open)): ?>
<a class="tree" style="font-weight:bold" name="<?= $id ?>"
href="<?= $controller->url_for('settings/notification/close', $id) ?>#<?= $id ?>"
<?= tooltip(_('Gruppierung schließen'), true) ?>>
......@@ -60,7 +61,7 @@
</th>
</tr>
<? endif; ?>
<? if ($id === 'not_grouped' || isset($open[$id])): ?>
<? if ($id === 'not_grouped' || in_array($id, $open)): ?>
<? foreach ($members as $member): ?>
<tr>
<td class="gruppe<?= $seminars[$member['seminar_id']]['gruppe'] ?>">&nbsp;</td>
......
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