diff --git a/main/mySpace/course.php b/main/mySpace/course.php index 8b07281967..6f5967f1b3 100755 --- a/main/mySpace/course.php +++ b/main/mySpace/course.php @@ -82,31 +82,30 @@ if (api_is_drh() || api_is_session_admin() || api_is_platform_admin()) { $a_courses = array_keys($courses); if (!api_is_session_admin()) { - $menu_items[] = ''.get_lang('Students').''; - $menu_items[] = ''.get_lang('Teachers').''; - if (empty($_GET['user_id']) && empty($id_session)) { - $menu_items[] = get_lang('Courses'); - } else { - $menu_items[] = ''.get_lang('Courses').''; - } - $menu_items[] = ''.get_lang('Sessions').''; + + $menu_items[] = Display::url(Display::return_icon('stats.png', get_lang('MyStats'),'',32),api_get_path(WEB_CODE_PATH)."auth/my_progress.php" ); + $menu_items[] = Display::url(Display::return_icon('user.png', get_lang('Students'), array(), 32), "index.php?view=drh_students&display=yourstudents"); + $menu_items[] = Display::url(Display::return_icon('teacher.png', get_lang('Trainers'), array(), 32), 'teachers.php'); + $menu_items[] = Display::return_icon('course_na.png', get_lang('Courses'), array(), 32); + $menu_items[] = Display::url(Display::return_icon('session.png', get_lang('Sessions'), array(), 32), 'session.php'); + + } - echo '
'; + echo '
'; $nb_menu_items = count($menu_items); if ($nb_menu_items > 1) { foreach ($menu_items as $key => $item) { - echo $item; - if ($key != $nb_menu_items - 1) { - echo ' | '; - } + echo $item; } } if (count($a_courses) > 0) { - echo '   '.get_lang('Print').' '; + echo ''; + echo Display::url(Display::return_icon('printer.png', get_lang('Print'), array(), 32), 'javascript: void(0);', array('onclick'=>'javascript: window.print();')); + echo ''; } echo '
'; - echo '

'.$title.'

'; + echo '

'.$title.'

'; } // Database Table Definitions diff --git a/main/mySpace/index.php b/main/mySpace/index.php index 2224b68c47..3bd3a26a05 100755 --- a/main/mySpace/index.php +++ b/main/mySpace/index.php @@ -22,13 +22,21 @@ ob_start(); $export_csv = isset($_GET['export']) && $_GET['export'] == 'csv' ? true : false; $display = isset($_GET['display']) ? Security::remove_XSS($_GET['display']) : null; $csv_content = array(); -$nameTools = get_lang('MySpace'); +$nameTools = get_lang('MySpace'); -$user_id = api_get_user_id(); -$nb_sessions = 0; +$user_id = api_get_user_id(); +$is_coach = api_is_coach($_GET['session_id']); // This is used? +$is_platform_admin = api_is_platform_admin(); +$is_drh = api_is_drh(); +$is_session_admin = api_is_session_admin(); + +$nb_sessions = 0; +$nb_teacher_courses = 0; +$title = null; // access control api_block_anonymous_users(); + if (!$export_csv) { Display :: display_header($nameTools); } else { @@ -60,12 +68,6 @@ $tbl_track_cours_access = Database :: get_statistic_table(TABLE_STATISTIC_TRACK /* * FUNCTIONS */ -/* -function count_teacher_courses() { - global $nb_teacher_courses; - return $nb_teacher_courses; -}*/ - function count_coaches() { global $total_no_coaches; return $total_no_coaches; @@ -104,11 +106,6 @@ function rsort_sessions($a, $b) { /* * MAIN CODE */ -$is_coach = api_is_coach($_GET['session_id']); -$is_platform_admin = api_is_platform_admin(); -$is_drh = api_is_drh(); -$is_session_admin = api_is_session_admin(); - if ($is_session_admin) { header('location:session.php'); exit; @@ -122,148 +119,125 @@ if (isset($_GET['view']) && in_array($_GET['view'], $views)) { } $menu_items = array(); -$nb_teacher_courses = 0; -$title = null; global $_configuration; -//If is a teacher coach or admin -if (api_is_allowed_to_create_course()) { - - $session_id = isset($_GET['session_id']) ? intval($_GET['session_id']): 0; - if (!empty($session_id)) { - $courses = Tracking::get_courses_followed_by_coach($user_id, $session_id); - } else { - $courses = CourseManager::get_course_list_of_user_as_course_admin($user_id); - } - - $nb_teacher_courses = count($courses); - - $sessions = Tracking::get_sessions_coached_by_user($user_id); - $nb_sessions = count($sessions); - - if ($nb_teacher_courses || $nb_sessions) { - - if (!$is_coach && !$is_platform_admin) { - $view = 'teacher'; - } - - if ($view == 'teacher' && empty($session_id)) { - $menu_items[] = get_lang('TeacherInterface'); +//If is a teacher or admin +if (api_is_allowed_to_create_course() || api_is_drh()) { - if ($nb_teacher_courses) { - $title = get_lang('Courses'); - } - } else { - if (!empty($session_id)) { - $session_name = api_get_session_name($session_id); - $title = Display::return_icon('session.png', get_lang('Session'), array(), 22).' '.$session_name; - } - $menu_items[] = ''.get_lang('TeacherInterface').''; - } - } } -if ($is_coach && $display != 'yourstudents') { - if ($nb_teacher_courses == 0 && !$is_platform_admin) { - $view = 'coach'; - } - if ($view == 'coach') { - $menu_items[] = get_lang('CoachInterface'); - $title = get_lang('YourStatistics'); - } else { - $menu_items[] = ''.get_lang('CoachInterface').''; - } -} - -if ($is_platform_admin && $display != 'yourstudents') { - if ($nb_teacher_courses == 0 && $nb_sessions == 0) { - $view = 'admin'; - } - +if ($is_platform_admin) { if ($view == 'admin') { - $menu_items[] = get_lang('AdminInterface'); $title = get_lang('CoachList'); - $menu_items[] = ''.get_lang('ExamTracking').''; - } else { - $menu_items[] = ''.get_lang('AdminInterface').''; - $menu_items[] = ''.get_lang('ExamTracking').''; + $menu_items[] = Display::url(Display::return_icon('teacher.png', get_lang('TeacherInterface'), array(), 32), api_get_self().'?view=teacher'); + $menu_items[] = Display::url(Display::return_icon('star_na.png', get_lang('AdminInterface'), array(), 32), api_get_self().'?view=admin'); + $menu_items[] = Display::url(Display::return_icon('quiz.png', get_lang('ExamTracking'), array(), 32), api_get_path(WEB_CODE_PATH).'tracking/exams.php'); + } else { + $menu_items[] = Display::return_icon('teacher_na.png', get_lang('TeacherInterface'), array(), 32); + $menu_items[] = Display::url(Display::return_icon('star.png', get_lang('AdminInterface'), array(), 32), api_get_self().'?view=admin'); + $menu_items[] = Display::url(Display::return_icon('quiz.png', get_lang('ExamTracking'), array(), 32), api_get_path(WEB_CODE_PATH).'tracking/exams.php'); } } -if ($is_drh || ($display == 'yourstudents')) { +if ($is_drh) { $view = 'drh'; - $menu_items[] = get_lang('Students'); - $menu_items[] = ''.get_lang('Trainers').''; - $menu_items[] = ''.get_lang('Courses').''; - $menu_items[] = ''.get_lang('Sessions').''; + $menu_items[] = Display::return_icon('user_na.png', get_lang('Students'), array(), 32); + $menu_items[] = Display::url(Display::return_icon('teacher.png', get_lang('Trainers'), array(), 32), 'teachers.php'); + $menu_items[] = Display::url(Display::return_icon('course.png', get_lang('Courses'), array(), 32), 'course.php'); + $menu_items[] = Display::url(Display::return_icon('session.png', get_lang('Sessions'), array(), 32), 'session.php'); } -// Actions menu -$nb_menu_items = count($menu_items); +echo '
'; -if ($nb_teacher_courses > 0 ) { - echo '
'; - - if ($display == 'useroverview' || $display == 'sessionoverview' || $display == 'courseoverview') { - echo ''; - echo Display::return_icon("export_csv.png", get_lang('ExportAsCSV'),array(), 32); - echo ''; - } +echo ''; +if ($display == 'useroverview' || $display == 'sessionoverview' || $display == 'courseoverview') { + echo ''; + echo Display::return_icon("export_csv.png", get_lang('ExportAsCSV'),array(), 32); + echo ''; +} +echo ''. Display::return_icon('printer.png', get_lang('Print'),'','32').''; +echo ''; - if (!empty($session_id)) { - echo ''.Display::return_icon('back.png', get_lang('Back'),'','32').''; - } else { - echo Display::url(Display::return_icon('stats.png', get_lang('MyStats'),'',32),api_get_path(WEB_CODE_PATH)."auth/my_progress.php" ); - } - - echo ''. Display::return_icon('printer.png', get_lang('Print'),'','32').''; - - if (empty($session_id)) { - if ($nb_menu_items > 1) { - foreach ($menu_items as $key => $item) { - echo $item; - if ($key != $nb_menu_items - 1) { - echo ' | '; - } - } - } - } - - echo '
'; +if (!empty($session_id)) { + echo ''.Display::return_icon('back.png', get_lang('Back'),'','32').''; } else { - echo ''; -} + echo Display::url(Display::return_icon('stats.png', get_lang('MyStats'),'',32),api_get_path(WEB_CODE_PATH)."auth/my_progress.php" ); +} -echo Display::tag('h2', $title); +// Actions menu +$nb_menu_items = count($menu_items); -if (($is_drh && $view == 'drh') || ($display == 'yourstudents')) { - // get data for human resources manager - $students = array_keys(UserManager::get_users_followed_by_drh($user_id, STUDENT)); - $courses_of_the_platform = CourseManager :: get_real_course_list(); - foreach ($courses_of_the_platform as $course) { - $courses[$course['code']] = $course['code']; +if (empty($session_id)) { + if ($nb_menu_items > 1) { + foreach ($menu_items as $key => $item) { + echo $item; + } } } + +echo '
'; -if ($is_coach && $view == 'coach') { - $students = Tracking::get_student_followed_by_coach($user_id); - $courses = Tracking::get_courses_followed_by_coach($user_id); -} -if ($view == 'coach' || $view == 'drh') { +if ($nb_teacher_courses || $nb_sessions) { + //If we are in course + if (empty($session_id)) { + if ($nb_teacher_courses) { + $title = ' '.get_lang('Courses').' ('.$nb_teacher_courses.') '; + } + } else { + //If we are in Course Session + $session_name = api_get_session_name($session_id); + $title = Display::return_icon('session.png', get_lang('Session'), array(), 22).' '.$session_name; + $menu_items[] = ''.get_lang('TeacherInterface').''; + } +} + + +//if (empty($session_id) && $view == 'teacher') { +if (empty($session_id)) { + + //Getting courses followed by a coach (No session courses) + $courses = CourseManager::get_course_list_as_coach($user_id, false); + if (isset($courses[0])) { + $courses = $courses[0]; + } + + //Getting students from courses and courses in sessions (For show the total students that the user follows) + $students = CourseManager::get_user_list_from_courses_as_coach($user_id); + + // Sessions for the coach + $sessions = Tracking::get_sessions_coached_by_user($user_id); + $nb_sessions = count($sessions); + + //If is drh + + if ($is_drh) { + // get data for human resources manager + $students = array_keys(UserManager::get_users_followed_by_drh($user_id, STUDENT)); + $courses_of_the_platform = CourseManager :: get_real_course_list(); + foreach ($courses_of_the_platform as $course) { + $courses[$course['code']] = $course['code']; + } + } + + + //Courses for the teacher + $nb_teacher_courses = count($courses); + + //Students $nb_students = count($students); - $total_time_spent = 0; - $total_courses = 0; - $avg_total_progress = 0; - $avg_results_to_exercises = 0; - $nb_inactive_students = 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; - - if (!empty($students)) + + if (!empty($students)) foreach ($students as $student_id) { // inactive students $last_connection_date = Tracking :: get_last_connection_date($student_id, true, true); @@ -274,7 +248,7 @@ if ($view == 'coach' || $view == 'drh') { } else { $nb_inactive_students++; } - + $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; @@ -286,10 +260,10 @@ if ($view == 'coach' || $view == 'drh') { $nb_assignments += Tracking :: count_student_assignments($student_id, $course_code); $avg_student_progress += Tracking :: get_avg_student_progress($student_id, $course_code); $myavg_temp = Tracking :: get_avg_student_score($student_id, $course_code); - + if (is_numeric($myavg_temp)) $avg_student_score += $myavg_temp; - + 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++; @@ -299,13 +273,16 @@ if ($view == 'coach' || $view == 'drh') { // average progress of the student $avg_student_progress = $nb_courses_student ?$avg_student_progress / $nb_courses_student:0; $avg_total_progress += $avg_student_progress; - + // average test results of the student $avg_student_score = $avg_student_score?$avg_student_score / $nb_courses_student:0; $avg_results_to_exercises += $avg_student_score; } if ($nb_students > 0) { + + echo Display::tag('h2', ' '.get_lang('Students').' ('.$nb_students.')'); + // average progress $avg_total_progress = $avg_total_progress / $nb_students; // average results to the tests @@ -318,6 +295,56 @@ if ($view == 'coach' || $view == 'drh') { $nb_assignments = $nb_assignments / $nb_students; // average posts $nb_posts = $nb_posts / $nb_students; + + if ($export_csv) { + //csv part + $csv_content[] = array(get_lang('Probationers', '')); + $csv_content[] = array(get_lang('InactivesStudents', ''), $nb_inactive_students ); + $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(); + } else { + // html part + echo ' +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
'.get_lang('InactivesStudents').''.$nb_inactive_students.'
'.get_lang('AverageTimeSpentOnThePlatform').''.(is_null($avg_time_spent) ? '' : api_time_to_hms($avg_time_spent)).'
'.get_lang('AverageCoursePerStudent').''.(is_null($avg_courses_per_student) ? '' : $avg_courses_per_student).'
'.get_lang('AverageProgressInLearnpath').''.(is_null($avg_total_progress) ? '' : round($avg_total_progress, 2).'%').'
'.get_lang('AverageResultsToTheExercices').''.(is_null($avg_results_to_exercises) ? '' : round($avg_results_to_exercises, 2).'%').'
'.get_lang('AveragePostsInForum').''.(is_null($nb_posts) ? '' : round($nb_posts, 2)).'
'.get_lang('AverageAssignments').''.(is_null($nb_assignments) ? '' : round($nb_assignments, 2)).'
+ '.get_lang('SeeStudentList').' +

'; + } + } else { $avg_total_progress = null; $avg_results_to_exercises = null; @@ -326,193 +353,20 @@ if ($view == 'coach' || $view == 'drh') { $nb_assignments = null; $nb_posts = null; } - - if ($export_csv) { - //csv part - $csv_content[] = array(get_lang('Probationers', '')); - $csv_content[] = array(get_lang('InactivesStudents', ''), $nb_inactive_students ); - $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(); - } else { - // html part - echo ' -
-

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

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- '.get_lang('InactivesStudents').' - - '.$nb_inactive_students.' -
- '.get_lang('AverageTimeSpentOnThePlatform').' - - '.(is_null($avg_time_spent) ? '' : api_time_to_hms($avg_time_spent)).' -
- '.get_lang('AverageCoursePerStudent').' - - '.(is_null($avg_courses_per_student) ? '' : $avg_courses_per_student).' -
- '.get_lang('AverageProgressInLearnpath').' - - '.(is_null($avg_total_progress) ? '' : round($avg_total_progress, 2).'%').' -
- '.get_lang('AverageResultsToTheExercices').' - - '.(is_null($avg_results_to_exercises) ? '' : round($avg_results_to_exercises, 2).'%').' -
- '.get_lang('AveragePostsInForum').' - - '.(is_null($nb_posts) ? '' : round($nb_posts, 2)).' -
- '.get_lang('AverageAssignments').' - - '.(is_null($nb_assignments) ? '' : round($nb_assignments, 2)).' -

- '.get_lang('SeeStudentList').' -
'; - } -} - -if ($view == 'coach') { - /** - * Infos about sessions of the coach - **/ - $sessions = Tracking :: get_sessions_coached_by_user($user_id); - $nb_sessions = count($sessions); - $nb_sessions_past = $nb_sessions_future = $nb_sessions_current = 0; - $courses = array(); - foreach ($sessions as $session) { - if ($session['date_start'] == '0000-00-00') { - $nb_sessions_current ++; - } else { - $date_start = explode('-', $session['date_start']); - $time_start = mktime(0, 0, 0, $date_start[1], $date_start[2], $date_start[0]); - $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++; - } elseif (time() < $time_start) { - $nb_sessions_future++; - } elseif (time() > $time_end) { - $nb_sessions_past++; - } - } - $courses = array_merge($courses, Tracking::get_courses_list_from_session($session['id'])); - } - - 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; - } - - - if ($export_csv) { - //csv part - $csv_content[] = array(get_lang('Sessions', '')); - $csv_content[] = array(get_lang('NbActiveSessions', '').';'.$nb_sessions_current); - $csv_content[] = array(get_lang('NbPastSessions', '').';'.$nb_sessions_past); - $csv_content[] = array(get_lang('NbFutureSessions', '').';'.$nb_sessions_future); - $csv_content[] = array(get_lang('NbStudentPerSession', '').';'.$nb_students_per_session); - $csv_content[] = array(get_lang('NbCoursesPerSession', '').';'.$nb_courses_per_session); - $csv_content[] = array(); - } else { - // html part - echo ' -
-

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

- - - - - - - - - - - - - - - - - - - - - -
- '.get_lang('NbActiveSessions').' - - '.$nb_sessions_current.' -
- '.get_lang('NbPastSessions').' - - '.$nb_sessions_past.' -
- '.get_lang('NbFutureSessions').' - - '.$nb_sessions_future.' -
- '.get_lang('NbStudentPerSession').' - - '.(is_null($nb_students_per_session) ? '' : $nb_students_per_session).' -
- '.get_lang('NbCoursesPerSession').' - - '.(is_null($nb_courses_per_session) ? '' : $nb_courses_per_session).' -
- '.get_lang('SeeSessionList').' -
'; - } +} else { + $courses = Tracking::get_courses_followed_by_coach($user_id, $session_id); } -echo '
 
'; if (api_is_allowed_to_create_course() && $view == 'teacher') { - + + //Courses if ($nb_teacher_courses) { - //Courses table - + + + + echo Display::tag('h2', $title); + + $table = new SortableTable('courses', 'get_number_of_courses' ,array('MySpace','get_course_data')); $parameters['view'] = 'teacher'; $parameters['class'] = 'data_table'; @@ -540,9 +394,9 @@ if (api_is_allowed_to_create_course() && $view == 'teacher') { $table->display(); } - // Display sessions + // Display list of sessions if ($nb_sessions > 0 && !isset($_GET['session_id'])) { - echo '

'.get_lang('Sessions').'

'; + echo '

 '.get_lang('Sessions').' ('.$nb_sessions.')'.'

'; $table = new SortableTable('tracking_sessions', 'count_sessions_coached'); $table->set_header(0, get_lang('Title'), false); $table->set_header(1, get_lang('Date'), false); @@ -587,16 +441,87 @@ if (api_is_allowed_to_create_course() && $view == 'teacher') { $table -> setColAttributes(1, array('align' => 'center')); $table -> setColAttributes(2, array('align' => 'center')); $table -> setColAttributes(3, array('align' => 'center')); + + /* Start session over view stats */ + + $nb_sessions_past = $nb_sessions_future = $nb_sessions_current = 0; + $courses = array(); + foreach ($sessions as $session) { + if ($session['date_start'] == '0000-00-00') { + $nb_sessions_current ++; + } else { + $date_start = explode('-', $session['date_start']); + $time_start = mktime(0, 0, 0, $date_start[1], $date_start[2], $date_start[0]); + $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++; + } elseif (time() < $time_start) { + $nb_sessions_future++; + } elseif (time() > $time_end) { + $nb_sessions_past++; + } + } + $courses = array_merge($courses, Tracking::get_courses_list_from_session($session['id'])); + } + + 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; + } + + if ($export_csv) { + //csv part + $csv_content[] = array(get_lang('Sessions', '')); + $csv_content[] = array(get_lang('NbActiveSessions', '').';'.$nb_sessions_current); + $csv_content[] = array(get_lang('NbPastSessions', '').';'.$nb_sessions_past); + $csv_content[] = array(get_lang('NbFutureSessions', '').';'.$nb_sessions_future); + $csv_content[] = array(get_lang('NbStudentPerSession', '').';'.$nb_students_per_session); + $csv_content[] = array(get_lang('NbCoursesPerSession', '').';'.$nb_courses_per_session); + $csv_content[] = array(); + } else { + // html part + echo ' +
+ + + + + + + + + + + + + + + + + + + + + +
'.get_lang('NbActiveSessions').''.$nb_sessions_current.'
'.get_lang('NbPastSessions').''.$nb_sessions_past.'
'.get_lang('NbFutureSessions').''.$nb_sessions_future.'
'.get_lang('NbStudentPerSession').''.(is_null($nb_students_per_session) ? '' : $nb_students_per_session).'
'.get_lang('NbCoursesPerSession').''.(is_null($nb_courses_per_session) ? '' : $nb_courses_per_session).'
+
'; + } + /* End session overview */ $table -> display(); } } + if ($is_platform_admin && $view == 'admin' && $display != 'yourstudents') { echo ''.get_lang('DisplayCoaches').' | '; echo ''.get_lang('DisplayUserOverview').''; if ($display == 'useroverview') { - echo ' | '.get_lang('ExportUserOverviewOptions').''; + echo ' ( '.get_lang('ExportUserOverviewOptions').' )'; } echo ' | '.get_lang('DisplaySessionOverview').''; echo ' | '.get_lang('DisplayCourseOverview').''; diff --git a/main/mySpace/lp_tracking.php b/main/mySpace/lp_tracking.php index cf4981f660..2d5f5886ee 100755 --- a/main/mySpace/lp_tracking.php +++ b/main/mySpace/lp_tracking.php @@ -1,14 +1,12 @@ "../user/user.php?cidReq=".$cidReq, "name" => get_lang("Users")); } else if(!empty($_GET['origin']) && $_GET['origin'] == 'tracking_course') { // $interbreadcrumb[] = array ("url" => api_get_path(WEB_COURSE_PATH).$course_info['directory'], 'name' => $course_info['name']); - $interbreadcrumb[] = array ("url" => "../tracking/courseLog.php?cidReq=".$cidReq.'&studentlist=true&id_session='.$_SESSION['id_session'], "name" => get_lang("Tracking")); + $interbreadcrumb[] = array ("url" => "../tracking/courseLog.php?cidReq=".$cidReq.'&studentlist=true&id_session='.$session_id, "name" => get_lang("Tracking")); } else { $interbreadcrumb[] = array ("url" => "index.php", "name" => get_lang('MySpace')); $interbreadcrumb[] = array ("url" => "student.php", "name" => get_lang("MyStudents")); @@ -102,7 +102,7 @@ echo '
'; echo '
'; -$session_name = api_get_session_name(api_get_session_id()); +$session_name = api_get_session_name($session_id); $table_title = ($session_name? Display::return_icon('session.png', get_lang('Session'), array(), 22).' '.$session_name.' ':' '). Display::return_icon('course.png', get_lang('Course'), array(), 22).' '.$course_info['name'].' '. Display::return_icon('user.png', get_lang('User'), array(), 22).' '.$name; diff --git a/main/mySpace/myStudents.php b/main/mySpace/myStudents.php index 22cbde7906..0c0ce57573 100755 --- a/main/mySpace/myStudents.php +++ b/main/mySpace/myStudents.php @@ -8,9 +8,9 @@ // name of the language file that needs to be included $language_file = array('registration', 'index', 'tracking', 'exercice', 'admin', 'gradebook'); +$cidReset = true; require_once '../inc/global.inc.php'; -require_once api_get_path(LIBRARY_PATH).'tracking.lib.php'; require_once api_get_path(LIBRARY_PATH).'export.lib.inc.php'; require_once api_get_path(SYS_CODE_PATH).'newscorm/learnpath.class.php'; require_once api_get_path(SYS_CODE_PATH).'mySpace/myspace.lib.php'; @@ -20,7 +20,6 @@ require_once api_get_path(SYS_CODE_PATH).'gradebook/lib/be/result.class.php'; require_once api_get_path(SYS_CODE_PATH).'gradebook/lib/be/linkfactory.class.php'; require_once api_get_path(SYS_CODE_PATH).'gradebook/lib/be/category.class.php'; require_once api_get_path(LIBRARY_PATH).'attendance.lib.php'; -require_once api_get_path(LIBRARY_PATH).'sessionmanager.lib.php'; $htmlHeadXtra[] = ''; $export_csv = isset ($_GET['export']) && $_GET['export'] == 'csv' ? true : false; @@ -48,7 +46,7 @@ if (isset ($_GET['from']) && $_GET['from'] == 'myspace') { } $nameTools = get_lang('StudentDetails'); -//$cidReset = true; + $get_course_code = Security :: remove_XSS($_GET['course']); if (isset ($_GET['details'])) { if (!empty ($_GET['origin']) && $_GET['origin'] == 'user_course') { @@ -156,7 +154,9 @@ if (isset ($_GET['details'])) { api_block_anonymous_users(); -if (!api_is_allowed_to_edit() && !api_is_coach() && !api_is_drh() && !api_is_course_tutor() && $_user['status'] != SESSIONADMIN && !api_is_platform_admin(true)) { + + +if (!api_is_allowed_to_create_course() && !api_is_session_admin()) { api_not_allowed(true); } @@ -194,9 +194,7 @@ $student_id = intval($_GET['student']); $check= Security::check_token('get'); if ($check) { switch ($_GET['action']) { - case 'reset_lp' : - //$origin = isset($_GET['origin']) ?Security::remove_XSS($_GET['origin']):""; - //$details = isset($_GET['details']) ?Security::remove_XSS($_GET['details']):""; + case 'reset_lp' : $course = isset($_GET['course']) ?$_GET['course']:""; $lp_id = isset($_GET['lp_id']) ?intval($_GET['lp_id']):""; @@ -214,11 +212,87 @@ if ($check) { } Security::clear_token(); } + +// infos about user +$info_user = UserManager::get_user_info_by_id($student_id); + +$courses_in_session = array(); + +/*if (!isset ($_GET['id_coach'])) { + $sessions_coached_by_user = Tracking::get_sessions_coached_by_user($_user['user_id']); +foreach ($sessions_coached_by_user as $session_coached_by_user) { +$sid = intval($session_coached_by_user['id']); +$courses_followed_by_coach = Tracking :: get_courses_followed_by_coach($_user['user_id'], $sid); +$courses_in_session[$sid] = $courses_followed_by_coach; +} +} else { +$sessions_coached_by_user = Tracking::get_sessions_coached_by_user(intval($_GET['id_coach'])); +foreach ($sessions_coached_by_user as $session_coached_by_user) { +$sid = intval($session_coached_by_user['id']); +$courses_followed_by_coach = Tracking :: get_courses_followed_by_coach(intval($_GET['id_coach']), $sid); +$courses_in_session[$sid] = $courses_followed_by_coach; +} +}*/ + +$courses = CourseManager::get_course_list_of_user_as_course_admin(api_get_user_id()); +$courses_in_session_by_coach = array(); +$sessions_coached_by_user = Tracking::get_sessions_coached_by_user(api_get_user_id()); + +//RRHH or session admin +if (api_is_session_admin()) { -if (!empty ($_GET['student'])) { + $session_by_session_admin = SessionManager::get_sessions_followed_by_drh(api_get_user_id()); + if (!empty($session_by_session_admin)) { + foreach ($session_by_session_admin as $session_coached_by_user) { + $courses_followed_by_coach = Tracking :: get_courses_list_from_session($session_coached_by_user['id']); + $courses_in_session_by_coach[$session_coached_by_user['id']] = $courses_followed_by_coach; + } + } +} - // infos about user - $info_user = UserManager :: get_user_info_by_id($student_id); +// Teacher or admin +if (!empty($sessions_coached_by_user)) { + foreach ($sessions_coached_by_user as $session_coached_by_user) { + $sid = intval($session_coached_by_user['id']); + $courses_followed_by_coach = Tracking :: get_courses_followed_by_coach(api_get_user_id(), $sid); + $courses_in_session_by_coach[$sid] = $courses_followed_by_coach; + } +} + +$sql = 'SELECT course_code FROM ' . $tbl_course_user . ' WHERE relation_type<>'.COURSE_RELATION_TYPE_RRHH.' AND user_id=' . Database :: escape_string($info_user['user_id']); +$rs = Database::query($sql); + +while ($row = Database :: fetch_array($rs)) { + if (isset($courses[$row['course_code']])) { + $courses_in_session[0][] = $row['course_code']; + } +} + +// Get the list of sessions where the user is subscribed as student +$sql = 'SELECT id_session, course_code FROM ' . Database :: get_main_table(TABLE_MAIN_SESSION_COURSE_USER) . ' WHERE id_user=' . intval($info_user['user_id']); +$rs = Database::query($sql); +$tmp_sessions = array(); +while ($row = Database :: fetch_array($rs)) { + $tmp_sessions[] = $row['id_session']; + if (isset($courses_in_session_by_coach[$row['id_session']])) { + if (in_array($row['id_session'], $tmp_sessions)) { + $courses_in_session[$row['id_session']][] = $row['course_code']; + } + } +} + +if (empty($courses_in_session)) { + echo '
'; + echo ''.Display::return_icon('back.png', get_lang('Back'),'','32').''; + echo '
'; + Display::display_warning_message(get_lang('NoDataAvailable')); + Display::display_footer(); + exit; +} + + +if (!empty($_GET['student'])) { + if (api_is_drh() && !UserManager::is_user_followed_by_drh($student_id, $_user['user_id'])) { api_not_allowed(); } @@ -229,10 +303,8 @@ if (!empty ($_GET['student'])) { echo '
'; echo ''.Display::return_icon('back.png', get_lang('Back'),'','32').''; - echo ' - '.Display::return_icon('printer.png', get_lang('Print'),'','32').''; - echo ' - '.Display::return_icon('export_csv.png', get_lang('ExportAsCSV'),'','32').''; + echo ''.Display::return_icon('printer.png', get_lang('Print'),'','32').''; + echo ''.Display::return_icon('export_csv.png', get_lang('ExportAsCSV'),'','32').' '; if (!empty ($info_user['email'])) { $send_mail = ''.Display :: return_icon('mail_send.png', get_lang('SendMail'),'','32').''; } else { @@ -247,7 +319,7 @@ if (!empty ($_GET['student'])) { // is the user online ? - $student_online = Security :: remove_XSS($_GET['student']); + $student_online = intval($_GET['student']); $users_online = who_is_online(30); foreach ($users_online as $online) { if (in_array($_GET['student'], $online)) { @@ -260,20 +332,21 @@ if (!empty ($_GET['student'])) { // get average of score and average of progress by student $avg_student_progress = $avg_student_score = $nb_courses = 0; - $course_id = Security :: remove_XSS($_GET['course']); - if (!CourseManager :: is_user_subscribed_in_course($info_user['user_id'], $course_id, true)) { - unset ($courses[$key]); + $course_code = Security :: remove_XSS($_GET['course']); + + if (!CourseManager :: is_user_subscribed_in_course($info_user['user_id'], $course_code, true)) { + unset($courses[$key]); } else { $nb_courses++; - $avg_student_progress = Tracking::get_avg_student_progress($info_user['user_id'], $course_id, array(), $session_id); + $avg_student_progress = Tracking::get_avg_student_progress($info_user['user_id'], $course_code, array(), $session_id); //the score inside the Reporting table - $avg_student_score = Tracking::get_avg_student_score($info_user['user_id'], $course_id, array(), $session_id); + $avg_student_score = Tracking::get_avg_student_score($info_user['user_id'], $course_code, array(), $session_id); //var_dump($avg_student_score); - } + } $avg_student_progress = round($avg_student_progress, 2); // time spent on the course - $time_spent_on_the_course = api_time_to_hms(Tracking :: get_time_spent_on_the_course($info_user['user_id'], $course_id, $session_id)); + $time_spent_on_the_course = api_time_to_hms(Tracking :: get_time_spent_on_the_course($info_user['user_id'], $course_code, $session_id)); // get information about connections on the platform by student $first_connection_date = Tracking :: get_first_connection_date($info_user['user_id']); @@ -324,16 +397,15 @@ if (!empty ($_GET['student'])) { //Show title - $course_code = $_GET['course']; - $info_course = CourseManager :: get_course_information($course_code); + $info_course = CourseManager :: get_course_information($course_code); $coachs_name = ''; $session_name = ''; - $nb_login = Tracking :: count_login_per_student($info_user['user_id'], $_GET['course']); + $nb_login = Tracking :: count_login_per_student($info_user['user_id'], $_GET['course']); //get coach and session_name if there is one and if session_mode is activated if (api_get_setting('use_session_mode') == 'true' && $session_id > 0) { $session_info = api_get_session_info($session_id); - $course_coachs = api_get_coachs_from_course($session_id,$course_code); + $course_coachs = api_get_coachs_from_course($session_id, $course_code); $nb_login = ''; if (!empty($course_coachs)) { $info_tutor_name = array(); @@ -350,18 +422,14 @@ if (!empty ($_GET['student'])) { $session_name = $session_info['name']; } // end - $info_course = CourseManager :: get_course_information($get_course_code); - $session_name = api_get_session_name($session_id); - $table_title = ($session_name? Display::return_icon('session.png', get_lang('Session'), array(), 22).' '.$session_name.' ':''); - $table_title .= ($info_course ? Display::return_icon('course.png', get_lang('Course'), array(), 22).' '.$info_course['title'].' ':''); - $table_title .= Display::return_icon('user.png', get_lang('User'), array(), 22).api_get_person_name($info_user['firstname'], $info_user['lastname']); + $info_course = CourseManager :: get_course_information($get_course_code); + $table_title = Display::return_icon('user.png', get_lang('User'), array(), 22).api_get_person_name($info_user['firstname'], $info_user['lastname']); echo '

'.$table_title.'

'; ?> - - - +
+ '; @@ -384,86 +452,68 @@ if (!empty ($_GET['student'])) { } echo ''; ?> - + + + + + + + + + + + + + + + + + + + + + + + -
- - - - - - - - - - - - - - - - - - - - - - - - -
- -
- ' . $info_user['email'] . ''; - } else { - echo get_lang('NoEmail'); - } - ?> -
- -
- -
- -
- -
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
' . $info_user['email'] . ''; + } else { + echo get_lang('NoEmail'); + } ?> +
+
+
@@ -493,12 +543,8 @@ if ($timezone !== null) { '; - echo ''; + echo ''; + echo ''; echo ''; } } ?> @@ -509,39 +555,165 @@ if ($timezone !== null) { -
+$table_title = ''; - -
'; - echo get_lang('CountToolAccess'); - echo ''; - echo $nb_login; - echo '
'.get_lang('CountToolAccess').''.$nb_login.'
- - - - - - - - '.get_lang('Details').''; - if (api_is_course_admin()) { - echo ''; +if (!empty($session_id)) { + $session_name = api_get_session_name($session_id); + $table_title = ($session_name? Display::return_icon('session.png', get_lang('Session'), array(), 22).' '.$session_name.' ':''); +} +if (!empty($info_course['title'])) { + $table_title .= ($info_course ? Display::return_icon('course.png', get_lang('Course'), array(), 22).' '.$info_course['title'].' ':''); +} + +echo Display::tag('h2', $table_title); + +if (empty($_GET['details'])) { + + $csv_content[] = array (); + $csv_content[] = array ( + get_lang('Session', ''), + get_lang('Course', ''), + get_lang('Time', ''), + get_lang('Progress', ''), + get_lang('Score', ''), + get_lang('AttendancesFaults', ''), + get_lang('Evaluations') + ); + + $attendance = new Attendance(); + + foreach ($courses_in_session as $key => $courses) { + $session_id = $key; + $session_info = api_get_session_info($session_id); + $session_name = $session_info['name']; + $date_start = ''; + + if (!empty($session_info['date_start']) && $session_info['date_start'] != '0000-00-00') { + $date_start = api_format_date($session_info['date_start'], DATE_FORMAT_SHORT); + } + + $date_end = ''; + if (!empty($session_info['date_end']) && $session_info['date_end'] != '0000-00-00') { + $date_end = api_format_date($session_info['date_end'], DATE_FORMAT_SHORT); + } + if (!empty($date_start) && !empty($date_end)) { + $date_session = get_lang('From') . ' ' . $date_start . ' ' . get_lang('Until') . ' ' . $date_end; + } + $title = ''; + if (empty($session_id)) { + $title = Display::return_icon('course.png', get_lang('Courses'), array(), 22).' '.get_lang('Courses'); + } else { + $title = Display::return_icon('session.png', get_lang('Session'), array(), 22).' '.$session_name.($date_session?' ('.$date_session.')':''); + } + + // Courses + + echo '

'.$title.'

'; + + echo '
- - - 'absmiddle', 'hspace' => '3px')); ?> - - 'absmiddle', 'hspace' => '3px')); ?> - - 'absmiddle', 'hspace' => '3px')); ?> - - 'absmiddle','hspace' => '3px')); ?> - - 'absmiddle','hspace' => '3px')); ?> - '.get_lang('ResetLP').'
'; + echo ' + + + + + + + + '; + + if (!empty($courses)) { + foreach ($courses as $course_code) { + if (CourseManager :: is_user_subscribed_in_course($student_id, $course_code, true)) { + $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, $session_id)); + + // get average of faults in attendances by student + $results_faults_avg = $attendance->get_faults_average_by_course($student_id, $course_code, $session_id); + if (!empty($results_faults_avg['total'])) { + if (api_is_drh()) { + $attendances_faults_avg = ''.$results_faults_avg['faults'].'/'.$results_faults_avg['total'].' ('.$results_faults_avg['porcent'].'%)'; + } else { + $attendances_faults_avg = $results_faults_avg['faults'].'/'.$results_faults_avg['total'].' ('.$results_faults_avg['porcent'].'%)'; + } + } else { + $attendances_faults_avg = '0/0 (0%)'; + } + + // get evaluatios by student + $cats = Category::load(null, null, $course_code, null, null, $session_id); + $scoretotal = array(); + if (isset($cats)) { + if (!empty($session_id)) { + $scoretotal= $cats[0]->calc_score($student_id, $course_code, $session_id); + } else { + $scoretotal= $cats[0]->calc_score($student_id, $course_code); + } + } + + $scoretotal_display = '0/0 (0%)'; + if (!empty($scoretotal)) { + $scoretotal_display = round($scoretotal[0],2).'/'.round($scoretotal[1],2).'('.round(($scoretotal[0] / $scoretotal[1]) * 100,2) . ' %)'; } - ?> + + $progress = Tracking::get_avg_student_progress($info_user['user_id'], $course_code, null, $session_id); + $score = Tracking :: get_avg_student_score($info_user['user_id'], $course_code, null, $session_id); + $progress = empty($progress) ? '0%' : $progress.'%'; + $score = empty($score) ? '0%' : $score.'%'; + + $csv_content[] = array ( + $session_name, + $course_info['title'], + $time_spent_on_course, + $progress, + $score, + $attendances_faults_avg, + $scoretotal_display + ); + + echo ' + + + + + + '; + + if (isset ($_GET['id_coach']) && intval($_GET['id_coach']) != 0) { + echo ''; + } else { + echo ''; + } + echo ''; + } + } + } else { + echo ""; + } + echo '
'.get_lang('Course').''.get_lang('Time').''.get_lang('Progress').''.get_lang('Score').''.get_lang('AttendancesFaults').''.get_lang('Evaluations').''.get_lang('Details').'
'.$course_info['title'].''.$time_spent_on_course .''.$progress.''.$score.''.$attendances_faults_avg.''.$scoretotal_display.'
".get_lang('NoCourse')."
'; + } +} else { + $csv_content[] = array (); + $csv_content[] = array (str_replace(' ', '', $table_title)); +?> + +
+ + + + + + + + + + + '.get_lang('Details').''; + if (api_is_course_admin()) { + echo ''; + } + ?> ','lp_tracking.php?course='.Security::remove_XSS($_GET['course']).$from.'&origin='.Security::remove_XSS($_GET['origin']).'&lp_id='.$learnpath['id'].'&student_id='.$info_user['user_id'].'&session_id='.$session_id); + $link = Display::url('','lp_tracking.php?course='.Security::remove_XSS($_GET['course']).$from.'&origin='.Security::remove_XSS($_GET['origin']).'&lp_id='.$learnpath['id'].'&student_id='.$info_user['user_id'].'&id_session='.$session_id); echo Display::tag('td', $link, array('align'=>'center')); } @@ -799,307 +969,37 @@ if ($timezone !== null) { $chat_last_connection ); ?> - - - - - - - - - - - - - - - - - - - - - - - -
'absmiddle', 'hspace' => '3px')); ?> 'absmiddle', 'hspace' => '3px')); ?> 'absmiddle', 'hspace' => '3px')); ?> 'absmiddle','hspace' => '3px')); ?> 'absmiddle','hspace' => '3px')); ?>'.get_lang('ResetLP').'
- -
- - - -
- - - -
- - - -
- - - -
- - - -
-
+ + + + '.COURSE_RELATION_TYPE_RRHH.' AND user_id=' . Database :: escape_string($info_user['user_id']); - $rs = Database::query($sql); - - while ($row = Database :: fetch_array($rs)) { - $courses_in_session[0][] = $row['course_code']; - } + } //end details - // get the list of sessions where the user is subscribed as student - $sql = 'SELECT id_session, course_code FROM ' . Database :: get_main_table(TABLE_MAIN_SESSION_COURSE_USER) . ' WHERE id_user=' . intval($info_user['user_id']); - $rs = Database::query($sql); - $tmp_sessions = array(); - while ($row = Database :: fetch_array($rs)) { - $tmp_sessions[] = $row['id_session']; - if (in_array($row['id_session'],$tmp_sessions)) { - $courses_in_session[$row['id_session']][] = $row['course_code']; - } - } - } - - $csv_content[] = array (); - $csv_content[] = array ( - get_lang('Session', ''), - get_lang('Course', ''), - get_lang('Time', ''), - get_lang('Progress', ''), - get_lang('Score', ''), - get_lang('AttendancesFaults', ''), - get_lang('Evaluations') - ); - - $attendance = new Attendance(); - - foreach ($courses_in_session as $key => $courses) { - - $session_id = $key; - $session_info = api_get_session_info($session_id); - $session_name = $session_info['name']; - - $date_start = ''; - if (!empty ($session_info['date_start'])) { - $date_start = explode('-', $session_info['date_start']); - $date_start = $date_start[2] . '/' . $date_start[1] . '/' . $date_start[0]; - } - $date_end = ''; - if (!empty ($session_info['date_end'])) { - $date_end = explode('-', $session_info['date_end']); - $date_end = $date_end[2] . '/' . $date_end[1] . '/' . $date_end[0]; - } - - $date_session = get_lang('From') . ' ' . $date_start . ' ' . get_lang('To') . ' ' . $date_end; - - $title = ''; - if (empty($session_id)) { - $title = get_lang('Courses'); - } else { - $title = ucfirst($session_name).($date_session?' ('.$date_session.')':''); - } - - // courses - - echo '

