|
|
@ -23,14 +23,14 @@ if ($export_csv) { |
|
|
|
$csv_content = array(); |
|
|
|
$csv_content = array(); |
|
|
|
|
|
|
|
|
|
|
|
if (isset($_GET['id_coach']) && intval($_GET['id_coach']) != 0) { |
|
|
|
if (isset($_GET['id_coach']) && intval($_GET['id_coach']) != 0) { |
|
|
|
$nameTools = get_lang("CoachStudents"); |
|
|
|
$nameTools = get_lang("CoachStudents"); |
|
|
|
$sql = 'SELECT lastname, firstname FROM '.Database::get_main_table(TABLE_MAIN_USER).' WHERE user_id='.intval($_GET['id_coach']); |
|
|
|
$sql = 'SELECT lastname, firstname FROM '.Database::get_main_table(TABLE_MAIN_USER).' WHERE user_id='.intval($_GET['id_coach']); |
|
|
|
$rs = Database::query($sql); |
|
|
|
$rs = Database::query($sql); |
|
|
|
$coach_name = api_get_person_name(Database::result($rs, 0, 1), Database::result($rs, 0, 0)); |
|
|
|
$coach_name = api_get_person_name(Database::result($rs, 0, 1), Database::result($rs, 0, 0)); |
|
|
|
$page_title = get_lang('Students').' - '.$coach_name; |
|
|
|
$page_title = get_lang('Students').' - '.$coach_name; |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
$nameTools = get_lang("Students"); |
|
|
|
$nameTools = get_lang("Students"); |
|
|
|
$page_title = get_lang('Students'); |
|
|
|
$page_title = get_lang('Students'); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
$this_section = SECTION_TRACKING; |
|
|
|
$this_section = SECTION_TRACKING; |
|
|
@ -46,9 +46,6 @@ if (isset($_GET["user_id"]) && $_GET["user_id"]!="" && isset($_GET["type"]) && $ |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
Display :: display_header($nameTools); |
|
|
|
Display :: display_header($nameTools); |
|
|
|
/* |
|
|
|
|
|
|
|
FUNCTION |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function count_student_coached() { |
|
|
|
function count_student_coached() { |
|
|
|
global $students; |
|
|
|
global $students; |
|
|
@ -73,10 +70,7 @@ function rsort_users($a, $b) { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/* MAIN CODE */ |
|
|
|
if (api_is_allowed_to_create_course() || api_is_drh()) { |
|
|
|
|
|
|
|
|
|
|
|
//if ($isCoach || api_is_platform_admin() || api_is_drh()) { |
|
|
|
|
|
|
|
if (api_is_allowed_to_create_course() || api_is_drh()) { |
|
|
|
|
|
|
|
if ($export_csv) { |
|
|
|
if ($export_csv) { |
|
|
|
$is_western_name_order = api_is_western_name_order(PERSON_NAME_DATA_EXPORT); |
|
|
|
$is_western_name_order = api_is_western_name_order(PERSON_NAME_DATA_EXPORT); |
|
|
|
} else { |
|
|
|
} else { |
|
|
@ -91,29 +85,29 @@ if (api_is_allowed_to_create_course() || api_is_drh()) { |
|
|
|
$menu_items[] = Display::url(Display::return_icon('teacher.png', get_lang('Trainers'), array(), 32), 'teachers.php'); |
|
|
|
$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('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'); |
|
|
|
$menu_items[] = Display::url(Display::return_icon('session.png', get_lang('Sessions'), array(), 32), 'session.php'); |
|
|
|
|
|
|
|
|
|
|
|
echo '<div class="actions">'; |
|
|
|
echo '<div class="actions">'; |
|
|
|
$nb_menu_items = count($menu_items); |
|
|
|
$nb_menu_items = count($menu_items); |
|
|
|
if ($nb_menu_items > 1) { |
|
|
|
if ($nb_menu_items > 1) { |
|
|
|
foreach ($menu_items as $key => $item) { |
|
|
|
foreach ($menu_items as $key => $item) { |
|
|
|
echo $item; |
|
|
|
echo $item; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//if (count($students) > 0) { // |
|
|
|
//if (count($students) > 0) { // |
|
|
|
echo '<span style="float:right">'; |
|
|
|
echo '<span style="float:right">'; |
|
|
|
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('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 Display::url(Display::return_icon('export_csv.png', get_lang('ExportAsCSV'), array(), 32), api_get_self().'?export=csv'); |
|
|
|
echo '</span>'; |
|
|
|
echo '</span>'; |
|
|
|
//} |
|
|
|
//} |
|
|
|
echo '</div>'; |
|
|
|
echo '</div>'; |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
echo '<div class="actions"><div style="float:right;"> |
|
|
|
echo '<div class="actions"><div style="float:right;"> |
|
|
|
<a href="javascript: void(0);" onclick="javascript: window.print();"><img align="absbottom" src="../img/printmgr.gif"> '.get_lang('Print').'</a> |
|
|
|
<a href="javascript: void(0);" onclick="javascript: window.print();"><img align="absbottom" src="../img/printmgr.gif"> '.get_lang('Print').'</a> |
|
|
|
<a href="'.api_get_self().'?export=csv"><img align="absbottom" src="../img/excel.gif"> '.get_lang('ExportAsCSV').'</a> |
|
|
|
<a href="'.api_get_self().'?export=csv"><img align="absbottom" src="../img/excel.gif"> '.get_lang('ExportAsCSV').'</a> |
|
|
|
</div></div>'; |
|
|
|
</div></div>'; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
echo Display::page_subheader($page_title); |
|
|
|
echo Display::page_subheader($page_title); |
|
|
|
|
|
|
|
|
|
|
|
if (isset($_GET['id_coach'])) { |
|
|
|
if (isset($_GET['id_coach'])) { |
|
|
@ -121,10 +115,17 @@ if (api_is_allowed_to_create_course() || api_is_drh()) { |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
$coach_id = api_get_user_id(); |
|
|
|
$coach_id = api_get_user_id(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (api_is_drh()) { |
|
|
|
if (api_is_drh()) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (api_drh_can_access_all_session_content()) { |
|
|
|
|
|
|
|
$studentsAllowed = SessionManager::getAllUsersFromCoursesFromAllSessionFromDrh(api_get_user_id()); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
$studentsAllowed = array_keys(UserManager::get_users_followed_by_drh(api_get_user_id() , STUDENT)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
$page_title = get_lang('YourStudents'); |
|
|
|
$page_title = get_lang('YourStudents'); |
|
|
|
if (!isset($_GET['id_session'])) { |
|
|
|
if (!isset($_GET['id_session'])) { |
|
|
|
|
|
|
|
|
|
|
|
if (isset($_GET['user_id'])) { |
|
|
|
if (isset($_GET['user_id'])) { |
|
|
|
$user_id = intval($_GET['user_id']); |
|
|
|
$user_id = intval($_GET['user_id']); |
|
|
|
$user_info = api_get_user_info($user_id); |
|
|
|
$user_info = api_get_user_info($user_id); |
|
|
@ -147,22 +148,22 @@ if (api_is_allowed_to_create_course() || api_is_drh()) { |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
$students = array_keys(UserManager::get_users_followed_by_drh(api_get_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(); |
|
|
|
$courses_of_the_platform = CourseManager :: get_real_course_list(); |
|
|
|
foreach ($courses_of_the_platform as $course) { |
|
|
|
foreach ($courses_of_the_platform as $course) { |
|
|
|
$courses[$course['code']] = $course['code']; |
|
|
|
$courses[$course['code']] = $course['code']; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
if (!isset($_GET['id_session'])) { |
|
|
|
if (!isset($_GET['id_session'])) { |
|
|
|
//Getting courses |
|
|
|
// Getting courses |
|
|
|
$courses = CourseManager::get_course_list_as_coach($coach_id, false); |
|
|
|
$courses = CourseManager::get_course_list_as_coach($coach_id, false); |
|
|
|
if (isset($courses[0])) { |
|
|
|
if (isset($courses[0])) { |
|
|
|
$courses = $courses[0]; |
|
|
|
$courses = $courses[0]; |
|
|
|
} |
|
|
|
} |
|
|
|
//Getting students |
|
|
|
// Getting students |
|
|
|
$students = CourseManager::get_user_list_from_courses_as_coach($coach_id); |
|
|
|
$students = CourseManager::get_user_list_from_courses_as_coach($coach_id); |
|
|
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
} 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); |
|
|
|
} |
|
|
|
} |
|
|
@ -170,35 +171,26 @@ if (api_is_allowed_to_create_course() || api_is_drh()) { |
|
|
|
|
|
|
|
|
|
|
|
$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; |
|
|
|
$tracking_direction = isset($_GET['tracking_direction']) ? $_GET['tracking_direction'] : DESC; |
|
|
|
|
|
|
|
|
|
|
|
if (count($students) > 0) { |
|
|
|
if (count($students) > 0) { |
|
|
|
$table = new SortableTable('tracking_student', 'count_student_coached', null, ($is_western_name_order xor $sort_by_first_name) ? 1 : 0); |
|
|
|
$table = new SortableTable('tracking_student', 'count_student_coached', null, ($is_western_name_order xor $sort_by_first_name) ? 1 : 0); |
|
|
|
if ($is_western_name_order) { |
|
|
|
if ($is_western_name_order) { |
|
|
|
$table -> set_header(0, get_lang('FirstName'), false); |
|
|
|
$table->set_header(0, get_lang('FirstName'), false); |
|
|
|
$table -> set_header(1, get_lang('LastName'), false); |
|
|
|
$table->set_header(1, get_lang('LastName'), false); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
$table -> set_header(0, get_lang('LastName'), false); |
|
|
|
$table->set_header(0, get_lang('LastName'), false); |
|
|
|
$table -> set_header(1, get_lang('FirstName'), false); |
|
|
|
$table->set_header(1, get_lang('FirstName'), false); |
|
|
|
} |
|
|
|
} |
|
|
|
/* $table -> set_header(2, get_lang('Time'), false); |
|
|
|
|
|
|
|
$table -> set_header(3, get_lang('Progress'), false); |
|
|
|
$table->set_header(2, get_lang('FirstLogin'), false); |
|
|
|
$table -> set_header(4, get_lang('Score'), false); |
|
|
|
$table->set_header(3, get_lang('LatestLogin'), false); |
|
|
|
$table -> set_header(5, get_lang('Student_publication'), false); |
|
|
|
$table->set_header(4, 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 ($export_csv) { |
|
|
|
if ($is_western_name_order) { |
|
|
|
if ($is_western_name_order) { |
|
|
|
$csv_header[] = array ( |
|
|
|
$csv_header[] = array ( |
|
|
|
get_lang('FirstName', ''), |
|
|
|
get_lang('FirstName', ''), |
|
|
|
get_lang('LastName', ''), |
|
|
|
get_lang('LastName', ''), |
|
|
|
//get_lang('Time', ''), |
|
|
|
|
|
|
|
//get_lang('Progress', ''), |
|
|
|
|
|
|
|
//get_lang('Score', ''), |
|
|
|
|
|
|
|
//get_lang('Student_publication', ''), |
|
|
|
|
|
|
|
//get_lang('Messages', ''), |
|
|
|
|
|
|
|
get_lang('FirstLogin', ''), |
|
|
|
get_lang('FirstLogin', ''), |
|
|
|
get_lang('LatestLogin', '') |
|
|
|
get_lang('LatestLogin', '') |
|
|
|
); |
|
|
|
); |
|
|
@ -206,30 +198,26 @@ if (api_is_allowed_to_create_course() || api_is_drh()) { |
|
|
|
$csv_header[] = array ( |
|
|
|
$csv_header[] = array ( |
|
|
|
get_lang('LastName', ''), |
|
|
|
get_lang('LastName', ''), |
|
|
|
get_lang('FirstName', ''), |
|
|
|
get_lang('FirstName', ''), |
|
|
|
//get_lang('Time', ''), |
|
|
|
|
|
|
|
//get_lang('Progress', ''), |
|
|
|
|
|
|
|
//get_lang('Score', ''), |
|
|
|
|
|
|
|
//get_lang('Student_publication', ''), |
|
|
|
|
|
|
|
//get_lang('Messages', ''), |
|
|
|
|
|
|
|
get_lang('FirstLogin', ''), |
|
|
|
get_lang('FirstLogin', ''), |
|
|
|
get_lang('LatestLogin', '') |
|
|
|
get_lang('LatestLogin', '') |
|
|
|
); |
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
$all_datas = array(); |
|
|
|
$all_datas = array(); |
|
|
|
|
|
|
|
|
|
|
|
foreach ($students as $student_id) { |
|
|
|
foreach ($students as $student_id) { |
|
|
|
$student_data = UserManager :: get_user_info_by_id($student_id); |
|
|
|
$student_data = UserManager :: get_user_info_by_id($student_id); |
|
|
|
|
|
|
|
|
|
|
|
if (isset($_GET['id_session'])) { |
|
|
|
if (isset($_GET['id_session'])) { |
|
|
|
$courses = Tracking :: get_course_list_in_session_from_student($student_id, $_GET['id_session']); |
|
|
|
$courses = Tracking :: get_course_list_in_session_from_student($student_id, $_GET['id_session']); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
$avg_time_spent = $avg_student_score = $avg_student_progress = $total_assignments = $total_messages = 0; |
|
|
|
$avg_time_spent = $avg_student_score = $avg_student_progress = $total_assignments = $total_messages = 0; |
|
|
|
$nb_courses_student = 0; |
|
|
|
$nb_courses_student = 0; |
|
|
|
foreach ($courses as $course_code) { |
|
|
|
foreach ($courses as $course_code) { |
|
|
|
if (CourseManager :: is_user_subscribed_in_course($student_id, $course_code, true)) { |
|
|
|
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']); |
|
|
|
$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); |
|
|
|
$my_average = Tracking :: get_avg_student_score($student_id, $course_code); |
|
|
|
if (is_numeric($my_average)) { |
|
|
|
if (is_numeric($my_average)) { |
|
|
|
$avg_student_score += $my_average; |
|
|
|
$avg_student_score += $my_average; |
|
|
@ -259,33 +247,36 @@ if (api_is_allowed_to_create_course() || api_is_drh()) { |
|
|
|
$row[] = $student_data['lastname']; |
|
|
|
$row[] = $student_data['lastname']; |
|
|
|
$row[] = $student_data['firstname']; |
|
|
|
$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); |
|
|
|
$string_date = Tracking :: get_last_connection_date($student_id, true); |
|
|
|
$first_date = Tracking :: get_first_connection_date($student_id); |
|
|
|
$first_date = Tracking :: get_first_connection_date($student_id); |
|
|
|
$row[] = $first_date; |
|
|
|
$row[] = $first_date; |
|
|
|
$row[] = $string_date; |
|
|
|
$row[] = $string_date; |
|
|
|
|
|
|
|
|
|
|
|
if ($export_csv) { |
|
|
|
if ($export_csv) { |
|
|
|
$row[count($row) - 1] = strip_tags($row[count($row) - 1]); |
|
|
|
$row[count($row) - 1] = strip_tags($row[count($row) - 1]); |
|
|
|
$row[count($row) - 2] = strip_tags($row[count($row) - 2]); |
|
|
|
$row[count($row) - 2] = strip_tags($row[count($row) - 2]); |
|
|
|
$csv_content[] = $row; |
|
|
|
$csv_content[] = $row; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (isset($_GET['id_coach']) && intval($_GET['id_coach']) != 0) { |
|
|
|
|
|
|
|
$row[] = '<a href="myStudents.php?student='.$student_id.'&id_coach='.$coach_id.'&id_session='.$_GET['id_session'].'"><img src="'.api_get_path(WEB_IMG_PATH).'2rightarrow.gif" border="0" /></a>'; |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
$row[] = '<a href="myStudents.php?student='.$student_id.'"><img src="'.api_get_path(WEB_IMG_PATH).'2rightarrow.gif" border="0" /></a>'; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$all_datas[] = $row; |
|
|
|
if (isset($_GET['id_coach']) && intval($_GET['id_coach']) != 0) { |
|
|
|
|
|
|
|
$detailsLink = '<a href="myStudents.php?student='.$student_id.'&id_coach='.$coach_id.'&id_session='.$_GET['id_session'].'"> |
|
|
|
|
|
|
|
<img src="'.api_get_path(WEB_IMG_PATH).'2rightarrow.gif" border="0" /></a>'; |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
$detailsLink = '<a href="myStudents.php?student='.$student_id.'"> |
|
|
|
|
|
|
|
<img src="'.api_get_path(WEB_IMG_PATH).'2rightarrow.gif" border="0" /></a>'; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (api_is_drh()) { |
|
|
|
|
|
|
|
if (!in_array($student_id, $studentsAllowed)) { |
|
|
|
|
|
|
|
$detailsLink = Display::return_icon('2rightarrow_na.gif', get_lang('Details')); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$row[] = $detailsLink; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$all_datas[] = $row; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if ($tracking_direction == 'ASC') { |
|
|
|
if ($tracking_direction == 'ASC') { |
|
|
@ -315,5 +306,4 @@ if (api_is_allowed_to_create_course() || api_is_drh()) { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/* FOOTER */ |
|
|
|
|
|
|
|
Display :: display_footer(); |
|
|
|
Display :: display_footer(); |
|
|
|