|
|
|
|
@ -205,21 +205,17 @@ if (empty($session_id) || in_array($display, array('accessoverview','lpprogresso |
|
|
|
|
|
|
|
|
|
echo '</div>'; |
|
|
|
|
|
|
|
|
|
if (empty($session_id)) { |
|
|
|
|
|
|
|
|
|
// Getting courses followed by a coach (No session courses). |
|
|
|
|
$courses = CourseManager::get_course_list_as_coach($user_id, false); |
|
|
|
|
// Getting courses followed by a coach (No session courses). |
|
|
|
|
$courses = CourseManager::get_course_list_as_coach($user_id, false); |
|
|
|
|
|
|
|
|
|
// Courses with no session: |
|
|
|
|
if (isset($courses[0])) { |
|
|
|
|
// Courses with no session: |
|
|
|
|
if (isset($courses[0])) { |
|
|
|
|
$courses = $courses[0]; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// Getting students from courses and courses in sessions (To show the total students that the user follows) |
|
|
|
|
$students = CourseManager::get_user_list_from_courses_as_coach($user_id); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// If is drh |
|
|
|
|
if ($is_drh) { |
|
|
|
|
// If is drh |
|
|
|
|
if ($is_drh) { |
|
|
|
|
if (api_drh_can_access_all_session_content()) { |
|
|
|
|
$studentList = SessionManager::getAllUsersFromCoursesFromAllSessionFromStatus('drh_all', api_get_user_id()); |
|
|
|
|
|
|
|
|
|
@ -242,89 +238,59 @@ if (empty($session_id)) { |
|
|
|
|
} |
|
|
|
|
$sessions = SessionManager::get_sessions_followed_by_drh($user_id); |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
} else { |
|
|
|
|
// Getting students from courses and courses in sessions (To 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); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// Courses for the user |
|
|
|
|
$count_courses = count($courses); |
|
|
|
|
|
|
|
|
|
// Sessions for the user |
|
|
|
|
$count_sessions = count($sessions); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// Students |
|
|
|
|
$nb_students = count($students); |
|
|
|
|
// Courses for the user |
|
|
|
|
$count_courses = count($courses); |
|
|
|
|
|
|
|
|
|
$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; |
|
|
|
|
// Sessions for the user |
|
|
|
|
$count_sessions = count($sessions); |
|
|
|
|
|
|
|
|
|
if (!empty($students)) { |
|
|
|
|
foreach ($students as $student_id) { |
|
|
|
|
// inactive students |
|
|
|
|
$last_connection_date = Tracking::get_last_connection_date($student_id, true, true); |
|
|
|
|
// Students |
|
|
|
|
$nb_students = count($students); |
|
|
|
|
|
|
|
|
|
if ($last_connection_date !== false) { |
|
|
|
|
if (time() - (3600 * 24 * 7) > $last_connection_date) { |
|
|
|
|
$nb_inactive_students++; |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
$nb_inactive_students++; |
|
|
|
|
} |
|
|
|
|
$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; |
|
|
|
|
|
|
|
|
|
$total_time_spent += Tracking::get_time_spent_on_the_platform($student_id); |
|
|
|
|
$total_courses += Tracking::count_course_per_student($student_id); |
|
|
|
|
$avg_student_progress = 0; |
|
|
|
|
$avg_student_score = 0; |
|
|
|
|
$nb_courses_student = 0; |
|
|
|
|
$inactiveTime = time() - (3600 * 24 * 7); |
|
|
|
|
|
|
|
|
|
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); |
|
|
|
|
$avg_student_progress += Tracking :: get_avg_student_progress($student_id, $course_code); |
|
|
|
|
$myavg_temp = Tracking :: get_avg_student_score($student_id, $course_code); |
|
|
|
|
$daysAgo = 7; |
|
|
|
|
if (!empty($students)) { |
|
|
|
|
|
|
|
|
|
if (is_numeric($myavg_temp)) { |
|
|
|
|
$avg_student_score += $myavg_temp; |
|
|
|
|
} |
|
|
|
|
$studentIds = array_values($students); |
|
|
|
|
$nb_students = count($studentIds); |
|
|
|
|
|
|
|
|
|
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 |
|
|
|
|
$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; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
// Inactive students |
|
|
|
|
$inactiveUsers = Tracking::getInactiveUsers($studentIds, $daysAgo); |
|
|
|
|
$totalTimeSpent = Tracking::get_time_spent_on_the_platform($studentIds); |
|
|
|
|
|
|
|
|
|
if ($nb_students > 0 && $view != 'admin') { |
|
|
|
|
$posts = Tracking::count_student_messages($studentIds); |
|
|
|
|
$countAssignments = Tracking::count_student_assignments($studentIds); |
|
|
|
|
$progress = Tracking::get_avg_student_progress($studentIds); |
|
|
|
|
$averageScore = Tracking::getAverageStudentScore($studentIds); |
|
|
|
|
|
|
|
|
|
// average progress |
|
|
|
|
$avg_total_progress = $avg_total_progress / $nb_students; |
|
|
|
|
$avg_total_progress = $progress / $nb_students; |
|
|
|
|
// average results to the tests |
|
|
|
|
$avg_results_to_exercises = $avg_results_to_exercises / $nb_students; |
|
|
|
|
// average courses by student |
|
|
|
|
$avg_courses_per_student = round($count_courses / $nb_students, 2); |
|
|
|
|
// average time spent on the platform |
|
|
|
|
$avg_time_spent = $total_time_spent / $nb_students; |
|
|
|
|
$avg_results_to_exercises = $averageScore; |
|
|
|
|
// average assignments |
|
|
|
|
$nb_assignments = $nb_assignments / $nb_students; |
|
|
|
|
$nb_assignments = $countAssignments / $nb_students; |
|
|
|
|
// average posts |
|
|
|
|
$nb_posts = $nb_posts / $nb_students; |
|
|
|
|
$nb_posts = $posts ; |
|
|
|
|
|
|
|
|
|
$avg_time_spent = $totalTimeSpent; |
|
|
|
|
|
|
|
|
|
$avg_courses_per_student = $count_courses / $nb_students; |
|
|
|
|
|
|
|
|
|
echo Display::page_subheader(get_lang('Overview')); |
|
|
|
|
|
|
|
|
|
@ -350,7 +316,7 @@ if (empty($session_id)) { |
|
|
|
|
if ($export_csv) { |
|
|
|
|
//csv part |
|
|
|
|
$csv_content[] = array(get_lang('Students', '')); |
|
|
|
|
$csv_content[] = array(get_lang('InactivesStudents', ''), $nb_inactive_students ); |
|
|
|
|
$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).'%'); |
|
|
|
|
@ -359,13 +325,11 @@ if (empty($session_id)) { |
|
|
|
|
$csv_content[] = array(get_lang('AverageAssignments', ''), $nb_assignments); |
|
|
|
|
$csv_content[] = array(); |
|
|
|
|
} else { |
|
|
|
|
|
|
|
|
|
$lastConnectionDate = api_get_utc_datetime(strtotime('15 days ago')); |
|
|
|
|
|
|
|
|
|
$countActiveUsers = SessionManager::getCountUserTracking(null, 1); |
|
|
|
|
$countInactiveUsers = SessionManager::getCountUserTracking(null, 0); |
|
|
|
|
$countSleepingTeachers = SessionManager::getTeacherTracking(api_get_user_id(), 1, $lastConnectionDate, true); |
|
|
|
|
$countSleepingStudents =SessionManager::getCountUserTracking(null, 1, $lastConnectionDate); |
|
|
|
|
$countSleepingStudents = SessionManager::getCountUserTracking(null, 1, $lastConnectionDate); |
|
|
|
|
|
|
|
|
|
$form = new FormValidator('search_user', 'get', api_get_path(WEB_CODE_PATH).'mySpace/student.php'); |
|
|
|
|
$form->addElement('text', 'keyword', get_lang('User')); |
|
|
|
|
@ -379,12 +343,10 @@ if (empty($session_id)) { |
|
|
|
|
<td>'.Display::url(get_lang('ActiveUsers'), api_get_path(WEB_CODE_PATH).'mySpace/student.php?active=1').'</td> |
|
|
|
|
<td align="right">'.$countActiveUsers.'</td> |
|
|
|
|
</tr> |
|
|
|
|
|
|
|
|
|
<tr> |
|
|
|
|
<td>'.Display::url(get_lang('InactiveUsers'), api_get_path(WEB_CODE_PATH).'mySpace/student.php?active=0').'</td> |
|
|
|
|
<td align="right">'.$countInactiveUsers.'</td> |
|
|
|
|
</tr> |
|
|
|
|
|
|
|
|
|
<tr> |
|
|
|
|
<td>'.Display::url(get_lang('SleepingTeachers'), api_get_path(WEB_CODE_PATH).'mySpace/teachers.php?sleeping_days=15').'</td> |
|
|
|
|
<td align="right">'.$countSleepingTeachers.'</td> |
|
|
|
|
@ -427,670 +389,8 @@ if (empty($session_id)) { |
|
|
|
|
</a> |
|
|
|
|
</div><br />'; |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
$avg_total_progress = null; |
|
|
|
|
$avg_results_to_exercises = null; |
|
|
|
|
$avg_courses_per_student = null; |
|
|
|
|
$avg_time_spent = null; |
|
|
|
|
$nb_assignments = null; |
|
|
|
|
$nb_posts = null; |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
// If is drh |
|
|
|
|
if ($is_drh) { |
|
|
|
|
$courses_of_the_platform = CourseManager::get_courses_followed_by_drh($user_id); |
|
|
|
|
$courses_from_session = SessionManager::get_course_list_by_session_id($session_id); |
|
|
|
|
|
|
|
|
|
$courses = array(); |
|
|
|
|
foreach ($courses_from_session as $course_item) { |
|
|
|
|
if (api_drh_can_access_all_session_content()) { |
|
|
|
|
$courses[$course_item['code']] = $course_item['code']; |
|
|
|
|
} else { |
|
|
|
|
if (isset($courses_of_the_platform[$course_item['code']])) { |
|
|
|
|
$courses[$course_item['code']] = $course_item['code']; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (empty($courses)) { |
|
|
|
|
Display::display_warning_message(get_lang('NoResults')); |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
$courses = Tracking::get_courses_followed_by_coach($user_id, $session_id); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// Courses for the user |
|
|
|
|
$count_courses = count($courses); |
|
|
|
|
|
|
|
|
|
// Sessions for the user |
|
|
|
|
$count_sessions = count($sessions); |
|
|
|
|
} |
|
|
|
|
/* |
|
|
|
|
if ($count_courses || $count_sessions) { |
|
|
|
|
//If we are in course |
|
|
|
|
if (empty($session_id)) { |
|
|
|
|
if ($count_courses) { |
|
|
|
|
$title = Display::return_icon('course.gif').' '.get_lang('Courses').' ('.$count_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(), ICON_SIZE_SMALL).' '.$session_name; |
|
|
|
|
$menu_items[] = '<a href="'.api_get_self().'?view=teacher">'.get_lang('TeacherInterface').'</a>'; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if ((api_is_allowed_to_create_course() || api_is_drh()) && in_array($view, array('teacher', 'drh'))) { |
|
|
|
|
|
|
|
|
|
// Courses |
|
|
|
|
if ($count_courses) { |
|
|
|
|
|
|
|
|
|
echo Display::page_subheader($title); |
|
|
|
|
|
|
|
|
|
$table = new SortableTable('courses_my_space', 'get_number_of_courses', array('MySpace','get_course_data')); |
|
|
|
|
$parameters['view'] = 'teacher'; |
|
|
|
|
$parameters['class'] = 'data_table'; |
|
|
|
|
$table->set_additional_parameters($parameters); |
|
|
|
|
$table->set_header(0, get_lang('CourseTitle'), false); |
|
|
|
|
$table->set_header(1, get_lang('NbStudents'), false); |
|
|
|
|
$table->set_header(2, get_lang('AvgTimeSpentInTheCourse').' '.Display :: return_icon('info3.gif', get_lang('TimeOfActiveByTraining'), array('align' => 'absmiddle', 'hspace' => '3px')), false); |
|
|
|
|
$table->set_header(3, get_lang('AvgStudentsProgress').' '.Display :: return_icon('info3.gif', get_lang('AvgAllUsersInAllCourses'), array('align' => 'absmiddle', 'hspace' => '3px')), false); |
|
|
|
|
$table->set_header(4, get_lang('AvgCourseScore').' '.Display :: return_icon('info3.gif', get_lang('AvgAllUsersInAllCourses'), array('align' => 'absmiddle', 'hspace' => '3px')), false); |
|
|
|
|
$table->set_header(5, get_lang('AvgExercisesScore').' '.Display :: return_icon('info3.gif', get_lang('AvgAllUsersInAllCourses'), array('align' => 'absmiddle', 'hspace' => '3px')), false); |
|
|
|
|
$table->set_header(6, get_lang('AvgMessages'), false); |
|
|
|
|
$table->set_header(7, get_lang('AverageAssignments'), false); |
|
|
|
|
$table->set_header(8, get_lang('Details'), false); |
|
|
|
|
|
|
|
|
|
$csv_content[] = array ( |
|
|
|
|
get_lang('CourseTitle', ''), |
|
|
|
|
get_lang('NbStudents', ''), |
|
|
|
|
get_lang('AvgTimeSpentInTheCourse', ''), |
|
|
|
|
get_lang('AvgStudentsProgress', ''), |
|
|
|
|
get_lang('AvgCourseScore', ''), |
|
|
|
|
get_lang('AvgExercisesScore', ''), |
|
|
|
|
get_lang('AvgMessages', ''), |
|
|
|
|
get_lang('AverageAssignments', '') |
|
|
|
|
); |
|
|
|
|
$table->display(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// Display list of sessions |
|
|
|
|
|
|
|
|
|
if ($count_sessions > 0 && !isset($_GET['session_id'])) { |
|
|
|
|
echo Display::page_subheader(Display::return_icon('session.png').' '.get_lang('Sessions').' ('.$count_sessions.')'); |
|
|
|
|
|
|
|
|
|
$url = api_get_path(WEB_AJAX_PATH).'model.ajax.php?a=get_sessions_tracking'; |
|
|
|
|
|
|
|
|
|
//The order is important you need to check the the $column variable in the model.ajax.php file |
|
|
|
|
$columns = array( |
|
|
|
|
get_lang('Title'), |
|
|
|
|
get_lang('Date'), |
|
|
|
|
get_lang('NbCoursesPerSession'), |
|
|
|
|
get_lang('NbStudentPerSession'), |
|
|
|
|
get_lang('Details') |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
// Column config |
|
|
|
|
$columnModel = array( |
|
|
|
|
array('name'=>'name', 'index'=>'name', 'width'=>'255', 'align'=>'left'), |
|
|
|
|
array('name'=>'date', 'index'=>'date', 'width'=>'150', 'align'=>'left','sortable'=>'false'), |
|
|
|
|
array('name'=>'course_per_session', 'index'=>'course_per_session', 'width'=>'150','sortable'=>'false'), |
|
|
|
|
array('name'=>'student_per_session', 'index'=>'student_per_session', 'width'=>'100','sortable'=>'false'), |
|
|
|
|
array('name'=>'details', 'index'=>'details', 'width'=>'100','sortable'=>'false'), |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
$extraParams = array( |
|
|
|
|
'autowidth' => 'true', |
|
|
|
|
'height' => 'auto' |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
$js = '<script> |
|
|
|
|
$(function() { |
|
|
|
|
'.Display::grid_js('session_tracking', $url, $columns, $columnModel, $extraParams, array(), null, true).' |
|
|
|
|
}); |
|
|
|
|
</script>'; |
|
|
|
|
|
|
|
|
|
$nb_sessions_past = $nb_sessions_current = 0; |
|
|
|
|
$courses = array(); |
|
|
|
|
|
|
|
|
|
foreach ($sessions as $session) { |
|
|
|
|
$visibility = api_get_session_visibility($session['id']); |
|
|
|
|
if ($visibility == SESSION_AVAILABLE) { |
|
|
|
|
$nb_sessions_current ++; |
|
|
|
|
} else { |
|
|
|
|
$nb_sessions_past++; |
|
|
|
|
} |
|
|
|
|
$courses = array_merge($courses, Tracking::get_courses_list_from_session($session['id'])); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$nb_courses_per_session = null; |
|
|
|
|
$nb_students_per_session = null; |
|
|
|
|
|
|
|
|
|
if ($count_sessions > 0) { |
|
|
|
|
$nb_courses_per_session = round(count($courses) / $count_sessions, 2); |
|
|
|
|
$nb_students_per_session = round($nb_students / $count_sessions, 2); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
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('NbInactiveSessions', '').';'.$nb_sessions_past); |
|
|
|
|
$csv_content[] = array(get_lang('NbCoursesPerSession', '').';'.$nb_courses_per_session); |
|
|
|
|
$csv_content[] = array(get_lang('NbStudentPerSession', '').';'.$nb_students_per_session); |
|
|
|
|
$csv_content[] = array(); |
|
|
|
|
} else { |
|
|
|
|
echo ' |
|
|
|
|
<div class="report_section"> |
|
|
|
|
<table class="table table-bordered"> |
|
|
|
|
<tr> |
|
|
|
|
<td>'.get_lang('NbActiveSessions').'</td> |
|
|
|
|
<td align="right">'.$nb_sessions_current.'</td> |
|
|
|
|
</tr> |
|
|
|
|
<tr> |
|
|
|
|
<td>'.get_lang('NbInactiveSessions').'</td> |
|
|
|
|
<td align="right">'.$nb_sessions_past.'</td> |
|
|
|
|
</tr> |
|
|
|
|
</table> |
|
|
|
|
</div>'; |
|
|
|
|
} |
|
|
|
|
echo $js; |
|
|
|
|
echo Display::grid_html('session_tracking'); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if ($is_platform_admin && in_array($view, array('admin')) && $display != 'yourstudents') { |
|
|
|
|
|
|
|
|
|
echo '<a href="'.api_get_self().'?view=admin&display=coaches">'.get_lang('DisplayCoaches').'</a> | '; |
|
|
|
|
echo '<a href="'.api_get_self().'?view=admin&display=useroverview">'.get_lang('DisplayUserOverview').'</a>'; |
|
|
|
|
if ($display == 'useroverview') { |
|
|
|
|
echo ' ( <a href="'.api_get_self().'?view=admin&display=useroverview&export=options">'.get_lang('ExportUserOverviewOptions').'</a> )'; |
|
|
|
|
} |
|
|
|
|
echo ' | <a href="'.api_get_self().'?view=admin&display=sessionoverview">'.get_lang('DisplaySessionOverview').'</a>'; |
|
|
|
|
echo ' | <a href="'.api_get_self().'?view=admin&display=accessoverview">'.get_lang('DisplayAccessOverview').'</a>'; |
|
|
|
|
echo ' | <a href="'.api_get_self().'?view=admin&display=surveyoverview">'.get_lang('DisplaySurveyOverview').'</a>'; |
|
|
|
|
echo ' | <a href="'.api_get_self().'?view=admin&display=lpprogressoverview">'.get_lang('DisplayLpProgressOverview').'</a>'; |
|
|
|
|
echo ' | <a href="'.api_get_self().'?view=admin&display=progressoverview">'.get_lang('DisplayProgressOverview').'</a>'; |
|
|
|
|
echo ' | <a href="'.api_get_self().'?view=admin&display=exerciseprogress">'.get_lang('DisplayExerciseProgress').'</a>'; |
|
|
|
|
echo ' | <a href="'.api_get_self().'?view=admin&display=courseoverview">'.get_lang('DisplayCourseOverview').'</a>'; |
|
|
|
|
echo ' | <a href="'.api_get_path(WEB_CODE_PATH).'tracking/question_course_report.php?view=admin">'.get_lang('LPQuestionListResults').'</a>'; |
|
|
|
|
echo ' | <a href="'.api_get_path(WEB_CODE_PATH).'tracking/course_session_report.php?view=admin">'.get_lang('LPExerciseResultsBySession').'</a>'; |
|
|
|
|
echo '<br /><br />'; |
|
|
|
|
|
|
|
|
|
if ($is_platform_admin && $view == 'admin' && in_array($display, array('accessoverview','lpprogressoverview', 'progressoverview', 'exerciseprogress', 'surveyoverview'))) { |
|
|
|
|
//Session Filter |
|
|
|
|
$sessionFilter = new FormValidator('session_filter', 'get', '', '', array('class'=> 'form-horizontal'), false); |
|
|
|
|
$url = api_get_path(WEB_AJAX_PATH).'session.ajax.php?a=search_session'; |
|
|
|
|
$sessionList = array(); |
|
|
|
|
$sessionId = isset($_GET['session_id']) ? $_GET['session_id'] : null; |
|
|
|
|
if (!empty($sessionId)) { |
|
|
|
|
$sessionList = array(); |
|
|
|
|
$sessionInfo = SessionManager::fetch($sessionId); |
|
|
|
|
$sessionList[] = array('id' => $sessionInfo['id'], 'text' => $sessionInfo['name']); |
|
|
|
|
} |
|
|
|
|
$sessionFilter->addElement('select_ajax', 'session_name', get_lang('SearchSession'), null, array('url' => $url, 'defaults' => $sessionList)); |
|
|
|
|
$courseListUrl = api_get_self(); |
|
|
|
|
|
|
|
|
|
echo '<div class="">'; |
|
|
|
|
echo $sessionFilter->return_form(); |
|
|
|
|
echo '</div>'; |
|
|
|
|
echo '<script> |
|
|
|
|
$(function() { |
|
|
|
|
$("#session_name").on("change", function() { |
|
|
|
|
var sessionId = $(this).val(); |
|
|
|
|
window.location = "'.$courseListUrl.'?view=admin&display='.$display.'&session_id="+sessionId; |
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
|
</script>'; |
|
|
|
|
// Course filter. |
|
|
|
|
if (in_array($display, array('accessoverview','lpprogressoverview', 'progressoverview', 'exerciseprogress', 'surveyoverview'))) { |
|
|
|
|
$courseFilter = new FormValidator('course_filter', 'get', '', '', array('class'=> 'form-horizontal'), false); |
|
|
|
|
$a = 'search_course_by_session'; |
|
|
|
|
if ( $display == 'exerciseprogress') { |
|
|
|
|
$a = 'search_course'; |
|
|
|
|
} |
|
|
|
|
$url = api_get_path(WEB_AJAX_PATH).'course.ajax.php?a='. $a .'&session_id=' . $_GET['session_id']; |
|
|
|
|
$courseList = array(); |
|
|
|
|
$courseId = isset($_GET['course_id']) ? $_GET['course_id'] : null; |
|
|
|
|
if (!empty($courseId)) { |
|
|
|
|
$courseList = array(); |
|
|
|
|
$courseInfo = api_get_course_info_by_id($courseId); |
|
|
|
|
$courseList[] = array('id' => $courseInfo['real_id'], 'text' => $courseInfo['name']); |
|
|
|
|
} |
|
|
|
|
$courseFilter->addElement('select_ajax', 'course_name', get_lang('SearchCourse'), null, array('url' => $url, 'defaults' => $courseList)); |
|
|
|
|
$courseListUrl = api_get_self(); |
|
|
|
|
|
|
|
|
|
echo '<div class="">'; |
|
|
|
|
echo $courseFilter->return_form(); |
|
|
|
|
echo '</div>'; |
|
|
|
|
echo '<script> |
|
|
|
|
$(function() { |
|
|
|
|
$("#course_name").on("change", function() { |
|
|
|
|
var sessionId = $("#session_name").val(); |
|
|
|
|
var courseId = $("#course_name").val(); |
|
|
|
|
window.location = "'.$courseListUrl.'?view=admin&display='.$display.'&session_id="+sessionId+"&course_id="+courseId; |
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
|
</script>'; |
|
|
|
|
} |
|
|
|
|
//Student Filter |
|
|
|
|
if (in_array($display, array('accessoverview'))) { |
|
|
|
|
$courseListUrl = api_get_self(); |
|
|
|
|
$studentFilter = new FormValidator('student_filter', 'get', '', '', array('class'=> 'form-horizontal'), false); |
|
|
|
|
$url = api_get_path(WEB_AJAX_PATH).'course.ajax.php?a=search_user_by_course&session_id=' . $_GET['session_id'] . '&course_id=' . $_GET['course_id']; |
|
|
|
|
$studentList = array(); |
|
|
|
|
$studentId = isset($_GET['student_id']) ? $_GET['student_id'] : null; |
|
|
|
|
if (!empty($studentId)) { |
|
|
|
|
$studentList = array(); |
|
|
|
|
$studentInfo = UserManager::get_user_info_by_id($studentId); |
|
|
|
|
$studentList[] = array('id' => $studentInfo['id'], 'text' => $studentInfo['username']); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$studentFilter->addElement('text', 'from', get_lang('From'), array('id' => 'date_from'), array('defaults' => $_GET['date_from'])); |
|
|
|
|
$studentFilter->addElement('text', 'to', get_lang('Until'), array('id' => 'date_to'), $_GET['date_to']); |
|
|
|
|
|
|
|
|
|
$studentFilter->addElement('select_ajax', 'student_name', get_lang('SearchStudent'), null, array('url' => $url, 'defaults' => $studentList), array('class' => 'pull-left')); |
|
|
|
|
$options = array( |
|
|
|
|
'' => get_lang('Select'), |
|
|
|
|
STUDENT => get_lang('Student'), |
|
|
|
|
COURSEMANAGER => get_lang('CourseManager'), |
|
|
|
|
DRH => get_lang('Drh'), |
|
|
|
|
); |
|
|
|
|
$studentFilter->addElement('select', 'profile', get_lang('Profile'),$options, array('id' => 'profile')); |
|
|
|
|
|
|
|
|
|
echo '<div class="">'; |
|
|
|
|
echo $studentFilter->return_form(); |
|
|
|
|
echo '</div>'; |
|
|
|
|
|
|
|
|
|
//TODO fix this hack |
|
|
|
|
$date_to = (!empty($_GET['date_to'])) ? ' $(\'#date_to\').val(\'' . $_GET['date_to'] . '\'); ' : ''; |
|
|
|
|
$date_from = (!empty($_GET['date_from'])) ? ' $(\'#date_from\').val(\'' . $_GET['date_from'] . '\'); ' : ''; |
|
|
|
|
echo '<script> |
|
|
|
|
$(function() { |
|
|
|
|
' . $date_to . ' |
|
|
|
|
' . $date_from . ' |
|
|
|
|
$("#student_name").on("change", function() { |
|
|
|
|
var date_to = $(\'#date_to\').val(); |
|
|
|
|
var date_from = $(\'#date_from\').val(); |
|
|
|
|
var sessionId = $("#session_name").val(); |
|
|
|
|
var courseId = $("#course_name").val(); |
|
|
|
|
var studentId = $("#student_name").val(); |
|
|
|
|
window.location = "'.$courseListUrl.'?view=admin&display='.$display.'&session_id="+sessionId+"&course_id="+courseId+"&student_id="+studentId+"&date_to="+date_to+"&date_from="+date_from; |
|
|
|
|
}); |
|
|
|
|
$("#profile").on("change", function() { |
|
|
|
|
var date_to = $(\'#date_to\').val(); |
|
|
|
|
var date_from = $(\'#date_from\').val(); |
|
|
|
|
var sessionId = $("#session_name").val(); |
|
|
|
|
var courseId = $("#course_name").val(); |
|
|
|
|
var profile = $("#profile").val(); |
|
|
|
|
window.location = "'.$courseListUrl.'?view=admin&display='.$display.'&session_id="+sessionId+"&course_id="+courseId+"&profile="+profile+"&date_to="+date_to+"&date_from="+date_from; |
|
|
|
|
}); |
|
|
|
|
$( "#date_from, #date_to").datepicker({ |
|
|
|
|
dateFormat: \'yy-mm-dd\', |
|
|
|
|
onSelect: function( selectedDate ) { |
|
|
|
|
var filled = areBothFilled(); |
|
|
|
|
if (filled) { |
|
|
|
|
var date_to = $(\'#date_to\').val(); |
|
|
|
|
date_to = date_to.replace(/-/g,""); |
|
|
|
|
var date_from = $(\'#date_from\').val(); |
|
|
|
|
date_from = date_from.replace(/-/g,""); |
|
|
|
|
var sessionId = $("#session_name").val(); |
|
|
|
|
var courseId = $("#course_name").val(); |
|
|
|
|
var studentId = $("#student_name").val(); |
|
|
|
|
window.location = "'.$courseListUrl.'?view=admin&display='.$display.'&session_id="+sessionId+"&course_id="+courseId+"&student_id="+studentId+"&date_to="+date_to+"&date_from="+date_from; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
|
function areBothFilled() { |
|
|
|
|
var returnValue = false; |
|
|
|
|
if ((document.getElementById("date_from").value != "") && (document.getElementById("date_to").value != "")){ |
|
|
|
|
returnValue = true; |
|
|
|
|
} |
|
|
|
|
return returnValue; |
|
|
|
|
} |
|
|
|
|
</script>'; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (in_array($display, array('surveyoverview'))) { |
|
|
|
|
$surveyOverview = new FormValidator('survey_filter', 'get', '', '', array('class'=> 'form-horizontal'), false); |
|
|
|
|
$url = api_get_path(WEB_AJAX_PATH).'course.ajax.php?a=search_survey_by_course&session_id=' . $_GET['session_id'] . '&course_id=' . $_GET['course_id'] . '&survey_id=' . $_GET['survey_id']; |
|
|
|
|
$surveyList = array(); |
|
|
|
|
$surveyId = isset($_GET['survey_id']) ? intval($_GET['survey_id']) : null; |
|
|
|
|
$courseId = isset($_GET['course_id']) ? intval($_GET['course_id']) : null; |
|
|
|
|
if (!empty($surveyId)) { |
|
|
|
|
$course = api_get_course_info_by_id($courseId); |
|
|
|
|
$surveyList = array(); |
|
|
|
|
$exerciseInfo = survey_manager::get_survey($surveyId, 0, $course['code']); |
|
|
|
|
$surveyList[] = array('id' => $exerciseInfo['id'], 'text' => $exerciseInfo['title']); |
|
|
|
|
} |
|
|
|
|
$surveyOverview->addElement('select_ajax', 'survey_name', get_lang('SearchSurvey'), null, array('url' => $url, 'defaults' => $surveyList)); |
|
|
|
|
$courseListUrl = api_get_self(); |
|
|
|
|
|
|
|
|
|
echo '<div class="">'; |
|
|
|
|
echo $surveyOverview ->return_form(); |
|
|
|
|
echo '</div>'; |
|
|
|
|
|
|
|
|
|
echo '<script> |
|
|
|
|
$(function() { |
|
|
|
|
$("#survey_name").on("change", function() { |
|
|
|
|
var sessionId = $("#session_name").val(); |
|
|
|
|
var courseId = $("#course_name").val(); |
|
|
|
|
var surveyId = $("#survey_name").val(); |
|
|
|
|
window.location = "'.$courseListUrl.'?view=admin&display='.$display.'&session_id="+sessionId+"&course_id="+courseId+"&survey_id="+surveyId; |
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
|
</script>'; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (in_array($display, array('exerciseprogress'))) { |
|
|
|
|
//exercise |
|
|
|
|
$exerciseFilter = new FormValidator('student_filter', 'get', '', '', array('class'=> 'form-horizontal'), false); |
|
|
|
|
$url = api_get_path(WEB_AJAX_PATH).'course.ajax.php?a=search_exercise_by_course&session_id=' . $_GET['session_id'] . '&course_id=' . $_GET['course_id']; |
|
|
|
|
$exerciseList = array(); |
|
|
|
|
$exerciseId = isset($_GET['exercise_id']) ? $_GET['exercise_id'] : null; |
|
|
|
|
if (!empty($exerciseId)) { |
|
|
|
|
$exerciseList = array(); |
|
|
|
|
$exerciseInfo = current(get_exercise_by_id($exerciseId)); |
|
|
|
|
$exerciseList[] = array('id' => $exerciseInfo['id'], 'text' => $exerciseInfo['title']); |
|
|
|
|
} |
|
|
|
|
$exerciseFilter->addElement('select_ajax', 'exercise_name', get_lang('SearchExercise'), null, array('url' => $url, 'defaults' => $exerciseList)); |
|
|
|
|
$courseListUrl = api_get_self(); |
|
|
|
|
|
|
|
|
|
echo '<div class="">'; |
|
|
|
|
echo $exerciseFilter->return_form(); |
|
|
|
|
echo '</div>'; |
|
|
|
|
|
|
|
|
|
echo '<script> |
|
|
|
|
$(function() { |
|
|
|
|
$("#exercise_name").on("change", function() { |
|
|
|
|
var sessionId = $("#session_name").val(); |
|
|
|
|
var courseId = $("#course_name").val(); |
|
|
|
|
var exerciseId = $("#exercise_name").val(); |
|
|
|
|
window.location = "'.$courseListUrl.'?view=admin&display='.$display.'&session_id="+sessionId+"&course_id="+courseId+"&exercise_id="+exerciseId; |
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
|
</script>'; |
|
|
|
|
|
|
|
|
|
//answer Type |
|
|
|
|
$answerFilter = new FormValidator('answer_filter', 'get', '', '', array('class'=> 'form-horizontal'), false); |
|
|
|
|
$options = array( |
|
|
|
|
2 => get_lang('all'), |
|
|
|
|
0 => get_lang('incorrect'), |
|
|
|
|
1 => get_lang('correct'), |
|
|
|
|
); |
|
|
|
|
$answerFilter->addElement('select', 'answer', get_lang('AnswerIndicator'),$options, array('id' => 'answer')); |
|
|
|
|
$courseListUrl = api_get_self(); |
|
|
|
|
|
|
|
|
|
echo '<div class="">'; |
|
|
|
|
echo $answerFilter->return_form(); |
|
|
|
|
echo '</div>'; |
|
|
|
|
|
|
|
|
|
echo '<script> |
|
|
|
|
$(function() { |
|
|
|
|
$("#answer").on("change", function() { |
|
|
|
|
var sessionId = $("#session_name").val(); |
|
|
|
|
var courseId = $("#course_name").val(); |
|
|
|
|
var exerciseId = $("#exercise_name").val(); |
|
|
|
|
var answerType = $("#answer").val(); |
|
|
|
|
window.location = "'.$courseListUrl.'?view=admin&display='.$display.'&session_id="+sessionId+"&course_id="+courseId+"&exercise_id="+exerciseId+"&answer="+answerType; |
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
|
</script>'; |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if ($display === 'useroverview') { |
|
|
|
|
MySpace::display_tracking_user_overview(); |
|
|
|
|
} else if($display == 'sessionoverview') { |
|
|
|
|
MySpace::display_tracking_session_overview(); |
|
|
|
|
} else if($display == 'accessoverview') { |
|
|
|
|
if (!empty($_GET['session_id'])) { |
|
|
|
|
if (!empty($_GET['course_id'])) { |
|
|
|
|
if(!empty($_GET['date_to']) && (!empty($_GET['date_from']))) { |
|
|
|
|
if (!empty($_GET['student_id'])) { |
|
|
|
|
echo MySpace::display_tracking_access_overview(intval($_GET['session_id']), intval($_GET['course_id']), intval($_GET['student_id']), '', $_GET['date_to'], $_GET['date_from']); |
|
|
|
|
} else if (!empty($_GET['profile'])) { |
|
|
|
|
echo MySpace::display_tracking_access_overview(intval($_GET['session_id']), intval($_GET['course_id']), '', $_GET['profile'], $_GET['date_to'], $_GET['date_from']); |
|
|
|
|
} else { |
|
|
|
|
Display::display_warning_message(get_lang('ChooseStudentOrProfile')); |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
Display::display_warning_message(get_lang('ChooseStartDateAndEndDate')); |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
Display::display_warning_message(get_lang('ChooseCourse')); |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
Display::display_warning_message(get_lang('ChooseSession')); |
|
|
|
|
} |
|
|
|
|
} else if($display == 'lpprogressoverview') { |
|
|
|
|
if (!empty($_GET['session_id'])) { |
|
|
|
|
if (!empty($_GET['course_id'])) |
|
|
|
|
{ |
|
|
|
|
echo MySpace::display_tracking_lp_progress_overview(intval($_GET['session_id']), intval($_GET['course_id'])); |
|
|
|
|
} else |
|
|
|
|
{ |
|
|
|
|
Display::display_warning_message(get_lang('ChooseCourse')); |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
Display::display_warning_message(get_lang('ChooseSession')); |
|
|
|
|
} |
|
|
|
|
} else if($display == 'progressoverview') { |
|
|
|
|
if (!empty($_GET['session_id'])) { |
|
|
|
|
if (!empty($_GET['course_id'])) { |
|
|
|
|
echo MySpace::display_tracking_progress_overview(intval($_GET['session_id']), intval($_GET['course_id'])); |
|
|
|
|
} else { |
|
|
|
|
Display::display_warning_message(get_lang('ChooseCourse')); |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
Display::display_warning_message(get_lang('ChooseSession')); |
|
|
|
|
} |
|
|
|
|
} else if($display == 'exerciseprogress') { |
|
|
|
|
if (!empty($_GET['course_id'])) { |
|
|
|
|
if (!empty($_GET['exercise_id'])) { |
|
|
|
|
$answer = (isset($_GET['answer'])) ? intval($_GET['answer']) : 2; |
|
|
|
|
echo MySpace::display_tracking_exercise_progress_overview(intval($_GET['session_id']), intval($_GET['course_id']), intval($_GET['exercise_id']), $answer); |
|
|
|
|
} else { |
|
|
|
|
Display::display_warning_message(get_lang('ChooseExercise')); |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
Display::display_warning_message(get_lang('ChooseCourse')); |
|
|
|
|
} |
|
|
|
|
} else if($display == 'surveyoverview') { |
|
|
|
|
if (!empty($_GET['session_id'])) { |
|
|
|
|
if (!empty($_GET['course_id'])) { |
|
|
|
|
if (!empty($_GET['survey_id'])) { |
|
|
|
|
echo MySpace::display_survey_overview(intval($_GET['session_id']), intval($_GET['course_id']), intval($_GET['survey_id'])); |
|
|
|
|
} else { |
|
|
|
|
Display::display_warning_message(get_lang('ChooseSurvey')); |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
Display::display_warning_message(get_lang('ChooseCourse')); |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
Display::display_warning_message(get_lang('ChooseSession')); |
|
|
|
|
} |
|
|
|
|
} else if($display == 'courseoverview') { |
|
|
|
|
MySpace::display_tracking_course_overview(); |
|
|
|
|
} else { |
|
|
|
|
if ($export_csv) { |
|
|
|
|
$is_western_name_order = api_is_western_name_order(PERSON_NAME_DATA_EXPORT); |
|
|
|
|
} else { |
|
|
|
|
$is_western_name_order = api_is_western_name_order(); |
|
|
|
|
} |
|
|
|
|
$sort_by_first_name = api_sort_by_first_name(); |
|
|
|
|
$tracking_column = isset($_GET['tracking_list_coaches_column']) ? $_GET['tracking_list_coaches_column'] : ($is_western_name_order xor $sort_by_first_name) ? 1 : 0; |
|
|
|
|
$tracking_direction = (isset($_GET['tracking_list_coaches_direction']) && in_array(strtoupper($_GET['tracking_list_coaches_direction']), array('ASC', 'DESC', 'ASCENDING', 'DESCENDING', '0', '1'))) ? $_GET['tracking_list_coaches_direction'] : 'DESC'; |
|
|
|
|
// Prepare array for column order - when impossible, use some of user names. |
|
|
|
|
if ($is_western_name_order) { |
|
|
|
|
$order = array(0 => 'firstname', 1 => 'lastname', 2 => ($sort_by_first_name ? 'firstname' : 'lastname'), 3 => 'login_date', 4 => ($sort_by_first_name ? 'firstname' : 'lastname'), 5 => ($sort_by_first_name ? 'firstname' : 'lastname')); |
|
|
|
|
} else { |
|
|
|
|
$order = array(0 => 'lastname', 1 => 'firstname', 2 => ($sort_by_first_name ? 'firstname' : 'lastname'), 3 => 'login_date', 4 => ($sort_by_first_name ? 'firstname' : 'lastname'), 5 => ($sort_by_first_name ? 'firstname' : 'lastname')); |
|
|
|
|
} |
|
|
|
|
$table = new SortableTable('tracking_list_coaches_myspace', 'count_coaches', null, ($is_western_name_order xor $sort_by_first_name) ? 1 : 0); |
|
|
|
|
$parameters['view'] = 'admin'; |
|
|
|
|
$table->set_additional_parameters($parameters); |
|
|
|
|
if ($is_western_name_order) { |
|
|
|
|
$table->set_header(0, get_lang('FirstName'), true); |
|
|
|
|
$table->set_header(1, get_lang('LastName'), true); |
|
|
|
|
} else { |
|
|
|
|
$table->set_header(0, get_lang('LastName'), true); |
|
|
|
|
$table->set_header(1, get_lang('FirstName'), true); |
|
|
|
|
} |
|
|
|
|
$table->set_header(2, get_lang('TimeSpentOnThePlatform'), false); |
|
|
|
|
$table->set_header(3, get_lang('LastConnexion'), false); |
|
|
|
|
$table->set_header(4, get_lang('NbStudents'), false); |
|
|
|
|
$table->set_header(5, get_lang('CountCours'), false); |
|
|
|
|
$table->set_header(6, get_lang('NumberOfSessions'), false); |
|
|
|
|
$table->set_header(7, get_lang('Sessions'), false); |
|
|
|
|
|
|
|
|
|
if ($is_western_name_order) { |
|
|
|
|
$csv_header[] = array ( |
|
|
|
|
get_lang('FirstName', ''), |
|
|
|
|
get_lang('LastName', ''), |
|
|
|
|
get_lang('TimeSpentOnThePlatform', ''), |
|
|
|
|
get_lang('LastConnexion', ''), |
|
|
|
|
get_lang('NbStudents', ''), |
|
|
|
|
get_lang('CountCours', ''), |
|
|
|
|
get_lang('NumberOfSessions', '') |
|
|
|
|
); |
|
|
|
|
} else { |
|
|
|
|
$csv_header[] = array ( |
|
|
|
|
get_lang('LastName', ''), |
|
|
|
|
get_lang('FirstName', ''), |
|
|
|
|
get_lang('TimeSpentOnThePlatform', ''), |
|
|
|
|
get_lang('LastConnexion', ''), |
|
|
|
|
get_lang('NbStudents', ''), |
|
|
|
|
get_lang('CountCours', ''), |
|
|
|
|
get_lang('NumberOfSessions', '') |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$tbl_track_login = Database :: get_statistic_table(TABLE_STATISTIC_TRACK_E_LOGIN); |
|
|
|
|
|
|
|
|
|
$sqlCoachs = "SELECT DISTINCT scu.id_user as id_coach, user_id, lastname, firstname, MAX(login_date) as login_date |
|
|
|
|
FROM $tbl_user, $tbl_session_course_user scu, $tbl_track_login |
|
|
|
|
WHERE scu.id_user=user_id AND scu.status=2 AND login_user_id=user_id |
|
|
|
|
GROUP BY user_id "; |
|
|
|
|
|
|
|
|
|
if ($_configuration['multiple_access_urls']) { |
|
|
|
|
$tbl_session_rel_access_url = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION); |
|
|
|
|
$access_url_id = api_get_current_access_url_id(); |
|
|
|
|
if ($access_url_id != -1) { |
|
|
|
|
$sqlCoachs = "SELECT DISTINCT scu.id_user as id_coach, user_id, lastname, firstname, MAX(login_date) as login_date |
|
|
|
|
FROM $tbl_user, $tbl_session_course_user scu, $tbl_track_login , $tbl_session_rel_access_url session_rel_url |
|
|
|
|
WHERE scu.id_user=user_id AND scu.status=2 AND login_user_id=user_id AND access_url_id = $access_url_id AND session_rel_url.session_id=id_session |
|
|
|
|
GROUP BY user_id "; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if (!empty($order[$tracking_column])) { |
|
|
|
|
$sqlCoachs .= "ORDER BY ".$order[$tracking_column]." ".$tracking_direction; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$result_coaches = Database::query($sqlCoachs); |
|
|
|
|
$total_no_coaches = Database::num_rows($result_coaches); |
|
|
|
|
$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 |
|
|
|
|
FROM '.$tbl_user.','.$tbl_sessions.' as session,'.$tbl_track_login.' |
|
|
|
|
WHERE id_coach=user_id AND login_user_id=user_id |
|
|
|
|
GROUP BY user_id |
|
|
|
|
ORDER BY login_date '.$tracking_direction; |
|
|
|
|
|
|
|
|
|
if ($_configuration['multiple_access_urls']) { |
|
|
|
|
$tbl_session_rel_access_url = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION); |
|
|
|
|
$access_url_id = api_get_current_access_url_id(); |
|
|
|
|
if ($access_url_id != -1) { |
|
|
|
|
$sql_session_coach = 'SELECT session.id_coach, user_id, lastname, firstname, MAX(login_date) as login_date |
|
|
|
|
FROM '.$tbl_user.','.$tbl_sessions.' as session,'.$tbl_track_login.' , '.$tbl_session_rel_access_url.' as session_rel_url |
|
|
|
|
WHERE id_coach=user_id AND login_user_id=user_id AND access_url_id = '.$access_url_id.' AND session_rel_url.session_id=session.id |
|
|
|
|
GROUP BY user_id |
|
|
|
|
ORDER BY login_date '.$tracking_direction; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$result_sessions_coach = Database::query($sql_session_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_coaches as $id_coach => $coaches) { |
|
|
|
|
|
|
|
|
|
$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[] = $coaches['firstname']; |
|
|
|
|
$table_row[] = $coaches['lastname']; |
|
|
|
|
} else { |
|
|
|
|
$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[] = '<a href="session.php?id_coach='.$coaches['user_id'].'"><img src="'.api_get_path(WEB_IMG_PATH).'2rightarrow.gif" border="0" /></a>'; |
|
|
|
|
$all_datas[] = $table_row; |
|
|
|
|
|
|
|
|
|
if ($is_western_name_order) { |
|
|
|
|
$csv_content[] = array( |
|
|
|
|
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, |
|
|
|
|
$nb_courses, |
|
|
|
|
$nb_sessions |
|
|
|
|
); |
|
|
|
|
} else { |
|
|
|
|
$csv_content[] = array( |
|
|
|
|
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, |
|
|
|
|
$nb_courses, |
|
|
|
|
$nb_sessions |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if ($tracking_column != 3) { |
|
|
|
|
if ($tracking_direction == 'DESC') { |
|
|
|
|
usort($all_datas, 'rsort_users'); |
|
|
|
|
} else { |
|
|
|
|
usort($all_datas, 'sort_users'); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if ($export_csv && $tracking_column != 3) { |
|
|
|
|
usort($csv_content, 'sort_users'); |
|
|
|
|
} |
|
|
|
|
if ($export_csv) { |
|
|
|
|
$csv_content = array_merge($csv_header, $csv_content); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
foreach ($all_datas as $row) { |
|
|
|
|
$table->addRow($row, 'align="right"'); |
|
|
|
|
} |
|
|
|
|
$table->display(); |
|
|
|
|
} |
|
|
|
|
}*/ |
|
|
|
|
|
|
|
|
|
// Send the csv file if asked |
|
|
|
|
if ($export_csv) { |
|
|
|
|
ob_end_clean(); |
|
|
|
|
@ -1098,16 +398,6 @@ if ($export_csv) { |
|
|
|
|
exit; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//footer |
|
|
|
|
if (!$export_csv) { |
|
|
|
|
Display::display_footer(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Get number of courses for sortable with pagination |
|
|
|
|
* @return int |
|
|
|
|
*/ |
|
|
|
|
function get_number_of_courses() { |
|
|
|
|
global $courses; |
|
|
|
|
return count($courses); |
|
|
|
|
} |
|
|
|
|
|