'.$title.'

'; - echo ''; - echo ' - - - - - - - - '; - - if (!empty($courses)) { - - foreach ($courses as $course_code) { - if (CourseManager :: is_user_subscribed_in_course($student_id, $course_code, true)) { - $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, $session_id)); - - // get average of faults in attendances by student - $results_faults_avg = $attendance->get_faults_average_by_course($student_id, $course_code, $session_id); - if (!empty($results_faults_avg['total'])) { - - if (api_is_drh()) { - $attendances_faults_avg = ''.$results_faults_avg['faults'].'/'.$results_faults_avg['total'].' ('.$results_faults_avg['porcent'].'%)'; - } else { - $attendances_faults_avg = $results_faults_avg['faults'].'/'.$results_faults_avg['total'].' ('.$results_faults_avg['porcent'].'%)'; - } - - - } else { - $attendances_faults_avg = '0/0 (0%)'; - } - - // get evaluatios by student - $cats = Category::load(null, null, $course_code, null, null, $session_id); - $scoretotal = array(); - if (isset($cats)) { - if (!empty($session_id)) { - $scoretotal= $cats[0]->calc_score($student_id, $course_code, $session_id); - } else { - $scoretotal= $cats[0]->calc_score($student_id, $course_code); - } - } - - $scoretotal_display = '0/0 (0%)'; - if (!empty($scoretotal)) { - /* - if (api_is_drh()) { - $session_param = !empty($session_id)?'&id_session='.$session_id:''; - $scoretotal_display = ''.round($scoretotal[0],2).'/'.round($scoretotal[1],2).'('.round(($scoretotal[0] / $scoretotal[1]) * 100,2) . ' %)'; - } else { - $scoretotal_display = round($scoretotal[0],2).'/'.round($scoretotal[1],2).'('.round(($scoretotal[0] / $scoretotal[1]) * 100,2) . ' %)'; - } - */ - $scoretotal_display = round($scoretotal[0],2).'/'.round($scoretotal[1],2).'('.round(($scoretotal[0] / $scoretotal[1]) * 100,2) . ' %)'; - } - - $progress = Tracking::get_avg_student_progress($info_user['user_id'], $course_code, null, $session_id); - $score = Tracking :: get_avg_student_score($info_user['user_id'], $course_code, null, $session_id); - $progress = empty($progress) ? '0%' : $progress.'%'; - $score = empty($score) ? '0%' : $score.'%'; - - $csv_content[] = array ( - $session_name, - $course_info['title'], - $time_spent_on_course, - $progress, - $score, - $attendances_faults_avg, - $scoretotal_display - ); - - echo ' - - - - - - '; - - if (isset ($_GET['id_coach']) && intval($_GET['id_coach']) != 0) { - echo ''; - } else { - echo ''; - } - echo ''; - } - } - } else { - echo ""; - } - echo '
'.get_lang('Course').''.get_lang('Time').''.get_lang('Progress').''.get_lang('Score').''.get_lang('AttendancesFaults').''.get_lang('Evaluations').''.get_lang('Details').'
'.$course_info['title'].''.$time_spent_on_course .''.$progress.''.$score.''.$attendances_faults_avg.''.$scoretotal_display.'
".get_lang('NoCourse')."
'; - } - } //end of else !empty($details) - - /* @todo this code seems to be NOT used jmontoya - if (!empty ($_GET['details']) && $_GET['origin'] != 'tracking_course' && $_GET['origin'] != 'user_course') { - echo '

