diff --git a/main/img/info3.gif b/main/img/info3.gif index 673d4b9d94..cc6cef3eb8 100644 Binary files a/main/img/info3.gif and b/main/img/info3.gif differ diff --git a/main/mySpace/access_details.php b/main/mySpace/access_details.php index bffab34626..c2642e4e77 100644 --- a/main/mySpace/access_details.php +++ b/main/mySpace/access_details.php @@ -98,72 +98,72 @@ if (api_is_xml_http_request()) { $main_date = $main_date[$labels]; } - $DataSet = new pData; - $DataSet->AddPoint($main_date, 'Q'); + $data_set = new pData; + $data_set->AddPoint($main_date, 'Q'); if (count($main_date)!= 1) { - $DataSet->AddPoint($labels, 'Date'); + $data_set->AddPoint($labels, 'Date'); } - $DataSet->AddAllSeries(); - $DataSet->RemoveSerie('Date'); - $DataSet->SetAbsciseLabelSerie('Date'); - $DataSet->SetYAxisName(get_lang('Minutes', '')); + $data_set->AddAllSeries(); + $data_set->RemoveSerie('Date'); + $data_set->SetAbsciseLabelSerie('Date'); + $data_set->SetYAxisName(get_lang('Minutes', '')); $graph_id = api_get_user_id().'AccessDetails'.api_get_course_id(); - $DataSet->AddAllSeries(); + $data_set->AddAllSeries(); - $Cache = new pCache(); + $cache = new pCache(); // the graph id - $data = $DataSet->GetData(); + $data = $data_set->GetData(); - if ($Cache->IsInCache($graph_id, $DataSet->GetData())) { + if ($cache->IsInCache($graph_id, $data_set->GetData())) { //if (0) { //if we already created the img // echo 'in cache'; - $img_file = $Cache->GetHash($graph_id, $DataSet->GetData()); + $img_file = $cache->GetHash($graph_id, $data_set->GetData()); } else { // if the image does not exist in the archive/ folder // Initialise the graph - $Test = new pChart(760, 230); + $test = new pChart(760, 230); //which schema of color will be used $quant_resources = count($data[0]) - 1; // Adding the color schemma - $Test->loadColorPalette(api_get_path(LIBRARY_PATH).'pchart/palette/default.txt'); - - $Test->setFontProperties(api_get_path(LIBRARY_PATH).'pchart/fonts/tahoma.ttf', 8); - $Test->setGraphArea(70, 30, 680, 200); - $Test->drawFilledRoundedRectangle(7, 7, 693, 223, 5, 240, 240, 240); - $Test->drawRoundedRectangle(5, 5, 695, 225, 5, 230, 230, 230); - $Test->drawGraphArea(255, 255, 255, TRUE); - $Test->drawScale($DataSet->GetData(), $DataSet->GetDataDescription(), SCALE_START0, 150, 150, 150, TRUE, 0, 0); - $Test->drawGrid(4, TRUE, 230, 230, 230, 50); - $Test->setLineStyle(2); + $test->loadColorPalette(api_get_path(LIBRARY_PATH).'pchart/palette/default.txt'); + + $test->setFontProperties(api_get_path(LIBRARY_PATH).'pchart/fonts/tahoma.ttf', 8); + $test->setGraphArea(70, 30, 680, 200); + $test->drawFilledRoundedRectangle(7, 7, 693, 223, 5, 240, 240, 240); + $test->drawRoundedRectangle(5, 5, 695, 225, 5, 230, 230, 230); + $test->drawGraphArea(255, 255, 255, TRUE); + $test->drawScale($data_set->GetData(), $data_set->GetDataDescription(), SCALE_START0, 150, 150, 150, TRUE, 0, 0); + $test->drawGrid(4, TRUE, 230, 230, 230, 50); + $test->setLineStyle(2); // Draw the 0 line - $Test->setFontProperties(api_get_path(LIBRARY_PATH).'pchart/fonts/tahoma.ttf', 6); - $Test->drawTreshold(0, 143, 55, 72, TRUE, TRUE); + $test->setFontProperties(api_get_path(LIBRARY_PATH).'pchart/fonts/tahoma.ttf', 6); + $test->drawTreshold(0, 143, 55, 72, TRUE, TRUE); if (count($main_date) == 1) { //Draw a graph echo ''.$labels.'
'; - $Test->drawBarGraph($DataSet->GetData(), $DataSet->GetDataDescription(), TRUE); + $test->drawBarGraph($data_set->GetData(), $data_set->GetDataDescription(), TRUE); } else { //Draw the line graph - $Test->drawLineGraph($DataSet->GetData(), $DataSet->GetDataDescription()); - $Test->drawPlotGraph($DataSet->GetData(), $DataSet->GetDataDescription(), 3, 2, 255, 255, 255); + $test->drawLineGraph($data_set->GetData(), $data_set->GetDataDescription()); + $test->drawPlotGraph($data_set->GetData(), $data_set->GetDataDescription(), 3, 2, 255, 255, 255); } // Finish the graph - $Test->setFontProperties(api_get_path(LIBRARY_PATH).'pchart/fonts/tahoma.ttf', 8); + $test->setFontProperties(api_get_path(LIBRARY_PATH).'pchart/fonts/tahoma.ttf', 8); - $Test->setFontProperties(api_get_path(LIBRARY_PATH).'pchart/fonts/tahoma.ttf', 10); - $Test->drawTitle(60, 22, get_lang('AccessDetails', ''), 50, 50, 50, 585); + $test->setFontProperties(api_get_path(LIBRARY_PATH).'pchart/fonts/tahoma.ttf', 10); + $test->drawTitle(60, 22, get_lang('AccessDetails', ''), 50, 50, 50, 585); //------------------ //echo 'not in cache'; - $Cache->WriteToCache($graph_id, $DataSet->GetData(), $Test); + $cache->WriteToCache($graph_id, $data_set->GetData(), $test); ob_start(); - $Test->Stroke(); + $test->Stroke(); ob_end_clean(); - $img_file = $Cache->GetHash($graph_id, $DataSet->GetData()); + $img_file = $cache->GetHash($graph_id, $data_set->GetData()); } echo ''; } else { @@ -199,8 +199,8 @@ $(function() { '; Display :: display_header(''); -$TBL_USERINFO_DEF = Database :: get_course_table(TABLE_USER_INFO); -$mainUserInfo = api_get_user_info($user_id); +$tbl_userinfo_def = Database :: get_course_table(TABLE_USER_INFO); +$main_user_info = api_get_user_info($user_id); $result_to_print = ''; $main_date_array = array(); @@ -210,7 +210,7 @@ foreach ($connections as $key => $data) { } api_display_tool_title(get_lang('DetailsStudentInCourse')); echo '
'; -echo ''.get_lang('User').': '.api_get_person_name($mainUserInfo['firstName'], $mainUserInfo['lastName']).'     '.get_lang('Course').': '.$course_code.'
'; +echo ''.get_lang('User').': '.api_get_person_name($main_user_info['firstName'], $main_user_info['lastName']).'     '.get_lang('Course').': '.$course_code.''; ?>
@@ -313,10 +313,10 @@ function get_connections_to_course_by_time($user_id, $course_code, $year = '', $ $rs = Database::query($sql, __FILE__, __LINE__); $connections = array(); while ($row = Database::fetch_array($rs)) { - $login_date = $row['login_course_date']; - $logout_date = $row['logout_course_date']; - $timestamp_login_date = strtotime($login_date); - $timestamp_logout_date = strtotime($logout_date); + $login_date = $row['login_course_date']; + $logout_date = $row['logout_course_date']; + $timestamp_login_date = strtotime($login_date); + $timestamp_logout_date = strtotime($logout_date); $connections[] = array('login' => $timestamp_login_date, 'logout' => $timestamp_logout_date); } return $connections; diff --git a/main/mySpace/index.php b/main/mySpace/index.php index 06bad5ecfc..38b33a76c6 100755 --- a/main/mySpace/index.php +++ b/main/mySpace/index.php @@ -60,8 +60,8 @@ function count_teacher_courses() { } function count_coaches() { - global $total_no_coachs; - return $total_no_coachs; + global $total_no_coaches; + return $total_no_coaches; } function sort_users($a, $b) { @@ -77,8 +77,8 @@ function rsort_users($a, $b) { * MAIN CODE ***************************/ -$isCoach = api_is_coach(); -$isPlatformAdmin = api_is_platform_admin(); +$is_coach = api_is_coach(); +$is_platform_admin = api_is_platform_admin(); $view = isset($_GET['view']) ? $_GET['view'] : 'teacher'; @@ -86,7 +86,7 @@ $menu_items = array(); global $_configuration; if (api_is_allowed_to_create_course()) { - $sqlNbCours = "SELECT course_rel_user.course_code, course.title + $sql_nb_cours = "SELECT course_rel_user.course_code, course.title FROM $tbl_course_user as course_rel_user INNER JOIN $tbl_course as course ON course.code = course_rel_user.course_code @@ -94,10 +94,10 @@ if (api_is_allowed_to_create_course()) { ORDER BY course.title"; if ($_configuration['multiple_access_urls'] == true) { - $tbl_course_rel_access_url= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE); + $tbl_course_rel_access_url = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE); $access_url_id = api_get_current_access_url_id(); if ($access_url_id != -1) { - $sqlNbCours = " SELECT course_rel_user.course_code, course.title + $sql_nb_cours = " SELECT course_rel_user.course_code, course.title FROM $tbl_course_user as course_rel_user INNER JOIN $tbl_course as course ON course.code = course_rel_user.course_code @@ -108,12 +108,12 @@ if (api_is_allowed_to_create_course()) { } } - $resultNbCours = Database::query($sqlNbCours, __FILE__, __LINE__); - $a_courses = api_store_result($resultNbCours); + $result_nb_cours = Database::query($sql_nb_cours, __FILE__, __LINE__); + $courses = api_store_result($result_nb_cours); - $nb_teacher_courses = count($a_courses); + $nb_teacher_courses = count($courses); if ($nb_teacher_courses) { - if (!$isCoach && !api_is_platform_admin()) { + if (!$is_coach && !$is_platform_admin) { $view = 'teacher'; } if ($view == 'teacher') { @@ -124,8 +124,8 @@ if (api_is_allowed_to_create_course()) { } } } -if ($isCoach) { - if ($nb_teacher_courses == 0 && !api_is_platform_admin()) { +if ($is_coach) { + if ($nb_teacher_courses == 0 && !$is_platform_admin) { $view = 'coach'; } if ($view == 'coach') { @@ -135,8 +135,8 @@ if ($isCoach) { $menu_items[] = ''.get_lang('CoachInterface').''; } } -if (api_is_platform_admin()) { - if (!$isCoach && $nb_teacher_courses == 0) { +if ($is_platform_admin) { + if (!$is_coach && $nb_teacher_courses == 0) { $view = 'admin'; } if ($view == 'admin') { @@ -168,28 +168,28 @@ echo '
'; echo '

'.$title.'

'; if ($_user['status'] == DRH && $view == 'drh') { - $a_students = Tracking :: get_student_followed_by_drh($_user['user_id']); + $students = Tracking :: get_student_followed_by_drh($_user['user_id']); $courses_of_the_platform = CourseManager :: get_real_course_list(); foreach ($courses_of_the_platform as $course) { - $a_courses[$course['code']] = $course['code']; + $courses[$course['code']] = $course['code']; } } -if ($isCoach && $view == 'coach') { - $a_students = Tracking :: get_student_followed_by_coach($_user['user_id']); - $a_courses = Tracking :: get_courses_followed_by_coach($_user['user_id']); +if ($is_coach && $view == 'coach') { + $students = Tracking :: get_student_followed_by_coach($_user['user_id']); + $courses = Tracking :: get_courses_followed_by_coach($_user['user_id']); } if ($view == 'coach' || $view == 'drh') { - $nbStudents = count($a_students); + $nb_students = count($students); - $totalTimeSpent = 0; - $totalCourses = 0; - $avgTotalProgress = 0; - $avgResultsToExercises = 0; + $total_time_spent = 0; + $total_courses = 0; + $avg_total_progress = 0; + $avg_results_to_exercises = 0; $nb_inactive_students = 0; $nb_posts = $nb_assignments = 0; - foreach ($a_students as $student_id) { + foreach ($students as $student_id) { // inactive students $last_connection_date = Tracking :: get_last_connection_date($student_id, true, true); if ($last_connection_date != false) { @@ -200,57 +200,57 @@ if ($view == 'coach' || $view == 'drh') { $last_connection_hour[0]; $last_connection_time = mktime($last_connection_hour[0], $last_connection_hour[1], $last_connection_hour[2], $last_connection_date[1], $last_connection_date[2], $last_connection_date[0]); */ - if (time() - (3600*24*7) > $last_connection_time) { + if (time() - (3600 * 24 * 7) > $last_connection_time) { $nb_inactive_students++; } } else { $nb_inactive_students++; } - $totalTimeSpent += Tracking :: get_time_spent_on_the_platform($student_id); - $totalCourses += Tracking :: count_course_per_student($student_id); - $avgStudentProgress = $avgStudentScore = 0; + $total_time_spent += Tracking :: get_time_spent_on_the_platform($student_id); + $total_courses += Tracking :: count_course_per_student($student_id); + $avg_student_progress = $avg_student_score = 0; $nb_courses_student = 0; - foreach ($a_courses as $course_code) { + foreach ($courses as $course_code) { if (CourseManager :: is_user_subscribed_in_course($student_id, $course_code, true)) { $nb_courses_student++; $nb_posts += Tracking :: count_student_messages($student_id, $course_code); $nb_assignments += Tracking :: count_student_assignments($student_id, $course_code); - $avgStudentProgress += Tracking :: get_avg_student_progress($student_id, $course_code); - $avgStudentScore += Tracking :: get_avg_student_score($student_id, $course_code); - if ($nb_posts !== null && $nb_assignments !== null && $avgStudentProgress !== null && $avgStudentScore !== null) { + $avg_student_progress += Tracking :: get_avg_student_progress($student_id, $course_code); + $avg_student_score += Tracking :: get_avg_student_score($student_id, $course_code); + if ($nb_posts !== null && $nb_assignments !== null && $avg_student_progress !== null && $avg_student_score !== null) { //if one of these scores is null, it means that we had a problem connecting to the right database, so don't count it in $nb_courses_student++; } } } // average progress of the student - $avgStudentProgress = $avgStudentProgress / $nb_courses_student; - $avgTotalProgress += $avgStudentProgress; + $avg_student_progress = $avg_student_progress / $nb_courses_student; + $avg_total_progress += $avg_student_progress; // average test results of the student - $avgStudentScore = $avgStudentScore / $nb_courses_student; - $avgResultsToExercises += $avgStudentScore; + $avg_student_score = $avg_student_score / $nb_courses_student; + $avg_results_to_exercises += $avg_student_score; } - if ($nbStudents > 0) { + if ($nb_students > 0) { // average progress - $avgTotalProgress = $avgTotalProgress / $nbStudents; + $avg_total_progress = $avg_total_progress / $nb_students; // average results to the tests - $avgResultsToExercises = $avgResultsToExercises / $nbStudents; + $avg_results_to_exercises = $avg_results_to_exercises / $nb_students; // average courses by student - $avgCoursesPerStudent = round($totalCourses / $nbStudents, 2); + $avg_courses_per_student = round($total_courses / $nb_students, 2); // average time spent on the platform - $avgTimeSpent = $totalTimeSpent / $nbStudents; + $avg_time_spent = $total_time_spent / $nb_students; // average assignments - $nb_assignments = $nb_assignments / $nbStudents; + $nb_assignments = $nb_assignments / $nb_students; // average posts - $nb_posts = $nb_posts / $nbStudents; + $nb_posts = $nb_posts / $nb_students; } else { - $avgTotalProgress = null; - $avgResultsToExercises = null; - $avgCoursesPerStudent = null; - $avgTimeSpent = null; + $avg_total_progress = null; + $avg_results_to_exercises = null; + $avg_courses_per_student = null; + $avg_time_spent = null; $nb_assignments = null; $nb_posts = null; } @@ -259,10 +259,10 @@ if ($view == 'coach' || $view == 'drh') { //csv part $csv_content[] = array(get_lang('Probationers', '')); $csv_content[] = array(get_lang('InactivesStudents', ''), $nb_inactive_students ); - $csv_content[] = array(get_lang('AverageTimeSpentOnThePlatform', ''), $avgTimeSpent); - $csv_content[] = array(get_lang('AverageCoursePerStudent', ''), $avgCoursesPerStudent); - $csv_content[] = array(get_lang('AverageProgressInLearnpath', ''), is_null($avgTotalProgress) ? null : round($avgTotalProgress, 2).'%'); - $csv_content[] = array(get_lang('AverageResultsToTheExercices', ''), is_null($avgResultsToExercises) ? null : round($avgResultsToExercises, 2).'%'); + $csv_content[] = array(get_lang('AverageTimeSpentOnThePlatform', ''), $avg_time_spent); + $csv_content[] = array(get_lang('AverageCoursePerStudent', ''), $avg_courses_per_student); + $csv_content[] = array(get_lang('AverageProgressInLearnpath', ''), is_null($avg_total_progress) ? null : round($avg_total_progress, 2).'%'); + $csv_content[] = array(get_lang('AverageResultsToTheExercices', ''), is_null($avg_results_to_exercises) ? null : round($avg_results_to_exercises, 2).'%'); $csv_content[] = array(get_lang('AveragePostsInForum', ''), $nb_posts); $csv_content[] = array(get_lang('AverageAssignments', ''), $nb_assignments); $csv_content[] = array(); @@ -271,7 +271,7 @@ if ($view == 'coach' || $view == 'drh') { echo '

-  '.get_lang('Probationers').' ('.$nbStudents.')'.' +  '.get_lang('Probationers').' ('.$nb_students.')'.'

@@ -287,7 +287,7 @@ if ($view == 'coach' || $view == 'drh') { '.get_lang('AverageTimeSpentOnThePlatform').' @@ -295,7 +295,7 @@ if ($view == 'coach' || $view == 'drh') { '.get_lang('AverageCoursePerStudent').' @@ -303,7 +303,7 @@ if ($view == 'coach' || $view == 'drh') { '.get_lang('AverageProgressInLearnpath').' @@ -311,7 +311,7 @@ if ($view == 'coach' || $view == 'drh') { '.get_lang('AverageResultsToTheExercices').' @@ -339,17 +339,17 @@ if ($view == 'coach') { /**************************************** * Infos about sessions of the coach ****************************************/ - $a_sessions = Tracking :: get_sessions_coached_by_user($_user['user_id']); - $nbSessions = count($a_sessions); + $sessions = Tracking :: get_sessions_coached_by_user($_user['user_id']); + $nb_sessions = count($sessions); $nb_sessions_past = $nb_sessions_future = $nb_sessions_current = 0; - $a_courses = array(); - foreach ($a_sessions as $a_session) { - if ($a_session['date_start'] == '0000-00-00') { + $courses = array(); + foreach ($sessions as $session) { + if ($session['date_start'] == '0000-00-00') { $nb_sessions_current ++; } else { - $date_start = explode('-', $a_session['date_start']); + $date_start = explode('-', $session['date_start']); $time_start = mktime(0, 0, 0, $date_start[1], $date_start[2], $date_start[0]); - $date_end = explode('-', $a_session['date_end']); + $date_end = explode('-', $session['date_end']); $time_end = mktime(0, 0, 0, $date_end[1], $date_end[2], $date_end[0]); if ($time_start < time() && time() < $time_end) { $nb_sessions_current++; @@ -361,12 +361,12 @@ if ($view == 'coach') { $nb_sessions_past++; } } - $a_courses = array_merge($a_courses, Tracking::get_courses_list_from_session($a_session['id'])); + $courses = array_merge($courses, Tracking::get_courses_list_from_session($session['id'])); } - if ($nbSessions > 0) { - $nb_courses_per_session = round(count($a_courses) / $nbSessions, 2); - $nb_students_per_session = round($nbStudents / $nbSessions, 2); + if ($nb_sessions > 0) { + $nb_courses_per_session = round(count($courses) / $nb_sessions, 2); + $nb_students_per_session = round($nb_students / $nb_sessions, 2); } else { $nb_courses_per_session = null; $nb_students_per_session = null; @@ -387,7 +387,7 @@ if ($view == 'coach') { echo '

-  '.get_lang('Sessions').' ('.$nbSessions.')'.' +  '.get_lang('Sessions').' ('.$nb_sessions.')'.'

- '.(is_null($avgTimeSpent) ? '' : api_time_to_hms($avgTimeSpent)).' + '.(is_null($avg_time_spent) ? '' : api_time_to_hms($avg_time_spent)).'
- '.(is_null($avgCoursesPerStudent) ? '' : $avgCoursesPerStudent).' + '.(is_null($avg_courses_per_student) ? '' : $avg_courses_per_student).'
- '.(is_null($avgTotalProgress) ? '' : round($avgTotalProgress, 2).'%').' + '.(is_null($avg_total_progress) ? '' : round($avg_total_progress, 2).'%').'
- '.(is_null($avgResultsToExercises) ? '' : round($avgResultsToExercises, 2).'%').' + '.(is_null($avg_results_to_exercises) ? '' : round($avg_results_to_exercises, 2).'%').'
@@ -469,7 +469,7 @@ if (api_is_allowed_to_create_course() && $view == 'teacher') { $a_course_students = array(); - foreach ($a_courses as $course) { + foreach ($courses as $course) { $course_code = $course['course_code']; $avg_assignments_in_course = $avg_messages_in_course = $nb_students_in_course = $avg_progress_in_course = $avg_score_in_course = $avg_time_spent_in_course = $avg_score_in_exercise = 0; @@ -560,7 +560,7 @@ if (api_is_allowed_to_create_course() && $view == 'teacher') { } } -if (api_is_platform_admin() && $view == 'admin') { +if ($is_platform_admin && $view == 'admin') { echo ''.get_lang('DisplayCoaches').' | '; echo ''.get_lang('DisplayUserOverview').''; if ($_GET['display'] == 'useroverview') { @@ -648,11 +648,11 @@ if (api_is_platform_admin() && $view == 'admin') { } $result_coaches = Database::query($sqlCoachs, __FILE__, __LINE__); - $total_no_coachs = Database::num_rows($result_coaches); + $total_no_coaches = Database::num_rows($result_coaches); - $global_coachs = array(); - while ($a_coach = Database::fetch_array($result_coaches)) { - $global_coachs[$a_coach['user_id']] = $a_coach; + $global_coaches = array(); + while ($coach = Database::fetch_array($result_coaches)) { + $global_coaches[$coach['user_id']] = $coach; } $sql_session_coach = 'SELECT session.id_coach, user_id, lastname, firstname, MAX(login_date) as login_date @@ -674,41 +674,41 @@ if (api_is_platform_admin() && $view == 'admin') { } $result_sessions_coach = Database::query($sql_session_coach, __FILE__, __LINE__); - $total_no_coachs += Database::num_rows($result_sessions_coach); - while ($a_coach = Database::fetch_array($result_sessions_coach)) { - $global_coachs[$a_coach['user_id']] = $a_coach; + $total_no_coaches += Database::num_rows($result_sessions_coach); + while ($coach = Database::fetch_array($result_sessions_coach)) { + $global_coaches[$coach['user_id']] = $coach; } $all_datas = array(); - foreach ($global_coachs as $id_coach => $a_coachs) { + foreach ($global_coaches as $id_coach => $coaches) { - $time_on_platform = api_time_to_hms(Tracking :: get_time_spent_on_the_platform($a_coachs['user_id'])); - $last_connection = Tracking :: get_last_connection_date($a_coachs['user_id']); - $nb_students = count(Tracking :: get_student_followed_by_coach($a_coachs['user_id'])); - $nb_courses = count(Tracking :: get_courses_followed_by_coach($a_coachs['user_id'])); - $nb_sessions = count(Tracking :: get_sessions_coached_by_user($a_coachs['user_id'])); + $time_on_platform = api_time_to_hms(Tracking :: get_time_spent_on_the_platform($coaches['user_id'])); + $last_connection = Tracking :: get_last_connection_date($coaches['user_id']); + $nb_students = count(Tracking :: get_student_followed_by_coach($coaches['user_id'])); + $nb_courses = count(Tracking :: get_courses_followed_by_coach($coaches['user_id'])); + $nb_sessions = count(Tracking :: get_sessions_coached_by_user($coaches['user_id'])); $table_row = array(); if ($is_western_name_order) { - $table_row[] = $a_coachs['firstname']; - $table_row[] = $a_coachs['lastname']; + $table_row[] = $coaches['firstname']; + $table_row[] = $coaches['lastname']; } else { - $table_row[] = $a_coachs['lastname']; - $table_row[] = $a_coachs['firstname']; + $table_row[] = $coaches['lastname']; + $table_row[] = $coaches['firstname']; } $table_row[] = $time_on_platform; $table_row[] = $last_connection; $table_row[] = $nb_students; $table_row[] = $nb_courses; $table_row[] = $nb_sessions; - $table_row[] = '
'; + $table_row[] = '
'; $all_datas[] = $table_row; if ($is_western_name_order) { $csv_content[] = array( - api_html_entity_decode($a_coachs['firstname'], ENT_QUOTES, $charset), - api_html_entity_decode($a_coachs['lastname'], ENT_QUOTES, $charset), + api_html_entity_decode($coaches['firstname'], ENT_QUOTES, $charset), + api_html_entity_decode($coaches['lastname'], ENT_QUOTES, $charset), $time_on_platform, $last_connection, $nb_students, @@ -717,8 +717,8 @@ if (api_is_platform_admin() && $view == 'admin') { ); } else { $csv_content[] = array( - api_html_entity_decode($a_coachs['lastname'], ENT_QUOTES, $charset), - api_html_entity_decode($a_coachs['firstname'], ENT_QUOTES, $charset), + api_html_entity_decode($coaches['lastname'], ENT_QUOTES, $charset), + api_html_entity_decode($coaches['firstname'], ENT_QUOTES, $charset), $time_on_platform, $last_connection, $nb_students, diff --git a/main/mySpace/myStudents.php b/main/mySpace/myStudents.php index e271341e5b..742be74e64 100644 --- a/main/mySpace/myStudents.php +++ b/main/mySpace/myStudents.php @@ -44,16 +44,16 @@ if (isset ($_GET['from']) && $_GET['from'] == 'myspace') { } $nameTools = get_lang("StudentDetails"); -//$nameTools=SECTION_PLATFORM_ADMIN; +//$nameTools = SECTION_PLATFORM_ADMIN; $get_course_code = Security :: remove_XSS($_GET['course']); if (isset ($_GET['details'])) { if (!empty ($_GET['origin']) && $_GET['origin'] == 'user_course') { - $course_infos = CourseManager :: get_course_information($get_course_code); + $course_info = CourseManager :: get_course_information($get_course_code); if (empty ($cidReq)) { $interbreadcrumb[] = array ( - "url" => api_get_path(WEB_COURSE_PATH) . $course_infos['directory'], - 'name' => $course_infos['title'] + "url" => api_get_path(WEB_COURSE_PATH) . $course_info['directory'], + 'name' => $course_info['title'] ); } $interbreadcrumb[] = array ( @@ -62,9 +62,9 @@ if (isset ($_GET['details'])) { ); } else if (!empty ($_GET['origin']) && $_GET['origin'] == 'tracking_course') { - $course_infos = CourseManager :: get_course_information($get_course_code); + $course_info = CourseManager :: get_course_information($get_course_code); if (empty ($cidReq)) { - //$interbreadcrumb[] = array ("url" => api_get_path(WEB_COURSE_PATH).$course_infos['directory'], 'name' => $course_infos['title']); + //$interbreadcrumb[] = array ("url" => api_get_path(WEB_COURSE_PATH).$course_info['directory'], 'name' => $course_info['title']); } $interbreadcrumb[] = array ( "url" => "../tracking/courseLog.php?cidReq=" . $get_course_code . '&studentlist=true&id_session=' . (empty ($_SESSION['id_session']) ? '' : $_SESSION['id_session']), @@ -206,9 +206,9 @@ $course_quiz_answer = 'quiz_answer'; $course_student_publication = Database :: get_course_table(TABLE_STUDENT_PUBLICATION); if (isset ($_GET["user_id"]) && $_GET["user_id"] != "") { - $i_user_id = (int) $_GET["user_id"]; + $user_id = (int) $_GET["user_id"]; } else { - $i_user_id = $_user['user_id']; + $user_id = $_user['user_id']; } if (!empty ($_GET['student'])) { @@ -216,23 +216,23 @@ if (!empty ($_GET['student'])) { $student_id = intval($_GET['student']); // infos about user - $a_infosUser = UserManager :: get_user_info_by_id($student_id); - if ($_user['status'] == DRH && $a_infosUser['hr_dept_id'] != $_user['user_id']) { + $info_user = UserManager :: get_user_info_by_id($student_id); + if ($_user['status'] == DRH && $info_user['hr_dept_id'] != $_user['user_id']) { api_not_allowed(); } - $a_infosUser['name'] = api_get_person_name($a_infosUser['firstname'], $a_infosUser['lastname']); + $info_user['name'] = api_get_person_name($info_user['firstname'], $info_user['lastname']); // Actions bar echo '
'; echo ' ' . get_lang('Print') . ''; echo ' ' . get_lang('ExportAsCSV') . ''; - if (!empty ($a_infosUser['email'])) { - $sendMail = Display :: return_icon('send_mail.gif', get_lang('SendMail')) . ' ' . Display :: encrypted_mailto_link($a_infosUser['email'], get_lang('SendMail')); + if (!empty ($info_user['email'])) { + $send_mail = Display :: return_icon('send_mail.gif', get_lang('SendMail')) . ' ' . Display :: encrypted_mailto_link($info_user['email'], get_lang('SendMail')); } else { - $sendMail = Display :: return_icon('send_mail.gif', get_lang('SendMail')) . ' ' . get_lang('SendMail'); + $send_mail = Display :: return_icon('send_mail.gif', get_lang('SendMail')) . ' ' . get_lang('SendMail'); } - echo $sendMail; + echo $send_mail; if (!empty ($_GET['student']) && !empty ($_GET['course'])) { //only show link to connection details if course and student were defined in the URL echo '' . Display :: return_icon('statistics.gif', get_lang('AccessDetails')) . ' ' . get_lang('AccessDetails') . ''; } @@ -240,10 +240,10 @@ if (!empty ($_GET['student'])) { // is the user online ? $statistics_database = Database :: get_statistic_database(); - $student_on_line = Security :: remove_XSS($_GET['student']); - $a_usersOnline = WhoIsOnline($student_on_line, $statistics_database, 30); - foreach ($a_usersOnline as $a_online) { - if (in_array($_GET['student'], $a_online)) { + $student_online = Security :: remove_XSS($_GET['student']); + $users_online = WhoIsOnline($student_online, $statistics_database, 30); + foreach ($users_online as $online) { + if (in_array($_GET['student'], $online)) { $online = get_lang('Yes'); break; } else { @@ -252,44 +252,44 @@ if (!empty ($_GET['student'])) { } $avg_student_progress = $avg_student_score = $nb_courses = 0; - $sql = 'SELECT course_code FROM ' . $tbl_course_user . ' WHERE user_id=' . Database :: escape_string($a_infosUser['user_id']); + $sql = 'SELECT course_code FROM ' . $tbl_course_user . ' WHERE user_id=' . Database :: escape_string($info_user['user_id']); $rs = Database::query($sql, __FILE__, __LINE__); - $a_courses = array (); + $courses = array (); while ($row = Database :: fetch_array($rs)) { - $a_courses[$row['course_code']] = $row['course_code']; + $courses[$row['course_code']] = $row['course_code']; } // get the list of sessions where the user is subscribed as student - $sql = 'SELECT DISTINCT course_code FROM ' . Database :: get_main_table(TABLE_MAIN_SESSION_COURSE_USER) . ' WHERE id_user=' . intval($a_infosUser['user_id']); + $sql = 'SELECT DISTINCT course_code FROM ' . Database :: get_main_table(TABLE_MAIN_SESSION_COURSE_USER) . ' WHERE id_user=' . intval($info_user['user_id']); $rs = Database::query($sql, __FILE__, __LINE__); while ($row = Database :: fetch_array($rs)) { - $a_courses[$row['course_code']] = $row['course_code']; + $courses[$row['course_code']] = $row['course_code']; } $course_id = Security :: remove_XSS($_GET['course']); - if (!CourseManager :: is_user_subscribed_in_course($a_infosUser['user_id'], $course_id, true)) { - unset ($a_courses[$key]); + if (!CourseManager :: is_user_subscribed_in_course($info_user['user_id'], $course_id, true)) { + unset ($courses[$key]); } else { $nb_courses++; - $avg_student_progress = Tracking :: get_avg_student_progress($a_infosUser['user_id'], $course_id); + $avg_student_progress = Tracking :: get_avg_student_progress($info_user['user_id'], $course_id); //the score inside the Reporting table - $avg_student_score = Tracking :: get_average_test_scorm_and_lp($a_infosUser['user_id'], $course_id); + $avg_student_score = Tracking :: get_average_test_scorm_and_lp($info_user['user_id'], $course_id); } $avg_student_progress = round($avg_student_progress, 2); $avg_student_score = round($avg_student_score, 2); - $first_connection_date = Tracking :: get_first_connection_date($a_infosUser['user_id']); + $first_connection_date = Tracking :: get_first_connection_date($info_user['user_id']); if ($first_connection_date == '') { $first_connection_date = get_lang('NoConnexion'); } - $last_connection_date = Tracking :: get_last_connection_date($a_infosUser['user_id'], true); + $last_connection_date = Tracking :: get_last_connection_date($info_user['user_id'], true); if ($last_connection_date == '') { $last_connection_date = get_lang('NoConnexion'); } - $time_spent_on_the_course = api_time_to_hms(Tracking :: get_time_spent_on_the_course($a_infosUser['user_id'], $course_id)); + $time_spent_on_the_course = api_time_to_hms(Tracking :: get_time_spent_on_the_course($info_user['user_id'], $course_id)); // cvs informations $csv_content[] = array ( get_lang('Informations', '') @@ -300,9 +300,9 @@ if (!empty ($_GET['student'])) { get_lang('Tel', '') ); $csv_content[] = array ( - $a_infosUser['name'], - $a_infosUser['email'], - $a_infosUser['phone'] + $info_user['name'], + $info_user['email'], + $info_user['phone'] ); $csv_content[] = array (); @@ -332,7 +332,7 @@ if (!empty ($_GET['student'])) { '; // get the path,width and height from original picture @@ -343,7 +343,7 @@ if (!empty ($_GET['student'])) { $big_image_height = $big_image_size[1]; $url_big_image = $big_image . '?rnd=' . time(); $img_attributes = 'src="' . $image_file . '?rand=' . time() . '" ' . - 'alt="' . api_get_person_name($a_infosUser['lastname'], $a_infosUser['firstname']) . '" ' . + 'alt="' . api_get_person_name($info_user['lastname'], $info_user['firstname']) . '" ' . 'style="float:' . ($text_dir == 'rtl' ? 'left' : 'right') . '; padding:5px;" '; if ($image_array['file'] == 'unknown.jpg') { @@ -368,7 +368,7 @@ if (!empty ($_GET['student'])) {
@@ -377,8 +377,8 @@ if (!empty ($_GET['student'])) { ' . $a_infosUser['email'] . ''; + if (!empty ($info_user['email'])) { + echo '' . $info_user['email'] . ''; } else { echo get_lang('NoEmail'); } @@ -391,8 +391,8 @@ if (!empty ($_GET['student'])) { echo get_lang('Tel') . '. '; - if (!empty ($a_infosUser['phone'])) { - echo $a_infosUser['phone']; + if (!empty ($info_user['phone'])) { + echo $info_user['phone']; } else { echo get_lang('NoTel'); } @@ -405,8 +405,8 @@ if (!empty ($_GET['student'])) { echo get_lang('OfficialCode') . ' : '; - if (!empty ($a_infosUser['official_code'])) { - echo $a_infosUser['official_code']; + if (!empty ($info_user['official_code'])) { + echo $info_user['official_code']; } else { echo get_lang('NoOfficialCode'); } @@ -461,7 +461,7 @@ if (!empty ($_GET['student'])) { 'absmiddle', 'hspace' => '3px' )); @@ -476,7 +476,7 @@ if (!empty ($_GET['student'])) { 'absmiddle', 'hspace' => '3px' )); @@ -499,7 +499,7 @@ if (!empty ($_GET['student'])) { if (!empty ($_GET['details'])) { $course_code_info = Security :: remove_XSS($_GET['course']); - $a_infosCours = CourseManager :: get_course_information($course_code_info); + $info_course = CourseManager :: get_course_information($course_code_info); //get coach and session_name if there is one and if session_mode is activated if (api_get_setting('use_session_mode') == 'true') { @@ -510,7 +510,7 @@ if (!empty ($_GET['student'])) { $sql = 'SELECT id_session FROM ' . $tbl_session_course_user . ' session_course_user - WHERE session_course_user.id_user = ' . intval($a_infosUser['user_id']) . ' + WHERE session_course_user.id_user = ' . intval($info_user['user_id']) . ' AND session_course_user.course_code = "' . Database :: escape_string($course_code_info) . '" ORDER BY id_session DESC'; $rs = Database::query($sql, __FILE__, __LINE__); @@ -534,36 +534,36 @@ if (!empty ($_GET['student'])) { if ($session_course_coach_id != 0) { $coach_infos = UserManager :: get_user_info_by_id($session_course_coach_id); - $a_infosCours['tutor_name'] = api_get_person_name($coach_infos['firstname'], $coach_infos['lastname']); + $info_course['tutor_name'] = api_get_person_name($coach_infos['firstname'], $coach_infos['lastname']); } elseif ($session_coach_id != 0) { $coach_infos = UserManager :: get_user_info_by_id($session_coach_id); - $a_infosCours['tutor_name'] = api_get_person_name($coach_infos['firstname'], $coach_infos['lastname']); + $info_course['tutor_name'] = api_get_person_name($coach_infos['firstname'], $coach_infos['lastname']); } } } } // end if(api_get_setting('use_session_mode')=='true') $date_start = ''; - if (!empty ($a_infosCours['date_start'])) { - $a_date_start = explode('-', $a_infosCours['date_start']); - $date_start = $a_date_start[2] . '/' . $a_date_start[1] . '/' . $a_date_start[0]; + if (!empty ($info_course['date_start'])) { + $date_start = explode('-', $info_course['date_start']); + $date_start = $date_start[2] . '/' . $date_start[1] . '/' . $date_start[0]; } $date_end = ''; - if (!empty ($a_infosCours['date_end'])) { - $a_date_end = explode('-', $a_infosCours['date_end']); - $date_end = $a_date_end[2] . '/' . $a_date_end[1] . '/' . $a_date_end[0]; + if (!empty ($info_course['date_end'])) { + $date_end = explode('-', $info_course['date_end']); + $date_end = $date_end[2] . '/' . $date_end[1] . '/' . $date_end[0]; } $dateSession = get_lang('From') . ' ' . $date_start . ' ' . get_lang('To') . ' ' . $date_end; - $nb_login = Tracking :: count_login_per_student($a_infosUser['user_id'], $_GET['course']); - $tableTitle = $a_infosCours['title'] . ' | ' . get_lang('CountToolAccess') . ' : ' . $nb_login . '  |  ' . get_lang('Tutor') . ' : ' . stripslashes($a_infosCours['tutor_name']) . ((!empty ($session_name)) ? ' | ' . get_lang('Session') . ' : ' . $session_name : ''); + $nb_login = Tracking :: count_login_per_student($info_user['user_id'], $_GET['course']); + $table_title = $info_course['title'] . ' | ' . get_lang('CountToolAccess') . ' : ' . $nb_login . '  |  ' . get_lang('Tutor') . ' : ' . stripslashes($info_course['tutor_name']) . ((!empty ($session_name)) ? ' | ' . get_lang('Session') . ' : ' . $session_name : ''); $csv_content[] = array (); - $csv_content[] = array (str_replace(' ', '', $tableTitle)); + $csv_content[] = array (str_replace(' ', '', $table_title)); ?>
- +
@@ -620,27 +620,27 @@ if (!empty ($_GET['student'])) { 0) { + if (Database :: num_rows($result_learnpath) > 0) { $i = 0; - while ($a_learnpath = Database :: fetch_array($resultLearnpath)) { + while ($learnpath = Database :: fetch_array($result_learnpath)) { $any_result = false; - $progress = learnpath :: get_db_progress($a_learnpath['id'], $student_id, '%', $a_infosCours['db_name'], true); + $progress = learnpath :: get_db_progress($learnpath['id'], $student_id, '%', $info_course['db_name'], true); if ($progress === null) { $progress = '0%'; } else { @@ -667,7 +667,7 @@ if (!empty ($_GET['student'])) { FROM ' . $t_lpiv . ' AS item_view INNER JOIN ' . $t_lpv . ' AS view ON item_view.lp_view_id = view.id - AND view.lp_id = ' . $a_learnpath['id'] . ' + AND view.lp_id = ' . $learnpath['id'] . ' AND view.user_id = ' . intval($_GET['student']); $rs = Database::query($sql, __FILE__, __LINE__); $total_time = 0; @@ -682,7 +682,7 @@ if (!empty ($_GET['student'])) { FROM ' . $t_lpiv . ' AS item_view INNER JOIN ' . $t_lpv . ' AS view ON item_view.lp_view_id = view.id - AND view.lp_id = ' . $a_learnpath['id'] . ' + AND view.lp_id = ' . $learnpath['id'] . ' AND view.user_id = ' . intval($_GET['student']); $rs = Database::query($sql, __FILE__, __LINE__); $start_time = null; @@ -694,31 +694,31 @@ if (!empty ($_GET['student'])) { //QUIZZ IN LP $score = Tracking :: get_avg_student_score(intval($_GET['student']), Database :: escape_string($_GET['course']), array ( - $a_learnpath['id'] + $learnpath['id'] )); if (empty ($score)) { //$score = 0; } if ($i % 2 == 0) { - $s_css_class = "row_odd"; + $css_class = "row_odd"; } else { - $s_css_class = "row_even"; + $css_class = "row_even"; } $i++; $csv_content[] = array ( - api_html_entity_decode(stripslashes($a_learnpath['name']), ENT_QUOTES, $charset), + api_html_entity_decode(stripslashes($learnpath['name']), ENT_QUOTES, $charset), api_time_to_hms($total_time), $score . '%', $progress, date('Y-m-d', $start_time) ); ?> - + - + @@ -759,7 +759,7 @@ if (!empty ($_GET['student'])) { $from ='&from=myspace'; } ?> - + 0) { - while ($a_exercices = Database :: fetch_array($resultExercices)) { - $sqlEssais = " SELECT COUNT(ex.exe_id) as essais + if (Database :: num_rows($result_exercices) > 0) { + while ($exercices = Database :: fetch_array($result_exercices)) { + $sql_essais = "SELECT COUNT(ex.exe_id) as essais FROM $tbl_stats_exercices AS ex - WHERE ex.exe_cours_id = '" . $a_infosCours['code'] . "' - AND ex.exe_exo_id = " . $a_exercices['id'] . " + WHERE ex.exe_cours_id = '" . $info_course['code'] . "' + AND ex.exe_exo_id = " . $exercices['id'] . " AND orig_lp_id = 0 AND orig_lp_item_id = 0 AND exe_user_id='" . Database :: escape_string($is_student) . "'"; - $resultEssais = Database::query($sqlEssais, __FILE__, __LINE__); - $a_essais = Database :: fetch_array($resultEssais); + $result_essais = Database::query($sql_essais, __FILE__, __LINE__); + $essais = Database :: fetch_array($result_essais); - $sqlScore = "SELECT exe_id, exe_result,exe_weighting + $sql_score = "SELECT exe_id, exe_result,exe_weighting FROM $tbl_stats_exercices WHERE exe_user_id = " . Database :: escape_string($is_student) . " - AND exe_cours_id = '" . $a_infosCours['code'] . "' - AND exe_exo_id = " . $a_exercices['id'] . " + AND exe_cours_id = '" . $info_course['code'] . "' + AND exe_exo_id = " . $exercices['id'] . " AND orig_lp_id = 0 AND orig_lp_item_id = 0 ORDER BY exe_date DESC LIMIT 1"; - $resultScore = Database::query($sqlScore, __FILE__, __LINE__); + $result_score = Database::query($sql_score, __FILE__, __LINE__); $score = 0; - while ($a_score = Database :: fetch_array($resultScore)) { - $score = $score + $a_score['exe_result']; - $weighting = $weighting + $a_score['exe_weighting']; - $exe_id = $a_score['exe_id']; + while ($scores = Database :: fetch_array($result_score)) { + $score = $score + $scores['exe_result']; + $weighting = $weighting + $scores['exe_weighting']; + $exe_id = $scores['exe_id']; } - $pourcentageScore = 0; + $score_percentage = 0; if ($weighting != 0) { //i.e 10.50 - $pourcentageScore = round(($score * 100) / $weighting, 2); + $score_percentage = round(($score * 100) / $weighting, 2); } else { - $pourcentageScore = null; + $score_percentage = null; } $weighting = 0; $csv_content[] = array ( - $a_exercices['title'], - $pourcentageScore . '%', - $a_essais['essais'] + $exercices['title'], + $score_percentage . '%', + $essais['essais'] ); if ($i % 2 == 0) { - $s_css_class = "row_odd"; + $css_class = "row_odd"; } else { - $s_css_class = "row_even"; + $css_class = "row_even"; } $i++; - echo ' + echo ' '; - echo $a_exercices['title']; + echo $exercices['title']; echo " "; echo " "; - if ($a_essais['essais'] > 0) { - echo $pourcentageScore . '%'; + if ($essais['essais'] > 0) { + echo $score_percentage . '%'; } else { echo '/'; - $pourcentageScore = 0; + $score_percentage = 0; } echo " "; - echo $a_essais['essais']; + echo $essais['essais']; echo " "; - $sql_last_attempt = 'SELECT exe_id FROM ' . $tbl_stats_exercices . ' WHERE exe_exo_id="' . $a_exercices['id'] . '" AND exe_user_id="' . Security :: remove_XSS($_GET['student']) . '" AND exe_cours_id="' . $a_infosCours['code'] . '" AND orig_lp_id = 0 AND orig_lp_item_id = 0 ORDER BY exe_date DESC LIMIT 1'; - $resultLastAttempt = Database::query($sql_last_attempt, __FILE__, __LINE__); - if (Database :: num_rows($resultLastAttempt) > 0) { - $id_last_attempt = Database :: result($resultLastAttempt, 0, 0); + $sql_last_attempt = 'SELECT exe_id FROM ' . $tbl_stats_exercices . ' WHERE exe_exo_id="' . $exercices['id'] . '" AND exe_user_id="' . Security :: remove_XSS($_GET['student']) . '" AND exe_cours_id="' . $info_course['code'] . '" AND orig_lp_id = 0 AND orig_lp_item_id = 0 ORDER BY exe_date DESC LIMIT 1'; + $result_last_attempt = Database::query($sql_last_attempt, __FILE__, __LINE__); + if (Database :: num_rows($result_last_attempt) > 0) { + $id_last_attempt = Database :: result($result_last_attempt, 0, 0); - if ($a_essais['essais'] > 0) - echo ' '; + if ($essais['essais'] > 0) + echo ' '; } echo " "; - $dataExercices[$i][] = $a_exercices['title']; - $dataExercices[$i][] = $pourcentageScore . '%'; - $dataExercices[$i][] = $a_essais['essais']; - //$dataExercices[$i][] = corrections; + $data_exercices[$i][] = $exercices['title']; + $data_exercices[$i][] = $score_percentage . '%'; + $data_exercices[$i][] = $essais['essais']; + //$data_exercices[$i][] = corrections; $i++; } @@ -945,11 +945,11 @@ if (!empty ($_GET['student'])) { $csv_content[] = array (); - $nb_assignments = Tracking :: count_student_assignments($a_infosUser['user_id'], $a_infosCours['code']); - $messages = Tracking :: count_student_messages($a_infosUser['user_id'], $a_infosCours['code']); - $links = Tracking :: count_student_visited_links($a_infosUser['user_id'], $a_infosCours['code']); - $documents = Tracking :: count_student_downloaded_documents($a_infosUser['user_id'], $a_infosCours['code']); - $chat_last_connection = Tracking :: chat_last_connection($a_infosUser['user_id'], $a_infosCours['code']); + $nb_assignments = Tracking :: count_student_assignments($info_user['user_id'], $info_course['code']); + $messages = Tracking :: count_student_messages($info_user['user_id'], $info_course['code']); + $links = Tracking :: count_student_visited_links($info_user['user_id'], $info_course['code']); + $documents = Tracking :: count_student_downloaded_documents($info_user['user_id'], $info_course['code']); + $chat_last_connection = Tracking :: chat_last_connection($info_user['user_id'], $info_course['code']); $csv_content[] = array ( get_lang('Student_publication'), @@ -1047,12 +1047,12 @@ if (!empty ($_GET['student'])) { if (!api_is_platform_admin(true) && $_user['status'] != DRH) { // courses followed by user where we are coach if (!isset ($_GET['id_coach'])) { - $a_courses = Tracking :: get_courses_followed_by_coach($_user['user_id']); + $courses = Tracking :: get_courses_followed_by_coach($_user['user_id']); } else { - $a_courses = Tracking :: get_courses_followed_by_coach(Security :: remove_XSS($_GET['id_coach'])); + $courses = Tracking :: get_courses_followed_by_coach(Security :: remove_XSS($_GET['id_coach'])); } } - if (count($a_courses) > 0) { + if (count($courses) > 0) { $csv_content[] = array (); $csv_content[] = array ( get_lang('Course', ''), @@ -1060,16 +1060,16 @@ if (!empty ($_GET['student'])) { get_lang('Progress', ''), get_lang('Score', '') ); - foreach ($a_courses as $course_code) { + foreach ($courses as $course_code) { if (CourseManager :: is_user_subscribed_in_course($student_id, $course_code, true)) { - $course_infos = CourseManager :: get_course_information($course_code); - $time_spent_on_course = api_time_to_hms(Tracking :: get_time_spent_on_the_course($a_infosUser['user_id'], $course_code)); - $progress = Tracking :: get_avg_student_progress($a_infosUser['user_id'], $course_code); - $score = Tracking :: get_avg_student_score($a_infosUser['user_id'], $course_code); + $course_info = CourseManager :: get_course_information($course_code); + $time_spent_on_course = api_time_to_hms(Tracking :: get_time_spent_on_the_course($info_user['user_id'], $course_code)); + $progress = Tracking :: get_avg_student_progress($info_user['user_id'], $course_code); + $score = Tracking :: get_avg_student_score($info_user['user_id'], $course_code); $progress = empty($progress) ? '0%' : $progress.'%'; $score = empty($score) ? '0%' : $score.'%'; $csv_content[] = array ( - $course_infos['title'], + $course_info['title'], $time_spent_on_course, $progress, $score @@ -1077,7 +1077,7 @@ if (!empty ($_GET['student'])) { echo ' - ' . $course_infos['title'] . ' + ' . $course_info['title'] . ' ' . $time_spent_on_course . ' @@ -1090,11 +1090,11 @@ if (!empty ($_GET['student'])) { '; if (isset ($_GET['id_coach']) && intval($_GET['id_coach']) != 0) { echo ' - + '; } else { echo ' - + '; } echo ''; @@ -1123,38 +1123,38 @@ if (!empty ($_GET['student'])) { } if (!empty ($_GET['exe_id'])) { - $t_q = Database :: get_course_table(TABLE_QUIZ_TEST, $a_infosCours['db_name']); - $t_qq = Database :: get_course_table(TABLE_QUIZ_QUESTION, $a_infosCours['db_name']); - $t_qa = Database :: get_course_table(TABLE_QUIZ_ANSWER, $a_infosCours['db_name']); - $t_qtq = Database :: get_course_table(TABLE_QUIZ_TEST_QUESTION, $a_infosCours['db_name']); - $sqlExerciceDetails = " SELECT qq.question, qq.ponderation, qq.id + $t_q = Database :: get_course_table(TABLE_QUIZ_TEST, $info_course['db_name']); + $t_qq = Database :: get_course_table(TABLE_QUIZ_QUESTION, $info_course['db_name']); + $t_qa = Database :: get_course_table(TABLE_QUIZ_ANSWER, $info_course['db_name']); + $t_qtq = Database :: get_course_table(TABLE_QUIZ_TEST_QUESTION, $info_course['db_name']); + $sql_exercice_details = "SELECT qq.question, qq.ponderation, qq.id FROM " . $t_qq . " as qq INNER JOIN " . $t_qtq . " as qrq ON qrq.question_id = qq.id AND qrq.exercice_id = " . intval($_GET['exe_id']); - $resultExerciceDetails = Database::query($sqlExerciceDetails, __FILE__, __LINE__); + $result_exercice_details = Database::query($sql_exercice_details, __FILE__, __LINE__); - $sqlExName = " SELECT quiz.title + $sql_ex_name = "SELECT quiz.title FROM " . $t_q . " AS quiz WHERE quiz.id = " . intval($_GET['exe_id']); ; - $resultExName = Database::query($sqlExName, __FILE__, __LINE__); - $a_exName = Database :: fetch_array($resultExName); + $resultExName = Database::query($sql_ex_name, __FILE__, __LINE__); + $exName = Database :: fetch_array($resultExName); echo " "; - while ($a_exerciceDetails = Database :: fetch_array($resultExerciceDetails)) { + while ($exerciceDetails = Database :: fetch_array($result_exercice_details)) { $sqlAnswer = " SELECT qa.comment, qa.answer FROM " . $t_qa . " as qa - WHERE qa.question_id = " . $a_exerciceDetails['id']; + WHERE qa.question_id = " . $exerciceDetails['id']; $resultAnswer = Database::query($sqlAnswer, __FILE__, __LINE__); @@ -1163,20 +1163,20 @@ if (!empty ($_GET['student'])) { echo " "; - while ($a_answer = Database :: fetch_array($resultAnswer)) { + while ($answer = Database :: fetch_array($resultAnswer)) { echo "
- " . $a_exName['title'] . " + " . $exName['title'] . "
- " . $a_exerciceDetails['question'] . ' /' . $a_exerciceDetails['ponderation'] . " + " . $exerciceDetails['question'] . ' /' . $exerciceDetails['ponderation'] . "
- " . $a_answer['answer'] . " + " . $answer['answer'] . " "; - if (!empty ($a_answer['comment'])) - echo $a_answer['comment']; + if (!empty ($answer['comment'])) + echo $answer['comment']; else echo get_lang('NoComment'); echo " @@ -1188,7 +1188,7 @@ if (!empty ($_GET['student'])) { echo "
"; } //YW - commented out because it doesn't seem to be used - //$a_header = array_merge($a_headerLearnpath,$a_headerExercices,$a_headerProductions); + //$header = array_merge($headerLearnpath,$headerExercices,$headerProductions); } if ($export_csv) { ob_end_clean(); diff --git a/main/mySpace/reussite.php b/main/mySpace/reussite.php index d783e6d7e5..18557b9dce 100644 --- a/main/mySpace/reussite.php +++ b/main/mySpace/reussite.php @@ -3,6 +3,8 @@ * Created on 28 juil. 2006 by Elixir Interactive http://www.elixir-interactive.com */ +// TODO: Is this file used? + $nameTools = 'Reussite'; // name of the language file that needs to be included $language_file = array ('registration', 'index', 'trad4all', 'tracking'); @@ -29,81 +31,81 @@ $tbl_track_exercice = Database :: get_statistic_table(TABLE_STATISTIC_TRACK_E_EX =============================================================================== */ if (!empty($_GET['session'])) { - $sqlSession = "SELECT name,id + $sql_session = "SELECT name,id FROM $tbl_session ORDER BY name ASC"; - $resultSession = Database::query($sqlSession, __FILE__, __LINE__); + $result_session = Database::query($sql_session, __FILE__, __LINE__); echo "".get_lang('MoyCourse').""; echo "

"; - if (Database::num_rows($resultSession) > 0) { + if (Database::num_rows($result_session) > 0) { echo ''; - while ($a_session = Database::fetch_array($resultSession)) { - $sqlCourse = "SELECT title,code + while ($session = Database::fetch_array($result_session)) { + $sql_course = "SELECT title,code FROM $tbl_course as course INNER JOIN $tbl_session_course AS rel_course ON course.code = rel_course.course_code - AND rel_course.id_session = ".$a_session['id']." + AND rel_course.id_session = ".$session['id']." ORDER BY title ASC"; - $resultCourse = Database::query($sqlCourse, __FILE__, __LINE__); - $totalResult = 0; - $totalWeighting = 0; - while ($a_course = Database::fetch_array($resultCourse)) { - $sqlMoyTest = "SELECT exe_result,exe_weighting + $result_course = Database::query($sql_course, __FILE__, __LINE__); + $total_result = 0; + $total_weighting = 0; + while ($course = Database::fetch_array($result_course)) { + $sql_moy_test = "SELECT exe_result,exe_weighting FROM $tbl_track_exercice - WHERE exe_cours_id = '".$a_course['code']."'"; - $resultMoyTest = Database::query($sqlMoyTest); + WHERE exe_cours_id = '".$course['code']."'"; + $result_moy_test = Database::query($sql_moy_test); $result = 0; $weighting = 0; - while ($a_moyTest = Database::fetch_array($resultMoyTest)) { - $result = $result + $a_moyTest['exe_result']; - $weighting = $weighting + $a_moyTest['exe_weighting']; + while ($moy_test = Database::fetch_array($result_moy_test)) { + $result = $result + $moy_test['exe_result']; + $weighting = $weighting + $moy_test['exe_weighting']; } - $totalResult = $totalResult + $result; - $totalWeighting = $totalWeighting + $weighting; + $total_result = $total_result + $result; + $total_weighting = $total_weighting + $weighting; } - if ($totalWeighting != 0) { - $moyenneTest = round(($totalResult * 100) / $totalWeighting); + if ($total_weighting != 0) { + $moyenne_test = round(($total_result * 100) / $total_weighting); } else { - $moyenneTest = null; + $moyenne_test = null; } - echo ''; + echo ''; } echo '
'.get_lang('Session').''.get_lang('MoyenneTest').''.get_lang('MoyenneExamen').'
'.$a_session['name'].''.(is_null($moyenneTest) ? '' : $moyenneTest.'%').'
'.$session['name'].''.(is_null($moyenne_test) ? '' : $moyenne_test.'%').'
'; } else { echo get_lang('NoSession'); } } else { - $sqlCourse = "SELECT title,code + $sql_course = "SELECT title,code FROM $tbl_course as course ORDER BY title ASC"; - $resultCourse = Database::query($sqlCourse, __FILE__, __LINE__); + $result_course = Database::query($sql_course, __FILE__, __LINE__); echo "".get_lang('MoySession').""; echo "

"; - if (Database::num_rows($resultCourse) > 0) { + if (Database::num_rows($result_course) > 0) { echo ''; - while ($a_course= Database::fetch_array($resultCourse)) { - $sqlMoyTest = "SELECT exe_result,exe_weighting + while ($course= Database::fetch_array($result_course)) { + $sql_moy_test = "SELECT exe_result,exe_weighting FROM $tbl_track_exercice - WHERE exe_cours_id = '".$a_course['code']."'"; - $resultMoyTest = Database::query($sqlMoyTest, __FILE__, __LINE__); + WHERE exe_cours_id = '".$course['code']."'"; + $result_moy_test = Database::query($sql_moy_test, __FILE__, __LINE__); $result = 0; $weighting = 0; - while ($a_moyTest = Database::fetch_array($resultMoyTest)) { - $result = $result + $a_moyTest['exe_result']; - $weighting = $weighting + $a_moyTest['exe_weighting']; + while ($moy_test = Database::fetch_array($result_moy_test)) { + $result = $result + $moy_test['exe_result']; + $weighting = $weighting + $moy_test['exe_weighting']; } if ($weighting != 0) { - $moyenneTest = round(($result * 100) / $weighting); + $moyenne_test = round(($result * 100) / $weighting); } else { - $moyenneTest = null; + $moyenne_test = null; } - echo ''; + echo ''; } echo '
'.get_lang('Course').''.get_lang('MoyenneTest').''.get_lang('MoyenneExamen').'
'.$a_course['title'].''.(is_null($moyenneTest) ? '' : $moyenneTest.'%').'
'.$course['title'].''.(is_null($moyenne_test) ? '' : $moyenne_test.'%').'
'; } else { diff --git a/main/mySpace/session.php b/main/mySpace/session.php index 044cd1be10..65e7c6dc7b 100644 --- a/main/mySpace/session.php +++ b/main/mySpace/session.php @@ -116,7 +116,7 @@ if ($nb_sessions > 0) { $table -> set_header(2, get_lang('Date')); $table -> set_header(3, get_lang('Details'), false); - $all_datas = array(); + $all_data = array(); foreach ($a_sessions as $session) { $row = array(); $row[] = $session['name']; @@ -137,7 +137,7 @@ if ($nb_sessions > 0) { } else { $row[] = ''; } - $all_datas[] = $row; + $all_data[] = $row; } if (!isset($tracking_column)) { @@ -145,20 +145,20 @@ if ($nb_sessions > 0) { } if ($_GET['tracking_direction'] == 'DESC') { - usort($all_datas, 'rsort_sessions'); + usort($all_data, 'rsort_sessions'); } else { - usort($all_datas, 'sort_sessions'); + usort($all_data, 'sort_sessions'); } if ($export_csv) { usort($csv_content, 'sort_sessions'); } - foreach ($all_datas as $row) { + foreach ($all_data as $row) { $table -> addRow($row); } - $table -> setColAttributes(3,array('align'=>'center')); + $table -> setColAttributes(3, array('align' => 'center')); $table -> display(); if ($export_csv) { diff --git a/main/mySpace/student.php b/main/mySpace/student.php index ab7a92cc63..9db3c35459 100644 --- a/main/mySpace/student.php +++ b/main/mySpace/student.php @@ -66,8 +66,8 @@ $tbl_session_rel_user = Database :: get_main_table(TABLE_MAIN_SESSION_USER); */ function count_student_coached() { - global $a_students; - return count($a_students); + global $students; + return count($students); } function sort_users($a, $b) { @@ -118,24 +118,24 @@ if ($isCoach || api_is_platform_admin() || $_user['status'] == DRH) { if (!isset($_GET['id_session'])) { if ($isCoach) { - $a_courses = Tracking :: get_courses_followed_by_coach($coach_id); - $a_students = Tracking :: get_student_followed_by_coach($coach_id); + $courses = Tracking :: get_courses_followed_by_coach($coach_id); + $students = Tracking :: get_student_followed_by_coach($coach_id); } elseif ($_user['status'] == DRH) { - $a_students = Tracking :: get_student_followed_by_drh($_user['user_id']); + $students = Tracking :: get_student_followed_by_drh($_user['user_id']); $courses_of_the_platform = CourseManager :: get_real_course_list(); foreach ($courses_of_the_platform as $course) { - $a_courses[$course['code']] = $course['code']; + $courses[$course['code']] = $course['code']; } } } else { - $a_students = Tracking :: get_student_followed_by_coach_in_a_session($_GET['id_session'], $coach_id); + $students = Tracking :: get_student_followed_by_coach_in_a_session($_GET['id_session'], $coach_id); } $tracking_column = isset($_GET['tracking_column']) ? $_GET['tracking_column'] : ($is_western_name_order xor $sort_by_first_name) ? 1 : 0; $tracking_direction = isset($_GET['tracking_direction']) ? $_GET['tracking_direction'] : DESC; - if (count($a_students) > 0) { + if (count($students) > 0) { $table = new SortableTable('tracking', 'count_student_coached', null, ($is_western_name_order xor $sort_by_first_name) ? 1 : 0); if ($is_western_name_order) { $table -> set_header(0, get_lang('FirstName'), true, 'align="center'); @@ -179,19 +179,18 @@ if ($isCoach || api_is_platform_admin() || $_user['status'] == DRH) { get_lang('LatestLogin', '') ); } - } $all_datas = array(); - foreach ($a_students as $student_id) { - $student_datas = UserManager :: get_user_info_by_id($student_id); + foreach ($students as $student_id) { + $student_data = UserManager :: get_user_info_by_id($student_id); if(isset($_GET['id_session'])) { - $a_courses = Tracking :: get_course_list_in_session_from_student($student_id, $_GET['id_session']); + $courses = Tracking :: get_course_list_in_session_from_student($student_id, $_GET['id_session']); } $avg_time_spent = $avg_student_score = $avg_student_progress = $total_assignments = $total_messages = 0; $nb_courses_student = 0; - foreach ($a_courses as $course_code) { + foreach ($courses as $course_code) { if (CourseManager :: is_user_subscribed_in_course($student_id, $course_code, true)) { $avg_time_spent += Tracking :: get_time_spent_on_the_platform($student_id, $course_code); $avg_student_score += Tracking :: get_avg_student_score($student_id, $course_code); @@ -214,11 +213,11 @@ if ($isCoach || api_is_platform_admin() || $_user['status'] == DRH) { $row = array(); if ($is_western_name_order) { - $row[] = $student_datas['firstname']; - $row[] = $student_datas['lastname']; + $row[] = $student_data['firstname']; + $row[] = $student_data['lastname']; } else { - $row[] = $student_datas['lastname']; - $row[] = $student_datas['firstname']; + $row[] = $student_data['lastname']; + $row[] = $student_data['firstname']; } $row[] = api_time_to_hms($avg_time_spent); $row[] = is_null($avg_student_progress) ? null : round($avg_student_progress, 2).'%'; diff --git a/main/mySpace/user_import.php b/main/mySpace/user_import.php index aefd700d38..656eb5702a 100644 --- a/main/mySpace/user_import.php +++ b/main/mySpace/user_import.php @@ -94,11 +94,11 @@ function check_user_in_array($usernames, $user_array) { * @return 0 if the user is not subscribed otherwise it returns the user_id of the given username * @author Julio Montoya Armas */ -function user_available_in_session($username, $CourseList, $id_session) { +function user_available_in_session($username, $course_list, $id_session) { $table_user = Database::get_main_table(TABLE_MAIN_USER); $tbl_session_rel_course_rel_user = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER); - foreach($CourseList as $enreg_course) { + foreach($course_list as $enreg_course) { $sql_select = "SELECT u.user_id FROM $tbl_session_rel_course_rel_user rel INNER JOIN $table_user u on (rel.id_user=u.user_id) WHERE rel.id_session='$id_session' AND u.status='5' AND u.username ='$username' AND rel.course_code='$enreg_course'"; @@ -120,7 +120,7 @@ but if in the database there is a user with a name jmontoya the users registered @param $users list of users @author Julio Montoya Armas */ -function check_all_usernames($users, $CourseList, $id_session) { +function check_all_usernames($users, $course_list, $id_session) { $table_user = Database::get_main_table(TABLE_MAIN_USER); $usernames = array(); $new_users = array(); @@ -138,7 +138,7 @@ function check_all_usernames($users, $CourseList, $id_session) { $user['UserName'] = $desired_username['username'].$desired_username['sufix']; $user['create'] = '1'; } else { - $is_session_avail = user_available_in_session($user['UserName'], $CourseList, $id_session); + $is_session_avail = user_available_in_session($user['UserName'], $course_list, $id_session); if ($is_session_avail == 0) { //$desired_username = make_username($user['FirstName'],$user['LastName'],$user['UserName']); //$user['UserName'] = $desired_username['username'].$desired_username['sufix']; @@ -169,7 +169,7 @@ function check_all_usernames($users, $CourseList, $id_session) { * @param the session id * @author Julio Montoya Armas */ -function get_user_creator($users,$CourseList, $id_session) { +function get_user_creator($users, $course_list, $id_session) { $errors = array(); foreach ($users as $index => $user) { // database table definition @@ -244,7 +244,7 @@ function complete_missing_data($user) { /** * Save the imported data */ -function save_data($users, $CourseList, $id_session) { +function save_data($users, $course_list, $id_session) { $tbl_session = Database::get_main_table(TABLE_MAIN_SESSION); $tbl_session_rel_course = Database::get_main_table(TABLE_MAIN_SESSION_COURSE); $tbl_session_rel_course_rel_user = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER); @@ -272,7 +272,7 @@ function save_data($users, $CourseList, $id_session) { // inserting users $super_list = array(); - foreach ($CourseList as $enreg_course) { + foreach ($course_list as $enreg_course) { $nbr_users = 0; $new_users = array(); foreach ($users as $index => $user) { @@ -512,14 +512,14 @@ if ($_POST['formSent'] && $_FILES['import_file']['size'] !== 0) { //selecting all the courses from the session id requested $sql = "SELECT course_code FROM $tbl_session_rel_course WHERE id_session='$id_session'"; $result = Database::query($sql, __FILE__, __LINE__); - $CourseList = array(); + $course_list = array(); while ($row = Database::fetch_array($result)) { - $CourseList[] = $row['course_code']; + $course_list[] = $row['course_code']; } - $errors = get_user_creator($users, $CourseList, $id_session); - $users = check_all_usernames($users, $CourseList, $id_session); + $errors = get_user_creator($users, $course_list, $id_session); + $users = check_all_usernames($users, $course_list, $id_session); if (count($errors) == 0) { - save_data($users, $CourseList, $id_session); + save_data($users, $course_list, $id_session); } } else { header('Location: course.php?id_session='.$id_session.'&action=error_message&message='.urlencode(get_lang('NoSessionId')));