"index.php", "name" => get_lang('MySpace')); if (isset($_GET["user_id"]) && $_GET["user_id"] != "" && !isset($_GET["type"])) { $interbreadcrumb[] = array ("url" => "teachers.php", "name" => get_lang('Teachers')); } if (isset($_GET["user_id"]) && $_GET["user_id"]!="" && isset($_GET["type"]) && $_GET["type"] == "coach") { $interbreadcrumb[] = array ("url" => "coaches.php", "name" => get_lang('Tutors')); } $isCoach = api_is_coach(); Display :: display_header($nameTools); // Database Table Definitions $tbl_course = Database :: get_main_table(TABLE_MAIN_COURSE); $tbl_user = Database :: get_main_table(TABLE_MAIN_USER); $tbl_course_user = Database :: get_main_table(TABLE_MAIN_COURSE_USER); $tbl_session = Database :: get_main_table(TABLE_MAIN_SESSION); $tbl_session_course = Database :: get_main_table(TABLE_MAIN_SESSION_COURSE); $tbl_session_course_user = Database :: get_main_table(TABLE_MAIN_SESSION_COURSE_USER); $tbl_session_rel_user = Database :: get_main_table(TABLE_MAIN_SESSION_USER); /* =============================================================================== FUNCTION =============================================================================== */ function count_student_coached() { global $students; return count($students); } function sort_users($a, $b) { global $tracking_column; if ($a[$tracking_column] > $b[$tracking_column]) { return 1; } else { return -1; } } function rsort_users($a, $b) { global $tracking_column; if ($b[$tracking_column] > $a[$tracking_column]) { return 1; } else { return -1; } } /* =============================================================================== MAIN CODE =============================================================================== */ if ($isCoach || api_is_platform_admin() || api_is_drh()) { 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(); if (api_is_drh() || $_GET['display'] == 'yourstudents') { $title = get_lang('YourStudents'); if (!isset($_GET['id_session'])) { if (isset($_GET['user_id'])) { $user_id = intval($_GET['user_id']); $user_info = api_get_user_info($user_id); $title = api_get_person_name($user_info['firstname'], $user_info['lastname']).' : '.get_lang('Students'); $courses_by_teacher = CourseManager::get_course_list_of_user_as_course_admin($user_id); $students_by_course = array(); if (!empty($courses_by_teacher)) { foreach ($courses_by_teacher as $course) { $students_by_course = array_keys(CourseManager::get_student_list_from_course_code($course['course_code'])); if (count($students_by_course) > 0) { foreach ($students_by_course as $student_by_course) { $students[] = $student_by_course; } } } } $students = array_unique($students); } else { $students = array_keys(UserManager::get_users_followed_by_drh($_user['user_id'], STUDENT)); } $courses_of_the_platform = CourseManager :: get_real_course_list(); foreach ($courses_of_the_platform as $course) { $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').''; echo '
'.get_lang('Print').' ';
echo '
'.get_lang('ExportAsCSV').'';
}
echo '
';
} else {
$row[] = '
';
}
$all_datas[] = $row;
}
if ($tracking_direction == 'ASC') {
usort($all_datas, 'rsort_users');
} else {
usort($all_datas, 'sort_users');
}
if ($export_csv) {
usort($csv_content, 'sort_users');
$csv_content = array_merge($csv_header, $csv_content);
}
foreach ($all_datas as $row) {
$table -> addRow($row, 'align="right"');
}
$table -> updateColAttributes(0, array('align' => 'left'));
$table -> updateColAttributes(1, array('align' => 'left'));
$table -> updateColAttributes(7, array('align' => 'left'));
$table -> updateColAttributes(8, array('align' => 'left'));
$table -> setColAttributes(9, array('align' => 'center'));
$table -> display();
} else {
echo ''.get_lang('NoStudent').'
'; } // send the csv file if asked if ($export_csv) { ob_end_clean(); Export :: export_table_csv($csv_content, 'reporting_student_list'); exit; } } /* ============================================================================== FOOTER ============================================================================== */ Display :: display_footer();