'; - } - - if (!empty ($_GET['exe_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']); - - $result_exercice_details = Database::query($sql_exercice_details); - - $sql_ex_name = "SELECT quiz.title - FROM " . $t_q . " AS quiz - WHERE quiz.id = " . intval($_GET['exe_id']); - ; - - $resultExName = Database::query($sql_ex_name); - $exName = Database :: fetch_array($resultExName); - - echo " - - - - "; - - while ($exerciceDetails = Database :: fetch_array($result_exercice_details)) { - $sqlAnswer = " SELECT qa.comment, qa.answer - FROM " . $t_qa . " as qa - WHERE qa.question_id = " . $exerciceDetails['id']; - - $resultAnswer = Database::query($sqlAnswer); - - echo ""; - - echo " - - - - "; - while ($answer = Database :: fetch_array($resultAnswer)) { - echo " - - - - - "; - } - } - echo "
- " . $exName['title'] . " -
- " . $exerciceDetails['question'] . ' /' . $exerciceDetails['ponderation'] . " -
- " . $answer['answer'] . " - - "; - if (!empty ($answer['comment'])) - echo $answer['comment']; - else - echo get_lang('NoComment'); - echo " -
"; - } - */ - //YW - commented out because it doesn't seem to be used - //$header = array_merge($headerLearnpath,$headerExercices,$headerProductions); } if ($export_csv) { ob_end_clean(); diff --git a/main/mySpace/session.php b/main/mySpace/session.php index 9ac843c6cc..c19c511b0f 100755 --- a/main/mySpace/session.php +++ b/main/mySpace/session.php @@ -11,8 +11,6 @@ $language_file = array ('registration', 'index', 'trad4all', 'tracking', 'admin' $cidReset = true; require_once '../inc/global.inc.php'; -require_once api_get_path(LIBRARY_PATH).'tracking.lib.php'; -require_once api_get_path(LIBRARY_PATH).'sessionmanager.lib.php'; require_once api_get_path(LIBRARY_PATH).'export.lib.inc.php'; api_block_anonymous_users(); @@ -36,9 +34,7 @@ if (isset($_GET['export']) && $_GET['export'] == 'csv') { } /* -=============================================================================== FUNCTION -=============================================================================== */ function count_sessions_coached() { @@ -64,11 +60,7 @@ function rsort_sessions($a, $b) { } } -/* -=============================================================================== - MAIN CODE -=============================================================================== -*/ +/* MAIN CODE */ if (isset($_GET['id_coach']) && $_GET['id_coach'] != '') { $id_coach = intval($_GET['id_coach']); @@ -81,28 +73,29 @@ if (api_is_drh() || api_is_session_admin() || api_is_platform_admin()) { $a_sessions = SessionManager::get_sessions_followed_by_drh($_user['user_id']); if (!api_is_session_admin()) { - $menu_items[] = ''.get_lang('Students').''; - $menu_items[] = ''.get_lang('Trainers').''; - $menu_items[] = ''.get_lang('Courses').''; + $menu_items[] = Display::url(Display::return_icon('stats.png', get_lang('MyStats'),'',32),api_get_path(WEB_CODE_PATH)."auth/my_progress.php" ); + $menu_items[] = Display::url(Display::return_icon('user.png', get_lang('Students'), array(), 32), "index.php?view=drh_students&display=yourstudents"); + $menu_items[] = Display::url(Display::return_icon('teacher.png', get_lang('Trainers'), array(), 32), 'teachers.php'); + $menu_items[] = Display::url(Display::return_icon('course.png', get_lang('Courses'), array(), 32), 'course.php'); + $menu_items[] = Display::return_icon('session_na.png', get_lang('Sessions'), array(), 32); } - $menu_items[] = get_lang('Sessions'); - echo '
'; + echo '
'; $nb_menu_items = count($menu_items); if ($nb_menu_items > 1) { foreach ($menu_items as $key => $item) { - echo $item; - if ($key != $nb_menu_items - 1) { - echo ' | '; - } + echo $item; } } if (count($a_sessions) > 0) { - echo '   '.get_lang('Print').' '; - echo ' '.get_lang('ExportAsCSV').''; + echo ''; + echo Display::url(Display::return_icon('printer.png', get_lang('Print'), array(), 32), 'javascript: void(0);', array('onclick'=>'javascript: window.print();')); + echo Display::url(Display::return_icon('export_csv.png', get_lang('ExportAsCSV'), array(), 32), api_get_self().'?export=csv'); + echo ''; + } echo '
'; - echo '

