public/main/tracking/lp_results_by_user.php
Avoid using undefined variables such as '$header' which will lead to PHP notices. Open
Open
$header[] = [
- Read upRead up
- Exclude checks
UndefinedVariable
Since: 2.8.0
Detects when a variable is used that has not been defined before.
Example
class Foo
{
private function bar()
{
// $message is undefined
echo $message;
}
}
Source https://phpmd.org/rules/cleancode.html#undefinedvariable
Avoid using undefined variables such as '$header' which will lead to PHP notices. Open
Open
$array = array_merge($header, $array);
- Read upRead up
- Exclude checks
UndefinedVariable
Since: 2.8.0
Detects when a variable is used that has not been defined before.
Example
class Foo
{
private function bar()
{
// $message is undefined
echo $message;
}
}
Source https://phpmd.org/rules/cleancode.html#undefinedvariable
Variable "temp_course_item" is not in valid camel caps format Open
Open
$course_item = api_get_course_info($temp_course_item['code']);
- Exclude checks
Variable "current_course" is not in valid camel caps format Open
Open
$course_list = [$current_course];
- Exclude checks
Variable "course_list" is not in valid camel caps format Open
Open
foreach ($course_list as $data) {
- Exclude checks
Variable "selected_course" is not in valid camel caps format Open
Open
$selected_course = api_get_course_info($selected_course);
- Exclude checks
Variable "filter_score" is not in valid camel caps format Open
Open
echo '<div style="float:right"> <a href="'.api_get_self().'?export=1&score='.$filter_score.'&exercise_id='.$exercise_id.'">
- Exclude checks
Variable "menu_items" is not in valid camel caps format Open
Open
$menu_items[] = '<a href="'.api_get_path(WEB_CODE_PATH).'my_space/index.php?view=teacher">'.get_lang('Trainer View').'</a>';
- Exclude checks
Variable "session_id" is not in valid camel caps format Open
Open
$list = new LearnpathList('', $course_info, $session_id);
- Exclude checks
Variable "lp_list" is not in valid camel caps format Open
Open
foreach ($lp_list as $lp_id => $lp) {
- Exclude checks
Variable "exercise_data" is not in valid camel caps format Open
Open
foreach ($exercises as $exercise_id => $exercise_data) {
- Exclude checks
Variable "temp_course_list" is not in valid camel caps format Open
Open
$temp_course_list = CourseManager :: get_courses_list();
- Exclude checks
Variable "lp_id" is not in valid camel caps format Open
Open
$html_result .= Display::tag('td', $lp_list_name[$lp_id]);
- Exclude checks
Variable "new_course_select" is not in valid camel caps format Open
Open
$new_course_select
- Exclude checks
Variable "attempt_data" is not in valid camel caps format Open
Open
$html_result .= Display::tag('td', api_get_local_time($attempt_data['exe_date']));
- Exclude checks
Variable "menu_items" is not in valid camel caps format Open
Open
$menu_items[] = get_lang('Exam tracking');
- Exclude checks
Variable "attempt_data" is not in valid camel caps format Open
Open
api_get_local_time($attempt_data['exe_date']),
- Exclude checks
Variable "lp_id" is not in valid camel caps format Open
Open
$lps[$lp_id] = ['lp_name' => $lp['lp_name'], 'exercises' => $attempt_result];
- Exclude checks
Variable "export_to_csv" is not in valid camel caps format Open
Open
if (!$export_to_csv) {
- Exclude checks
Variable "user_list" is not in valid camel caps format Open
Open
foreach ($user_list as $user_id) {
- Exclude checks
Variable "main_result" is not in valid camel caps format Open
Open
if (!empty($main_result)) {
- Exclude checks
Variable "exercise_id" is not in valid camel caps format Open
Open
foreach ($exercises as $exercise_id => $exercise_data) {
- Exclude checks
Variable "exercise_id" is not in valid camel caps format Open
Open
$exercise_id = null;
- Exclude checks
Variable "course_item" is not in valid camel caps format Open
Open
'code' => $course_item['code'],
- Exclude checks
Variable "html_result" is not in valid camel caps format Open
Open
$html_result .= '</tr>';
- Exclude checks
Variable "html_result" is not in valid camel caps format Open
Open
$html_result .= '<tr colspan="">';
- Exclude checks
Variable "exercise_id" is not in valid camel caps format Open
Open
echo '<div style="float:right"> <a href="'.api_get_self().'?export=1&score='.$filter_score.'&exercise_id='.$exercise_id.'">
- Exclude checks
Variable "menu_items" is not in valid camel caps format Open
Open
$menu_items[] = '<a href="'.api_get_path(WEB_CODE_PATH).'my_space/index.php?view=coach">'.get_lang('Admin view').'</a>';
- Exclude checks
Variable "lp_id" is not in valid camel caps format Open
Open
foreach ($lp_list as $lp_id => $lp) {
- Exclude checks
Variable "attempt_result" is not in valid camel caps format Open
Open
$lps[$lp_id] = ['lp_name' => $lp['lp_name'], 'exercises' => $attempt_result];
- Exclude checks
Variable "html_result" is not in valid camel caps format Open
Open
$html_result .= '<th>'.get_lang('Attempt').'</th>';
- Exclude checks
Variable "lp_id" is not in valid camel caps format Open
Open
foreach ($lps as $lp_id => $lp_data) {
- Exclude checks
Variable "exercise_data" is not in valid camel caps format Open
Open
$users = $exercise_data['users'];
- Exclude checks
Variable "user_id" is not in valid camel caps format Open
Open
$html_result .= Display::tag('td', $user_list_name[$user_id]);
- Exclude checks
Variable "attempt_data" is not in valid camel caps format Open
Open
$result = $attempt_data['score'].' / '.$attempt_data['max_score'];
- Exclude checks
Variable "user_id" is not in valid camel caps format Open
Open
$user_list_name[$user_id],
- Exclude checks
Variable "export_to_csv" is not in valid camel caps format Open
Open
if ($export_to_csv) {
- Exclude checks
Variable "export_to_csv" is not in valid camel caps format Open
Open
$export_to_csv = true;
- Exclude checks
Variable "course_list" is not in valid camel caps format Open
Open
$course_list = [$current_course];
- Exclude checks
Variable "new_course_select" is not in valid camel caps format Open
Open
$new_course_select = [];
- Exclude checks
Variable "new_course_select" is not in valid camel caps format Open
Open
$new_course_select[$data['code']] = $data['title'];
- Exclude checks
Variable "selected_course" is not in valid camel caps format Open
Open
$course_list = [$selected_course];
- Exclude checks
Variable "lp_data" is not in valid camel caps format Open
Open
foreach ($lps as $lp_id => $lp_data) {
- Exclude checks
Variable "exe_id" is not in valid camel caps format Open
Open
foreach ($attempts as $exe_id => $attempt_data) {
- Exclude checks
Variable "course_code" is not in valid camel caps format Open
Open
$html_result .= Display::tag('td', $course_code);
- Exclude checks
Variable "is_allowedToTrack" is not in valid camel caps format Open
Open
$is_allowedToTrack = Tracking::isAllowToTrack(api_get_session_id());
- Exclude checks
Variable "t_quiz" is not in valid camel caps format Open
Open
$t_quiz = Database::get_course_table(TABLE_QUIZ_TEST);
- Exclude checks
Variable "nb_menu_items" is not in valid camel caps format Open
Open
if ($key != $nb_menu_items - 1) {
- Exclude checks
Variable "filter_score" is not in valid camel caps format Open
Open
echo '<a href="'.api_get_self().'?export=1&score='.$filter_score.'&exercise_id='.$exercise_id.'">
- Exclude checks
Variable "user_list" is not in valid camel caps format Open
Open
$user_list = [];
- Exclude checks
Variable "current_course" is not in valid camel caps format Open
Open
foreach ($course_list as $current_course) {
- Exclude checks
Variable "exercise_stats" is not in valid camel caps format Open
Open
foreach ($exercise_stats as $stats) {
- Exclude checks
Variable "lp_id" is not in valid camel caps format Open
Open
$lp_list_name[$lp_id] = $lp['lp_name'];
- Exclude checks
Variable "user_list" is not in valid camel caps format Open
Open
if (!empty($user_list)) {
- Exclude checks
Variable "html_result" is not in valid camel caps format Open
Open
$html_result .= '<th>'.get_lang('Test').'</th>';
- Exclude checks
Variable "user_id" is not in valid camel caps format Open
Open
foreach ($users as $user_id => $attempts) {
- Exclude checks
Variable "user_list_name" is not in valid camel caps format Open
Open
$html_result .= Display::tag('td', $user_list_name[$user_id]);
- Exclude checks
Variable "lp_list_name" is not in valid camel caps format Open
Open
$lp_list_name[$lp_id],
- Exclude checks
Variable "lp_id" is not in valid camel caps format Open
Open
$lp_list_name[$lp_id],
- Exclude checks
Variable "user_list_name" is not in valid camel caps format Open
Open
$user_list_name[$user_id],
- Exclude checks
Variable "course_id" is not in valid camel caps format Open
Open
$course_id = api_get_course_int_id();
- Exclude checks
Variable "t_quiz" is not in valid camel caps format Open
Open
$sqlExercices = "SELECT quiz.title,iid FROM ".$t_quiz." AS quiz
- Exclude checks
Variable "menu_items" is not in valid camel caps format Open
Open
$nb_menu_items = count($menu_items);
- Exclude checks
Variable "exercise_list_name" is not in valid camel caps format Open
Open
$exercise_list_name[$exercise['id']] = $exercise['title'];
- Exclude checks
Variable "user_id" is not in valid camel caps format Open
Open
$user_data = api_get_user_info($user_id);
- Exclude checks
Variable "html_result" is not in valid camel caps format Open
Open
$html_result .= Display::tag('td', $attempt);
- Exclude checks
Variable "html_result" is not in valid camel caps format Open
Open
$html_result .= '</table>';
- Exclude checks
Variable "is_allowedToTrack" is not in valid camel caps format Open
Open
if (!$is_allowedToTrack) {
- Exclude checks
Variable "course_list" is not in valid camel caps format Open
Open
foreach ($course_list as $current_course) {
- Exclude checks
Variable "exercise_list" is not in valid camel caps format Open
Open
$exercise_list = Event::get_all_exercises_from_lp($lp_id);
- Exclude checks
Variable "user_list" is not in valid camel caps format Open
Open
$user_list[$stats['exe_user_id']] = $stats['exe_user_id'];
- Exclude checks
Variable "this_section" is not in valid camel caps format Open
Open
$this_section = SECTION_TRACKING;
- Exclude checks
Variable "_course" is not in valid camel caps format Open
Open
$current_course['code'] = $_course['id'];
- Exclude checks
Variable "exercise_list" is not in valid camel caps format Open
Open
$exercise_list[0] = get_lang('All');
- Exclude checks
Variable "menu_items" is not in valid camel caps format Open
Open
foreach ($menu_items as $key => $item) {
- Exclude checks
Variable "user_data" is not in valid camel caps format Open
Open
$user_data = api_get_user_info($user_id);
- Exclude checks
Variable "user_list_name" is not in valid camel caps format Open
Open
$user_list_name[$user_id] = api_get_person_name(
- Exclude checks
Variable "html_result" is not in valid camel caps format Open
Open
$html_result .= '<tr><th>'.get_lang('Course').'</th>';
- Exclude checks
Variable "html_result" is not in valid camel caps format Open
Open
$html_result .= '<th>'.get_lang('Date').'</th>';
- Exclude checks
Variable "course_code" is not in valid camel caps format Open
Open
foreach ($main_result as $course_code => $lps) {
- Exclude checks
Variable "exercise_id" is not in valid camel caps format Open
Open
$html_result .= Display::tag('td', $exercise_list_name[$exercise_id]);
- Exclude checks
Variable "course_code" is not in valid camel caps format Open
Open
$course_code,
- Exclude checks
Variable "exercise_list_name" is not in valid camel caps format Open
Open
$exercise_list_name[$exercise_id],
- Exclude checks
Variable "_course" is not in valid camel caps format Open
Open
$_course = api_get_course_info();
- Exclude checks
Variable "export_to_csv" is not in valid camel caps format Open
Open
$export_to_csv = false;
- Exclude checks
Variable "course_item" is not in valid camel caps format Open
Open
'title' => $course_item['title'],
- Exclude checks
Variable "a_exercices" is not in valid camel caps format Open
Open
$exercise_list[$a_exercices['iid']] = $a_exercices['title'];
- Exclude checks
Variable "selected_course" is not in valid camel caps format Open
Open
$selected_course = api_get_course_info($selected_course);
- Exclude checks
Variable "exercise_id" is not in valid camel caps format Open
Open
echo '<a href="'.api_get_self().'?export=1&score='.$filter_score.'&exercise_id='.$exercise_id.'">
- Exclude checks
Variable "_course" is not in valid camel caps format Open
Open
$_course = $course_info;
- Exclude checks
Variable "attempt_result" is not in valid camel caps format Open
Open
$attempt_result = [];
- Exclude checks
Variable "export_array" is not in valid camel caps format Open
Open
$export_array = [];
- Exclude checks
Variable "html_result" is not in valid camel caps format Open
Open
$html_result .= '<th>'.get_lang('Learning paths').'</th>';
- Exclude checks
Variable "html_result" is not in valid camel caps format Open
Open
$html_result .= Display::tag('td', $lp_list_name[$lp_id]);
- Exclude checks
Variable "a_exercices" is not in valid camel caps format Open
Open
while ($a_exercices = Database::fetch_array($resultExercices)) {
- Exclude checks
Variable "selected_course" is not in valid camel caps format Open
Open
$selected_course = $_REQUEST['course_code'];
- Exclude checks
Variable "main_result" is not in valid camel caps format Open
Open
$main_result = [];
- Exclude checks
Variable "course_info" is not in valid camel caps format Open
Open
$course_info = api_get_course_info($current_course['code']);
- Exclude checks
Variable "lp_list_name" is not in valid camel caps format Open
Open
$lp_list_name[$lp_id] = $lp['lp_name'];
- Exclude checks
Variable "user_id" is not in valid camel caps format Open
Open
$user_list_name[$user_id] = api_get_person_name(
- Exclude checks
Variable "user_data" is not in valid camel caps format Open
Open
$user_data['firstname'],
- Exclude checks
Variable "html_result" is not in valid camel caps format Open
Open
$html_result .= '<th>'.get_lang('Results and feedback and feedback').'</th>';
- Exclude checks
Variable "main_result" is not in valid camel caps format Open
Open
foreach ($main_result as $course_code => $lps) {
- Exclude checks
Variable "exercise_list_name" is not in valid camel caps format Open
Open
$html_result .= Display::tag('td', $exercise_list_name[$exercise_id]);
- Exclude checks
Variable "html_result" is not in valid camel caps format Open
Open
$html_result .= Display::tag('td', $user_list_name[$user_id]);
- Exclude checks
Variable "temp_course_item" is not in valid camel caps format Open
Open
foreach ($temp_course_list as $temp_course_item) {
- Exclude checks
Variable "course_list" is not in valid camel caps format Open
Open
$course_list[] = [
- Exclude checks
Variable "menu_items" is not in valid camel caps format Open
Open
$menu_items[] = '<a href="'.api_get_path(WEB_CODE_PATH).'my_space/index.php?view=admin">'.get_lang('Admin view').'</a>';
- Exclude checks
Variable "course_info" is not in valid camel caps format Open
Open
$_course = $course_info;
- Exclude checks
Variable "session_id" is not in valid camel caps format Open
Open
$session_id
- Exclude checks
Variable "main_result" is not in valid camel caps format Open
Open
$main_result[$current_course['code']] = $lps;
- Exclude checks
Variable "lp_data" is not in valid camel caps format Open
Open
$exercises = $lp_data['exercises'];
- Exclude checks
Variable "html_result" is not in valid camel caps format Open
Open
$html_result .= Display::tag('td', $course_code);
- Exclude checks
Variable "export_array" is not in valid camel caps format Open
Open
$export_array[] = [
- Exclude checks
Variable "export_array" is not in valid camel caps format Open
Open
export_complete_report_csv($filename, $export_array);
- Exclude checks
Variable "temp_course_list" is not in valid camel caps format Open
Open
foreach ($temp_course_list as $temp_course_item) {
- Exclude checks
Variable "exercise_list" is not in valid camel caps format Open
Open
$form->addSelect('exercise_id', get_lang('Test'), $exercise_list);
- Exclude checks
Variable "exercise_list" is not in valid camel caps format Open
Open
foreach ($exercise_list as $exercise) {
- Exclude checks
Variable "exercise_stats" is not in valid camel caps format Open
Open
$exercise_stats = Event::get_all_exercise_event_from_lp(
- Exclude checks
Variable "current_course" is not in valid camel caps format Open
Open
$main_result[$current_course['code']] = $lps;
- Exclude checks
Variable "attempt_data" is not in valid camel caps format Open
Open
foreach ($attempts as $exe_id => $attempt_data) {
- Exclude checks
Variable "exercise_list" is not in valid camel caps format Open
Open
$exercise_list[$a_exercices['iid']] = $a_exercices['title'];
- Exclude checks
Variable "a_exercices" is not in valid camel caps format Open
Open
$exercise_list[$a_exercices['iid']] = $a_exercices['title'];
- Exclude checks
Variable "course_list" is not in valid camel caps format Open
Open
$course_list = [$selected_course];
- Exclude checks
Variable "nb_menu_items" is not in valid camel caps format Open
Open
$nb_menu_items = count($menu_items);
- Exclude checks
Variable "session_id" is not in valid camel caps format Open
Open
$session_id = 0;
- Exclude checks
Variable "lp_list" is not in valid camel caps format Open
Open
$lp_list = $list->get_flat_list();
- Exclude checks
Variable "attempt_result" is not in valid camel caps format Open
Open
$attempt_result[$exercise['id']]['users'][$stats['exe_user_id']][$stats['exe_id']] = $stats;
- Exclude checks
Variable "html_result" is not in valid camel caps format Open
Open
$html_result = '<table class="data_table">';
- Exclude checks
Variable "html_result" is not in valid camel caps format Open
Open
$html_result .= Display::tag('td', $result);
- Exclude checks
Variable "exercise_id" is not in valid camel caps format Open
Open
$exercise_list_name[$exercise_id],
- Exclude checks
Variable "course_item" is not in valid camel caps format Open
Open
$course_item = api_get_course_info($temp_course_item['code']);
- Exclude checks
Variable "current_course" is not in valid camel caps format Open
Open
$current_course['code'] = $_course['id'];
- Exclude checks
Variable "export_to_csv" is not in valid camel caps format Open
Open
if (!$export_to_csv) {
- Exclude checks
Variable "user_data" is not in valid camel caps format Open
Open
$user_data['lastname']
- Exclude checks
Variable "lp_list_name" is not in valid camel caps format Open
Open
$html_result .= Display::tag('td', $lp_list_name[$lp_id]);
- Exclude checks
Variable "html_result" is not in valid camel caps format Open
Open
$html_result .= Display::tag('td', $exercise_list_name[$exercise_id]);
- Exclude checks
Variable "attempt_data" is not in valid camel caps format Open
Open
$result = $attempt_data['score'].' / '.$attempt_data['max_score'];
- Exclude checks
Missing function doc comment Open
Open
function export_complete_report_csv($filename, $array)
- Exclude checks
Variable "filter_score" is not in valid camel caps format Open
Open
$filter_score = null;
- Exclude checks
Variable "course_id" is not in valid camel caps format Open
Open
WHERE c_id = $course_id AND active='1'
- Exclude checks
Variable "selected_course" is not in valid camel caps format Open
Open
if (!empty($selected_course)) {
- Exclude checks
Variable "nb_menu_items" is not in valid camel caps format Open
Open
if ($nb_menu_items > 1) {
- Exclude checks
Variable "current_course" is not in valid camel caps format Open
Open
$course_info = api_get_course_info($current_course['code']);
- Exclude checks
Variable "course_info" is not in valid camel caps format Open
Open
$list = new LearnpathList('', $course_info, $session_id);
- Exclude checks
Variable "lp_id" is not in valid camel caps format Open
Open
$exercise_list = Event::get_all_exercises_from_lp($lp_id);
- Exclude checks
Variable "course_info" is not in valid camel caps format Open
Open
$course_info['real_id'],
- Exclude checks
Variable "user_id" is not in valid camel caps format Open
Open
foreach ($user_list as $user_id) {
- Exclude checks
Variable "html_result" is not in valid camel caps format Open
Open
$html_result .= '<th>'.get_lang('User').'</th>';
- Exclude checks
Variable "html_result" is not in valid camel caps format Open
Open
$html_result .= Display::tag('td', api_get_local_time($attempt_data['exe_date']));
- Exclude checks
Variable "html_result" is not in valid camel caps format Open
Open
$html_result .= '</tr>';
- Exclude checks
Variable "html_result" is not in valid camel caps format Open
Open
echo $html_result;
- Exclude checks
Consider putting global function "export_complete_report_csv" in a static class Open
Open
function export_complete_report_csv($filename, $array)
- Exclude checks