addElement('select', 'session_id', get_lang('Sessions'), $my_session_list); $form->addButtonFilter(get_lang('Filter')); if (!empty($_REQUEST['score'])) { $filter_score = intval($_REQUEST['score']); } else { $filter_score = 70; } if (!empty($_REQUEST['session_id'])) { $session_id = intval($_REQUEST['session_id']); } else { $session_id = 0; } if (empty($session_id)) { $session_id = key($my_session_list); } $form->setDefaults(['session_id' => $session_id]); $course_list = SessionManager::get_course_list_by_session_id($session_id); if (!$export_to_xls) { Display :: display_header(get_lang("MySpace")); echo '
'.get_lang('User').' | '; foreach ($course_list as $item) { $html_result .= ''.$item['title'].' '.get_lang('AverageScore').' % | ';
}
$html_result .= ''.get_lang('AverageScore').' % | '; $html_result .= ''.get_lang('LastConnexionDate').' |
---|---|---|---|
"; $html_result .= $user['firstname'].' '.$user['lastname']; $html_result .= " | "; // Getting course list $counter = 0; $total_result_by_user = 0; foreach ($course_list as $current_course) { $total_course = 0; $html_result .= ""; $result = '-'; if (isset($main_result[$current_course['code']][$user['user_id']])) { $user_info_stat = $main_result[$current_course['code']][$user['user_id']]; if (!empty($user_info_stat['result']) && !empty($user_info_stat['attempts'])) { $result = round( $user_info_stat['result'] / $user_info_stat['attempts'] * 100, 2 ); $total_course += $result; $total_result_by_user += $result; $course_average[$current_course['code']] += $total_course; $course_average_counter[$current_course['code']]++; $result = $result.' ('.$user_info_stat['attempts'].' '.get_lang('Attempts').')'; $counter++; } } $html_result .= $result; $html_result .= " | "; } if (empty($counter)) { $total_student = '-'; } else { $total_student = $total_result_by_user / $counter; $total_average_score += $total_student; $total_average_score_count++; } $string_date = Tracking::get_last_connection_date($user['user_id'], true); $html_result .= "$total_student | $string_date |
".get_lang('AverageScore')." | "; $total_average = 0; $counter = 0; foreach ($course_list as $course_item) { if (!empty($course_average_counter[$course_item['code']])) { $average_per_course = round( $course_average[$course_item['code']] / ($course_average_counter[$course_item['code']] * 100) * 100, 2 ); } else { $average_per_course = 0; } if (!empty($average_per_course)) { $counter++; } $total_average = $total_average + $average_per_course; $html_result .= "$average_per_course | "; } if (!empty($total_average_score_count)) { $total_average = round($total_average_score / ($total_average_score_count * 100) * 100, 2); } else { $total_average = '-'; } $html_result .= ''.$total_average.' | '; $html_result .= "- | "; $html_result .= "