'.get_lang('YourSessionsList').'

'; + echo '

'.get_lang('YourSessionsList').'

'; } else { /*if (api_is_platform_admin()) { @@ -119,13 +112,7 @@ if ($export_csv) { } if ($nb_sessions > 0) { - - if (!api_is_drh()) { - echo '
-  '.get_lang('Print').' -  '.get_lang('ExportAsCSV').' -
'; - } + $table = new SortableTable('tracking', 'count_sessions_coached'); $table->set_header(0, get_lang('Title')); $table->set_header(1, get_lang('Date')); @@ -187,11 +174,4 @@ if ($nb_sessions > 0) { } else { echo get_lang('NoSession'); } - -/* -============================================================================== - FOOTER -============================================================================== -*/ - -Display::display_footer(); +Display::display_footer(); \ No newline at end of file diff --git a/main/mySpace/student.php b/main/mySpace/student.php index 5b20897036..7a2af5e772 100755 --- a/main/mySpace/student.php +++ b/main/mySpace/student.php @@ -6,7 +6,6 @@ $language_file = array ('registration', 'index', 'tracking', 'admin'); $cidReset = true; require_once '../inc/global.inc.php'; -require_once api_get_path(LIBRARY_PATH).'tracking.lib.php'; require_once api_get_path(LIBRARY_PATH).'export.lib.inc.php'; $export_csv = isset($_GET['export']) && $_GET['export'] == 'csv' ? true : false; @@ -54,10 +53,8 @@ $tbl_session_course_user = Database :: get_main_table(TABLE_MAIN_SESSION_COURSE $tbl_session_rel_user = Database :: get_main_table(TABLE_MAIN_SESSION_USER); /* - =============================================================================== - FUNCTION - =============================================================================== - */ + FUNCTION + */ function count_student_coached() { global $students; @@ -83,14 +80,11 @@ function rsort_users($a, $b) } } -/* - =============================================================================== - MAIN CODE - =============================================================================== - */ - -if ($isCoach || api_is_platform_admin() || api_is_drh()) { +/* MAIN CODE */ +//if ($isCoach || api_is_platform_admin() || api_is_drh()) { +if (api_is_allowed_to_create_course() || api_is_drh()) { + if ($export_csv) { $is_western_name_order = api_is_western_name_order(PERSON_NAME_DATA_EXPORT); } else { @@ -98,7 +92,7 @@ if ($isCoach || api_is_platform_admin() || api_is_drh()) { } $sort_by_first_name = api_sort_by_first_name(); - if (api_is_drh() || $_GET['display'] == 'yourstudents') { + if (api_is_drh()) { $title = get_lang('YourStudents'); if (!isset($_GET['id_session'])) { @@ -121,7 +115,7 @@ if ($isCoach || api_is_platform_admin() || api_is_drh()) { } $students = array_unique($students); } else { - $students = array_keys(UserManager::get_users_followed_by_drh($_user['user_id'], STUDENT)); + $students = array_keys(UserManager::get_users_followed_by_drh(api_get_user_id() , STUDENT)); } $courses_of_the_platform = CourseManager :: get_real_course_list(); @@ -129,55 +123,59 @@ if ($isCoach || api_is_platform_admin() || api_is_drh()) { $courses[$course['code']] = $course['code']; } } - - $menu_items[] = ''.get_lang('Students').''; - $menu_items[] = ''.get_lang('Trainers').''; - $menu_items[] = ''.get_lang('Courses').''; - $menu_items[] = ''.get_lang('Sessions').''; + + $menu_items[] = Display::url(Display::return_icon('stats.png', get_lang('MyStats'),'',32),api_get_path(WEB_CODE_PATH)."auth/my_progress.php" ); + $menu_items[] = Display::return_icon('user_na.png', get_lang('Students'), array(), 32); + $menu_items[] = Display::url(Display::return_icon('teacher.png', get_lang('Trainers'), array(), 32), 'teachers.php'); + $menu_items[] = Display::url(Display::return_icon('course.png', get_lang('Courses'), array(), 32), 'course.php'); + $menu_items[] = Display::url(Display::return_icon('session.png', get_lang('Sessions'), array(), 32), 'session.php'); + echo '
'; $nb_menu_items = count($menu_items); if ($nb_menu_items > 1) { foreach ($menu_items as $key => $item) { - echo $item; - if ($key != $nb_menu_items - 1) { - echo ' | '; - } + echo $item; } } if (count($students) > 0) { - echo '   '.get_lang('Print').' '; - echo ' '.get_lang('ExportAsCSV').''; + + echo ''; + echo Display::url(Display::return_icon('printer.png', get_lang('Print'), array(), 32), 'javascript: void(0);', array('onclick'=>'javascript: window.print();')); + echo Display::url(Display::return_icon('export_csv.png', get_lang('ExportAsCSV'), array(), 32), api_get_self().'?export=xls'); + echo ''; } echo '
'; - - echo '

