diff --git a/Modules/Test/classes/class.ilTestParticipantsGUI.php b/Modules/Test/classes/class.ilTestParticipantsGUI.php index b010b2e6cd94..3239c6f86d91 100644 --- a/Modules/Test/classes/class.ilTestParticipantsGUI.php +++ b/Modules/Test/classes/class.ilTestParticipantsGUI.php @@ -244,43 +244,31 @@ public function showCmd(): void protected function applyFilterCriteria(array $in_rows): array { - $selected_pax = ilSession::get('form_tst_participants_' . $this->getTestObj()->getRefId()); + $selected_pax = ilSession::get('form_tst_participants_' . $this->getTestObj()->getRefId() . '_selection'); - if ($selected_pax === null || !isset($selected_pax['selection'])) { + if ($selected_pax === null) { return $in_rows; } - $sess_filter = $selected_pax['selection']; - $sess_filter = str_replace('"', '', $sess_filter); - $sess_filter = explode(':', $sess_filter); - $filter = substr($sess_filter[2], 0, strlen($sess_filter[2]) - 1); + $filter = unserialize($selected_pax, ['allowed_classes' => false]); - if ($filter == 'all' || $filter == false) { - return $in_rows; #unchanged - no filter. + if (!is_string($filter) || $filter === 'all') { + return $in_rows; } - $with_result = array(); - $without_result = array(); + $with_result = []; + $without_result = []; foreach ($in_rows as $row) { $result = $this->db->query( 'SELECT count(solution_id) count FROM tst_solutions WHERE active_fi = ' . $this->db->quote($row['active_id']) ); - $count = $this->db->fetchAssoc($result); - $count = $count['count']; - if ($count == 0) { - $without_result[] = $row; - } else { - $with_result[] = $row; - } + $this->db->fetchAssoc($result)['count'] === 0 ? $without_result[] = $row : $with_result[] = $row; } - if ($filter == 'withSolutions') { - return $with_result; - } - return $without_result; + return $filter === 'withSolutions' ? $with_result : $without_result; } protected function initToolbarControls(ilTestParticipantList $participant_list): void