"index.php", "name" => get_lang('MySpace')); Display :: display_header($nameTools); $formateurs = array(); 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').''; 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 ' | '; } } } if (count($formateurs) > 0) { echo '   '.get_lang('Print').' '; echo ' '.get_lang('ExportAsCSV').''; } echo '
'; echo '

'.get_lang('YourTeachers').'

'; echo '
'; } if (!api_is_drh()) { api_display_tool_title($nameTools); } // Database Table Definitions $tbl_course = Database :: get_main_table(TABLE_MAIN_COURSE); $tbl_user = Database :: get_main_table(TABLE_MAIN_USER); $tbl_session = Database :: get_main_table(TABLE_MAIN_SESSION); $tbl_session_course = Database :: get_main_table(TABLE_MAIN_SESSION_COURSE); $tbl_session_rel_user = Database :: get_main_table(TABLE_MAIN_SESSION_USER); /** * MAIN PART */ if (isset($_POST['export'])) { $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() && !api_is_platform_admin()) { $order_clause = $sort_by_first_name ? ' ORDER BY firstname, lastname' : ' ORDER BY lastname, firstname'; if (isset($_GET["teacher_id"]) && $_GET["teacher_id"] != 0) { $teacher_id = intval($_GET["teacher_id"]); $sql_formateurs = "SELECT user_id,lastname,firstname,email FROM $tbl_user WHERE user_id='$teacher_id'".$order_clause; } else { $sql_formateurs = "SELECT user_id,lastname,firstname,email FROM $tbl_user WHERE status = 1".$order_clause; } $result_formateurs = Database::query($sql_formateurs); if (Database::num_rows($result_formateurs) > 0) { while ($row_formateurs = Database::fetch_array($result_formateurs)) { $formateurs[] = $row_formateurs; } } } $a_last_week = get_last_week(); $last_week = date('Y-m-d',$a_last_week[0]).' '.get_lang('To').' '.date('Y-m-d', $a_last_week[6]); if ($is_western_name_order) { echo ''; } else { echo '
'.get_lang('FirstName').''.get_lang('LastName').''.get_lang('TimeSpentLastWeek').'
'.$last_week.'
'.get_lang('Email').''.get_lang('AdminCourses').''.get_lang('Students').'
'; } if ($is_western_name_order) { $header[] = get_lang('FirstName'); $header[] = get_lang('LastName'); } else { $header[] = get_lang('LastName'); $header[] = get_lang('FirstName'); } $header[] = get_lang('TimeSpentLastWeek'); $header[] = get_lang('Email'); $data = array(); if (count($formateurs) > 0) { $i = 1; foreach ($formateurs as $formateur) { $user_id = $formateur["user_id"]; $lastname = $formateur["lastname"]; $firstname = $formateur["firstname"]; $email = $formateur["email"]; if ($i % 2 == 0) { $css_class = "row_odd"; if ($i % 20 == 0 && $i != 0) { if ($is_western_name_order) { echo ''; } else { echo ''; } } } else { $css_class = "row_even"; } $i++; if ($is_western_name_order) { $data[$user_id]["firstname"] = $firstname; $data[$user_id]["lastname"] = $lastname; } else { $data[$user_id]["lastname"] = $lastname; $data[$user_id]["firstname"] = $firstname; } $time_on_platform = api_time_to_hms(Tracking :: get_time_spent_on_the_platform($user_id,true)); $data[$user_id]["timespentlastweek"] = $time_on_platform; $data[$user_id]["email"] = $email; if ($is_western_name_order) { echo ''; } else { echo ''; } } } else { // No results echo ''; } echo '
'.get_lang('LastName').''.get_lang('FirstName').''.get_lang('TimeSpentLastWeek').'
'.$last_week.'
'.get_lang('Email').''.get_lang('AdminCourses').''.get_lang('Students').'
'.get_lang('FirstName').''.get_lang('LastName').''.get_lang('Email').''.get_lang('AdminCourses').''.get_lang('Students').'
'.get_lang('LastName').''.get_lang('FirstName').''.get_lang('Email').''.get_lang('AdminCourses').''.get_lang('Students').'
'.$firstname.''.$lastname.''.$time_on_platform.''.$email.'
'.$lastname.''.$firstname.''.$time_on_platform.''.$email.'
'.get_lang("NoResults").'
'; if (isset($_POST['export']) || (api_is_drh() && isset($_GET['export']))) { MySpace::export_csv($header, $data, 'teachers.csv'); } echo "

"; if (!api_is_drh()) { echo "
"; } /* ============================================================================== FOOTER ============================================================================== */ Display::display_footer();