'.$title.'

'; - - - } else { - echo '

'.$title.'

-
+ echo '

'.$title.'

'; + } else { + echo '
'; + echo '

'.$title.'

'; } if (isset($_GET['id_coach'])) { $coach_id = intval($_GET['id_coach']); } else { - $coach_id = $_user['user_id']; + $coach_id = api_get_user_id(); } - if (!isset($_GET['id_session'])) { - if ($isCoach) { - $courses = Tracking :: get_courses_followed_by_coach($coach_id); - $students = Tracking :: get_student_followed_by_coach($coach_id); + if (!isset($_GET['id_session'])) { + //Getting courses + $courses = CourseManager::get_course_list_as_coach($coach_id, false); + if (isset($courses[0])) { + $courses = $courses[0]; } + + //Getting students + $students = CourseManager::get_user_list_from_courses_as_coach($coach_id); + } else { - $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_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($students) > 0) { @@ -189,25 +187,25 @@ if ($isCoach || api_is_platform_admin() || api_is_drh()) { $table -> set_header(0, get_lang('LastName'), false, 'align="center'); $table -> set_header(1, get_lang('FirstName'), false, 'align="center'); } - $table -> set_header(2, get_lang('Time'), false); + /* $table -> set_header(2, get_lang('Time'), false); $table -> set_header(3, get_lang('Progress'), false); $table -> set_header(4, get_lang('Score'), false); $table -> set_header(5, get_lang('Student_publication'), false); - $table -> set_header(6, get_lang('Messages'), false); - $table -> set_header(7, get_lang('FirstLogin'), false); - $table -> set_header(8, get_lang('LatestLogin'), false); - $table -> set_header(9, get_lang('Details'), false); + $table -> set_header(6, get_lang('Messages'), false);*/ + $table -> set_header(2, get_lang('FirstLogin'), false); + $table -> set_header(3, get_lang('LatestLogin'), false); + $table -> set_header(4, get_lang('Details'), false); if ($export_csv) { if ($is_western_name_order) { $csv_header[] = array ( get_lang('FirstName', ''), get_lang('LastName', ''), - get_lang('Time', ''), - get_lang('Progress', ''), - get_lang('Score', ''), - get_lang('Student_publication', ''), - get_lang('Messages', ''), + //get_lang('Time', ''), + //get_lang('Progress', ''), + //get_lang('Score', ''), + //get_lang('Student_publication', ''), + //get_lang('Messages', ''), get_lang('FirstLogin', ''), get_lang('LatestLogin', '') ); @@ -215,31 +213,31 @@ if ($isCoach || api_is_platform_admin() || api_is_drh()) { $csv_header[] = array ( get_lang('LastName', ''), get_lang('FirstName', ''), - get_lang('Time', ''), - get_lang('Progress', ''), - get_lang('Score', ''), - get_lang('Student_publication', ''), - get_lang('Messages', ''), + //get_lang('Time', ''), + //get_lang('Progress', ''), + //get_lang('Score', ''), + //get_lang('Student_publication', ''), + //get_lang('Messages', ''), get_lang('FirstLogin', ''), get_lang('LatestLogin', '') ); } } - $all_datas = array(); + $all_datas = array(); foreach ($students as $student_id) { $student_data = UserManager :: get_user_info_by_id($student_id); - if(isset($_GET['id_session'])) { - $courses = Tracking :: get_course_list_in_session_from_student($student_id, $_GET['id_session']); - } + if (isset($_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 ($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_course($student_id, $course_code, $_GET['id_session']); - $my_average = Tracking :: get_avg_student_score($student_id, $course_code); - if(is_numeric($my_average)) { + $avg_time_spent += Tracking :: get_time_spent_on_the_course($student_id, $course_code, $_GET['id_session']); + $my_average = Tracking :: get_avg_student_score($student_id, $course_code); + if (is_numeric($my_average)) { $avg_student_score += $my_average; } $avg_student_progress += Tracking :: get_avg_student_progress($student_id, $course_code); @@ -267,12 +265,14 @@ if ($isCoach || api_is_platform_admin() || api_is_drh()) { $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).'%'; $row[] = is_null($avg_student_score) ? null : round($avg_student_score, 2).'%'; $row[] = $total_assignments; $row[] = $total_messages; + */ $string_date = Tracking :: get_last_connection_date($student_id, true); $first_date = Tracking :: get_first_connection_date($student_id); @@ -308,12 +308,12 @@ if ($isCoach || api_is_platform_admin() || api_is_drh()) { } $table -> updateColAttributes(0, array('align' => 'left')); $table -> updateColAttributes(1, array('align' => 'left')); - $table -> updateColAttributes(7, array('align' => 'left')); + /* $table -> updateColAttributes(7, array('align' => 'left')); $table -> updateColAttributes(8, array('align' => 'left')); - $table -> setColAttributes(9, array('align' => 'center')); + $table -> setColAttributes(9, array('align' => 'center'));*/ $table -> display(); } else { - echo '

