'../admin/index.php', 'name' => get_lang('PlatformAdmin'), ]; $interbreadcrumb[] = [ 'url' => '../session/session_list.php', 'name' => get_lang('SessionList'), ]; $interbreadcrumb[] = [ 'url' => '../session/resume_session.php?id_session='.$sessionId, 'name' => get_lang('SessionOverview'), ]; } $view = isset($_REQUEST['view']) ? $_REQUEST['view'] : ''; $nameTools = get_lang('Tracking'); // getting all the students of the course 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 session. $a_students = CourseManager::get_student_list_from_course_code( api_get_course_id(), true, $sessionId ); } $nbStudents = count($a_students); // Display the header. Display::display_header($nameTools, 'Tracking'); /* MAIN CODE */ $actionsLeft = Display::return_icon( 'user_na.png', get_lang('StudentsTracking'), [], ICON_SIZE_MEDIUM ); $actionsLeft .= Display::url( Display::return_icon('group.png', get_lang('GroupReporting'), [], ICON_SIZE_MEDIUM), 'course_log_groups.php?'.api_get_cidreq() ); $actionsLeft .= Display::url( Display::return_icon('course.png', get_lang('CourseTracking'), [], ICON_SIZE_MEDIUM), 'course_log_tools.php?'.api_get_cidreq() ); $actionsLeft .= Display::url( Display::return_icon('tools.png', get_lang('ResourcesTracking'), [], ICON_SIZE_MEDIUM), 'course_log_resources.php?'.api_get_cidreq() ); $actionsLeft .= Display::url( Display::return_icon('quiz.png', get_lang('ExamTracking'), [], ICON_SIZE_MEDIUM), api_get_path(WEB_CODE_PATH).'tracking/exams.php?'.api_get_cidreq() ); if (!empty($sessionId)) { $actionsLeft .= Display::url( Display::return_icon('attendance_list.png', get_lang('Logins'), '', ICON_SIZE_MEDIUM), api_get_path(WEB_CODE_PATH).'attendance/index.php?'.api_get_cidreq().'&action=calendar_logins' ); } $actionsRight = '
'; $actionsRight .= ''. Display::return_icon('printer.png', get_lang('Print'), '', ICON_SIZE_MEDIUM).''; $users_tracking_per_page = ''; if (isset($_GET['users_tracking_per_page'])) { $users_tracking_per_page = '&users_tracking_per_page='.intval($_GET['users_tracking_per_page']); } $actionsRight .= ' '.Display::return_icon('export_csv.png', get_lang('ExportAsCSV'), '', ICON_SIZE_MEDIUM).''; $actionsRight .= '
'; // Create a search-box. $form_search = new FormValidator( 'search_simple', 'GET', api_get_path(WEB_CODE_PATH).'tracking/total_time.php?'.api_get_cidreq(), '', [], FormValidator::LAYOUT_INLINE ); $form_search->addElement('hidden', 'from', Security::remove_XSS($from)); $form_search->addElement('hidden', 'session_id', $sessionId); $form_search->addElement('hidden', 'id_session', $sessionId); $form_search->addElement('text', 'user_keyword'); $form_search->addButtonSearch(get_lang('SearchUsers')); echo Display::toolbarAction( 'toolbar-courselog', [$actionsLeft, $form_search->returnForm(), $actionsRight] ); $course_name = get_lang('Course').' '.$courseInfo['name']; if ($session_id) { $titleSession = Display::return_icon( 'session.png', get_lang('Session'), [], ICON_SIZE_SMALL ).' '.api_get_session_name($session_id); $titleCourse = Display::return_icon( 'course.png', get_lang('Course'), [], ICON_SIZE_SMALL ).' '.$course_name; } else { $titleSession = Display::return_icon( 'course.png', get_lang('Course'), [], ICON_SIZE_SMALL ).' '.$courseInfo['name']; } $teacherList = CourseManager::getTeacherListFromCourseCodeToString( $courseInfo['code'], ',', false, true ); $coaches = null; if (!empty($session_id)) { $coaches = CourseManager::get_coachs_from_course_to_string( $session_id, $courseInfo['real_id'], ',', false, true ); } $html = ''; if (!empty($teacherList)) { $html .= Display::page_subheader2(get_lang('Teachers')); $html .= $teacherList; } if (!empty($coaches)) { $html .= Display::page_subheader2(get_lang('Coaches')); $html .= $coaches; } if (api_is_platform_admin(true) || api_is_session_general_coach() ) { $sessionList = SessionManager::get_session_by_course($courseInfo['real_id']); if (!empty($sessionList)) { $html .= Display::page_subheader2(get_lang('SessionList')); $icon = Display::return_icon( 'session.png', null, null, ICON_SIZE_TINY ); $html .= ''; } } $html .= Display::page_subheader2(get_lang('StudentList')); // PERSON_NAME_DATA_EXPORT is buggy $is_western_name_order = api_is_western_name_order(); if (count($a_students) > 0) { $all_datas = []; $course_code = $_course['id']; $user_ids = array_keys($a_students); $table = new SortableTable( 'users_tracking', ['TrackingCourseLog', 'get_number_of_users'], ['TrackingCourseLog', 'getTotalTimeReport'], (api_is_western_name_order() xor api_sort_by_first_name()) ? 3 : 2 ); $parameters['cidReq'] = Security::remove_XSS($_GET['cidReq']); $parameters['id_session'] = $session_id; $parameters['from'] = isset($_GET['myspace']) ? Security::remove_XSS($_GET['myspace']) : null; $table->set_additional_parameters($parameters); $headers = []; // tab of header texts $table->set_header(0, get_lang('OfficialCode'), true); $headers['official_code'] = get_lang('OfficialCode'); if ($is_western_name_order) { $table->set_header(1, get_lang('FirstName'), true); $headers['firstname'] = get_lang('FirstName'); $table->set_header(2, get_lang('LastName'), true); $headers['lastname'] = get_lang('LastName'); } else { $table->set_header(1, get_lang('LastName'), true); $headers['lastname'] = get_lang('LastName'); $table->set_header(2, get_lang('FirstName'), true); $headers['firstname'] = get_lang('FirstName'); } $table->set_header(3, get_lang('Login'), false); $headers['login'] = get_lang('Login'); $table->set_header(4, get_lang('TrainingTime').' '. Display::return_icon('info3.gif', get_lang('CourseTimeInfo'), ['align' => 'absmiddle', 'hspace' => '3px']), false, ['style' => 'width:110px;'] ); $headers['training_time'] = get_lang('TrainingTime'); $table->set_header(5, get_lang('TotalLPTime').' '. Display::return_icon('info3.gif', get_lang('TotalLPTime'), ['align' => 'absmiddle', 'hspace' => '3px']), false, ['style' => 'width:110px;'] ); $headers['total_time_lp'] = get_lang('TotalLPTime'); $table->set_header(6, get_lang('FirstLoginInCourse'), false); $headers['first_login'] = get_lang('FirstLoginInCourse'); $table->set_header(7, get_lang('LatestLoginInCourse'), false); $headers['latest_login'] = get_lang('LatestLoginInCourse'); // Display the table $html .= "
"; $html .= $table->return_table(); $html .= "
"; } else { $html .= Display::return_message(get_lang('NoUsersInCourse'), 'warning', true); } echo Display::panel($html, $titleSession); Display::display_footer();