Skip to content

Commit 23655e6

Browse files
authored
Merge pull request #7115 from christianbeeznest/contidos-23109-2
Tracking: Use advanced session multiselect in certificates session report - refs BT#23109
2 parents 2510202 + 288a830 commit 23655e6

File tree

1 file changed

+18
-15
lines changed

1 file changed

+18
-15
lines changed

main/mySpace/session_filter.php

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
$whereCondictionMultiUrl = " AND session_rel_user.user_id = ".api_get_user_id();
4949
}
5050

51-
// Select sessions.
51+
// Select sessions the user can see.
5252
$sql = "SELECT s.id, name FROM $tblSession s
5353
$innerJoinSessionRelUser
5454
$whereCondictionDRH
@@ -69,24 +69,27 @@
6969
}
7070
$result = Database::query($sql);
7171
$Sessions = Database::store_result($result);
72-
$options = [];
73-
$options['0'] = '';
74-
foreach ($Sessions as $enreg) {
75-
$options[$enreg['id']] = $enreg['name'];
72+
73+
// Build choices array for the advanced multi-select.
74+
$sessionChoices = [];
75+
foreach ($Sessions as $row) {
76+
$sessionChoices[$row['id']] = $row['name'];
7677
}
7778

78-
// Multi-select to allow selecting several sessions at once.
79-
$form->addElement(
80-
'select',
79+
80+
$sessionMultiSelect = $form->addElement(
81+
'advmultiselect',
8182
'session_id',
82-
get_lang('SessionList'),
83-
$options,
84-
[
85-
'id' => 'session-id',
86-
'multiple' => 'multiple',
87-
'size' => 10,
88-
]
83+
null,
84+
$sessionChoices
8985
);
86+
87+
$sessionMultiSelect->setLabel([
88+
get_lang('SessionList'),
89+
get_lang('UserNotSubscribed'),
90+
get_lang('Subscribed'),
91+
]);
92+
9093
$form->addDatePicker('date_begin', get_lang('DateStart'), ['id' => 'date-begin']);
9194
$form->addDatePicker('date_end', get_lang('DateEnd'), ['id' => 'date-end']);
9295

0 commit comments

Comments
 (0)