'.get_lang('NoStudent').'

'; + echo Display::display_warning_message(get_lang('NoStudent')); } // send the csv file if asked @@ -324,10 +324,5 @@ if ($isCoach || api_is_platform_admin() || api_is_drh()) { } } -/* -============================================================================== - FOOTER -============================================================================== -*/ - -Display :: display_footer(); +/* FOOTER */ +Display :: display_footer(); \ No newline at end of file diff --git a/main/mySpace/teachers.php b/main/mySpace/teachers.php index 93b33dba87..3e2cc5cb5a 100755 --- a/main/mySpace/teachers.php +++ b/main/mySpace/teachers.php @@ -9,6 +9,8 @@ $cidReset = true; require_once '../inc/global.inc.php'; require_once 'myspace.lib.php'; +require_once api_get_path(LIBRARY_PATH).'usermanager.lib.php'; +require_once api_get_path(LIBRARY_PATH).'tracking.lib.php'; $this_section = SECTION_TRACKING; @@ -23,28 +25,28 @@ if (api_is_drh() || api_is_platform_admin()) { // followed teachers by drh $formateurs = UserManager::get_users_followed_by_drh($_user['user_id'], COURSEMANAGER); - - $menu_items[] = ''.get_lang('Students').''; - $menu_items[] = get_lang('Trainers'); - $menu_items[] = ''.get_lang('Courses').''; - $menu_items[] = ''.get_lang('Sessions').''; + $menu_items[] = Display::url(Display::return_icon('stats.png', get_lang('MyStats'),'',32),api_get_path(WEB_CODE_PATH)."auth/my_progress.php" ); + $menu_items[] = Display::url(Display::return_icon('user.png', get_lang('Students'), array(), 32), "index.php?view=drh_students&display=yourstudents"); + $menu_items[] = Display::return_icon('teacher_na.png', get_lang('Trainers'), array(), 32); + $menu_items[] = Display::url(Display::return_icon('course.png', get_lang('Courses'), array(), 32), 'course.php'); + $menu_items[] = Display::url(Display::return_icon('session.png', get_lang('Sessions'), array(), 32), 'session.php'); + - echo '
'; + echo '
'; $nb_menu_items = count($menu_items); if ($nb_menu_items > 1) { foreach ($menu_items as $key => $item) { - echo $item; - if ($key != $nb_menu_items - 1) { - echo ' | '; - } + echo $item; } } if (count($formateurs) > 0) { - echo '   '.get_lang('Print').' '; - echo ' '.get_lang('ExportAsCSV').''; + echo ''; + echo Display::url(Display::return_icon('printer.png', get_lang('Print'), array(), 32), 'javascript: void(0);', array('onclick'=>'javascript: window.print();')); + echo Display::url(Display::return_icon('export_csv.png', get_lang('ExportAsCSV'), array(), 32), api_get_self().'?export=xls'); + echo ''; } echo '
'; - echo '

'.get_lang('YourTeachers').'

'; + echo '

'.get_lang('YourTeachers').'

'; echo '
'; } diff --git a/main/tracking/courseLog.php b/main/tracking/courseLog.php index 6bf83bd4a2..9f57451c11 100755 --- a/main/tracking/courseLog.php +++ b/main/tracking/courseLog.php @@ -29,7 +29,7 @@ if ($from == 'myspace') { } // Access restrictions. -$is_allowedToTrack = $is_courseAdmin || api_is_platform_admin() || $is_courseCoach || api_is_session_admin() || api_is_drh() || api_is_course_tutor() || api_is_coach(); +$is_allowedToTrack = api_is_platform_admin() || api_is_allowed_to_create_course() || api_is_session_admin() || api_is_drh() || api_is_course_tutor(); if (!$is_allowedToTrack) { Display :: display_header(null); @@ -45,7 +45,6 @@ require_once api_get_path(SYS_CODE_PATH).'newscorm/learnpathItem.class.php'; require_once api_get_path(SYS_CODE_PATH).'newscorm/learnpathList.class.php'; require_once api_get_path(SYS_CODE_PATH).'newscorm/scorm.class.php'; require_once api_get_path(SYS_CODE_PATH).'newscorm/scormItem.class.php'; -require_once api_get_path(LIBRARY_PATH).'tracking.lib.php'; require_once api_get_path(LIBRARY_PATH).'export.lib.inc.php'; require_once api_get_path(LIBRARY_PATH).'formvalidator/FormValidator.class.php'; require_once api_get_path(LIBRARY_PATH).'statsUtils.lib.inc.php'; @@ -104,12 +103,12 @@ $nameTools = get_lang('Tracking'); Display::display_header($nameTools, 'Tracking'); // getting all the students of the course -if (!empty($_SESSION['id_session'])) { - // Registered students in session. - $a_students = CourseManager :: get_student_list_from_course_code(api_get_course_id(), true, api_get_session_id()); +if (empty($session_id)) { + // Registered students in a course outside session. + $a_students = CourseManager :: get_student_list_from_course_code(api_get_course_id()); } else { - // Registered students in a course outside session. - $a_students = CourseManager :: get_student_list_from_course_code(api_get_course_id()); + // Registered students in session. + $a_students = CourseManager :: get_student_list_from_course_code(api_get_course_id(), true, api_get_session_id()); } $nbStudents = count($a_students); @@ -467,11 +466,11 @@ if ($_GET['studentlist'] == 'false') { $course_info = api_get_course_info(api_get_course_id()); $course_name = get_lang('Course').' '.$course_info['name']; - if (api_get_session_id()) { - echo '

'.Display::return_icon('session.png', get_lang('Session'), array(), 22).' '.api_get_session_name(api_get_session_id()).' '. + if ($session_id) { + echo '

'.Display::return_icon('session.png', get_lang('Session'), array(), 22).' '.api_get_session_name($session_id).' '. Display::return_icon('course.png', get_lang('Course'), array(), 22).' '.$course_name.'

'; } else { - echo '

'.Display::return_icon('course.png', get_lang('Course'), array(), 22).' '.$course_info['name'].'

'; + echo '

'.Display::return_icon('course.png', get_lang('Course'), array(), 22).' '.$course_info['name'].'

'; } $extra_field_select = TrackingCourseLog::display_additional_profile_fields(); diff --git a/main/tracking/course_session_report.php b/main/tracking/course_session_report.php index f0d74785f4..ba7d0fe24e 100644 --- a/main/tracking/course_session_report.php +++ b/main/tracking/course_session_report.php @@ -9,16 +9,12 @@ $language_file = array ('registration', 'index', 'tracking', 'exercice','survey'); $cidReset = true; require_once '../inc/global.inc.php'; -require_once api_get_path(LIBRARY_PATH).'course.lib.php'; -require_once (api_get_path(LIBRARY_PATH).'tracking.lib.php'); -require_once api_get_path(LIBRARY_PATH).'sessionmanager.lib.php'; require_once api_get_path(LIBRARY_PATH).'formvalidator/FormValidator.class.php'; require_once api_get_path(LIBRARY_PATH).'pear/Spreadsheet_Excel_Writer/Writer.php'; require_once api_get_path(SYS_CODE_PATH).'exercice/exercise.class.php'; require_once api_get_path(SYS_CODE_PATH).'exercice/question.class.php'; -require_once api_get_path(LIBRARY_PATH).'events.lib.inc.php'; require_once api_get_path(SYS_CODE_PATH).'newscorm/learnpathList.class.php'; require_once api_get_path(SYS_CODE_PATH).'newscorm/learnpath.class.php'; require_once api_get_path(SYS_CODE_PATH).'newscorm/learnpathList.class.php'; @@ -85,19 +81,17 @@ if (!$export_to_xls) { echo '
'; if ($global) { - $menu_items[] = ''.get_lang('TeacherInterface').''; - $menu_items[] = get_lang('AdminInterface'); - $menu_items[] = ''.get_lang('ExamTracking').''; - - + + + $menu_items[] = Display::url(Display::return_icon('stats.png', get_lang('MyStats'),'',32),api_get_path(WEB_CODE_PATH)."auth/my_progress.php" ); + $menu_items[] = Display::url(Display::return_icon('teacher.png', get_lang('TeacherInterface'), array(), 32), api_get_path(WEB_CODE_PATH).'mySpace/?view=teacher'); + $menu_items[] = Display::return_icon('star_na.png', get_lang('AdminInterface'), array(), 32); + $menu_items[] = Display::url(Display::return_icon('quiz.png', get_lang('ExamTracking'), array(), 32), api_get_path(WEB_CODE_PATH).'tracking/exams.php'); $nb_menu_items = count($menu_items); if($nb_menu_items>1) { foreach($menu_items as $key=> $item) { echo $item; - if($key!=$nb_menu_items-1) { - echo ' | '; - } } echo '
'; } @@ -110,7 +104,6 @@ if (!$export_to_xls) { } echo '
'; - echo '

'.get_lang('CoachList').'

'; if (api_is_platform_admin()) { echo ''.get_lang('DisplayCoaches').' | '; echo ''.get_lang('DisplayUserOverview').''; diff --git a/main/tracking/exams.php b/main/tracking/exams.php index 72069a0833..46d86cfa2c 100644 --- a/main/tracking/exams.php +++ b/main/tracking/exams.php @@ -87,28 +87,25 @@ if (!$export_to_xls) { echo ''; echo ''; - echo ' - '.Display::return_icon('export_excel.png',get_lang('ExportAsXLS'),'','32').''; + echo ''.Display::return_icon('export_excel.png',get_lang('ExportAsXLS'),'','32').''; + echo ''.Display::return_icon('printer.png',get_lang('Print'),'','32').''; echo ''; - echo ' - '.Display::return_icon('printer.png',get_lang('Print'),'','32').''; + + - $menu_items[] = ''.get_lang('TeacherInterface').''; + $menu_items[] = Display::url(Display::return_icon('teacher.png', get_lang('TeacherInterface'), array(), 32), api_get_path(WEB_CODE_PATH).'mySpace/?view=teacher'); if (api_is_platform_admin()) { - $menu_items[] = ''.get_lang('AdminInterface').''; + $menu_items[] = Display::url(Display::return_icon('star.png', get_lang('AdminInterface'), array(), 32), api_get_path(WEB_CODE_PATH).'mySpace/?view=admin'); } else { - $menu_items[] = ''.get_lang('AdminInterface').''; + $menu_items[] = Display::url(Display::return_icon('star.png', get_lang('CoachInterface'), array(), 32), api_get_path(WEB_CODE_PATH).'mySpace/?view=coach'); } - $menu_items[] = get_lang('ExamTracking'); - + $menu_items[] = Display::return_icon('quiz_na.png', get_lang('ExamTracking'), array(), 32); + $nb_menu_items = count($menu_items); if($nb_menu_items>1) { foreach($menu_items as $key=> $item) { - echo $item; - if($key!=$nb_menu_items-1) { - echo ' | '; - } + echo $item; } } } else { diff --git a/main/tracking/question_course_report.php b/main/tracking/question_course_report.php index afd0df1983..6568b2e0cc 100644 --- a/main/tracking/question_course_report.php +++ b/main/tracking/question_course_report.php @@ -9,8 +9,6 @@ $language_file = array ('registration', 'index', 'tracking', 'exercice','survey'); $cidReset = true; require_once '../inc/global.inc.php'; -require_once api_get_path(LIBRARY_PATH).'tracking.lib.php'; -require_once api_get_path(LIBRARY_PATH).'sessionmanager.lib.php'; require_once api_get_path(SYS_CODE_PATH).'exercice/exercise.class.php'; require_once api_get_path(SYS_CODE_PATH).'exercice/question.class.php'; @@ -152,21 +150,19 @@ if (!empty($course_info)) { if (!$export_to_xls) { Display :: display_header(get_lang("MySpace")); - echo '
'; - if ($global) { - $menu_items[] = ''.get_lang('TeacherInterface').''; - $menu_items[] = get_lang('AdminInterface'); - $menu_items[] = ''.get_lang('ExamTracking').''; - + echo '
'; + if ($global) { + + $menu_items[] = Display::url(Display::return_icon('stats.png', get_lang('MyStats'),'',32),api_get_path(WEB_CODE_PATH)."auth/my_progress.php" ); + $menu_items[] = Display::url(Display::return_icon('teacher.png', get_lang('TeacherInterface'), array(), 32), api_get_path(WEB_CODE_PATH).'mySpace/?view=teacher'); + $menu_items[] = Display::return_icon('star_na.png', get_lang('AdminInterface'), array(), 32); + $menu_items[] = Display::url(Display::return_icon('quiz.png', get_lang('ExamTracking'), array(), 32), api_get_path(WEB_CODE_PATH).'tracking/exams.php'); + $nb_menu_items = count($menu_items); if($nb_menu_items>1) { foreach($menu_items as $key=> $item) { - echo $item; - if($key!=$nb_menu_items-1) { - echo ' | '; - } - } - echo '
'; + echo $item; + } } } else { echo '
@@ -176,7 +172,6 @@ if (!$export_to_xls) { echo '
'; } echo '
'; - echo '

'.get_lang('CoachList').'

'; if (api_is_platform_admin()) { echo ''.get_lang('DisplayCoaches').' | ';