|
@@ -48,54 +48,60 @@ function count_courses() {
|
|
|
$show_import_icon = false;
|
|
|
|
|
|
if (api_get_setting('add_users_by_coach') == 'true') {
|
|
|
- if (!api_is_platform_admin()) {
|
|
|
- $sql = 'SELECT id_coach FROM '.Database :: get_main_table(TABLE_MAIN_SESSION).' WHERE id='.$id_session;
|
|
|
- $rs = Database::query($sql);
|
|
|
- if (Database::result($rs, 0, 0) != $_user['user_id']) {
|
|
|
- api_not_allowed(true);
|
|
|
- } else {
|
|
|
- $show_import_icon=true;
|
|
|
- }
|
|
|
- }
|
|
|
+ if (!api_is_platform_admin()) {
|
|
|
+ $sql = 'SELECT id_coach FROM '.Database :: get_main_table(TABLE_MAIN_SESSION).' WHERE id='.$id_session;
|
|
|
+ $rs = Database::query($sql);
|
|
|
+ if (Database::result($rs, 0, 0) != $_user['user_id']) {
|
|
|
+ api_not_allowed(true);
|
|
|
+ } else {
|
|
|
+ $show_import_icon=true;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
Display :: display_header($nameTools);
|
|
|
|
|
|
$a_courses = array();
|
|
|
if (api_is_drh() || api_is_session_admin() || api_is_platform_admin()) {
|
|
|
-
|
|
|
- $title = '';
|
|
|
- if (empty($id_session)) {
|
|
|
- if (isset($_GET['user_id'])) {
|
|
|
- $user_id = intval($_GET['user_id']);
|
|
|
- $user_info = api_get_user_info($user_id);
|
|
|
- $title = get_lang('AssignedCoursesTo').' '.api_get_person_name($user_info['firstname'], $user_info['lastname']);
|
|
|
- $courses = CourseManager::get_course_list_of_user_as_course_admin($user_id);
|
|
|
- } else {
|
|
|
- $title = get_lang('YourCourseList');
|
|
|
- $courses = CourseManager::get_courses_followed_by_drh($_user['user_id']);
|
|
|
- }
|
|
|
- } else {
|
|
|
- $session_name = api_get_session_name($id_session);
|
|
|
- $title = api_htmlentities($session_name,ENT_QUOTES,$charset).' : '.get_lang('CourseListInSession');
|
|
|
- $courses = Tracking::get_courses_list_from_session($id_session);
|
|
|
- }
|
|
|
+ $coursesFromSession = array();
|
|
|
+ if (api_is_drh()) {
|
|
|
+ if (api_drh_can_access_all_session_content()) {
|
|
|
+ $coursesFromSession = SessionManager::getAllCoursesFromAllSessionFromDrh(api_get_user_id());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ $title = '';
|
|
|
+ if (empty($id_session)) {
|
|
|
+ if (isset($_GET['user_id'])) {
|
|
|
+ $user_id = intval($_GET['user_id']);
|
|
|
+ $user_info = api_get_user_info($user_id);
|
|
|
+ $title = get_lang('AssignedCoursesTo').' '.api_get_person_name($user_info['firstname'], $user_info['lastname']);
|
|
|
+ $courses = CourseManager::get_course_list_of_user_as_course_admin($user_id);
|
|
|
+ } else {
|
|
|
+ $title = get_lang('YourCourseList');
|
|
|
+ $courses = CourseManager::get_courses_followed_by_drh($_user['user_id']);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ $session_name = api_get_session_name($id_session);
|
|
|
+ $title = api_htmlentities($session_name, ENT_QUOTES, $charset).' : '.get_lang('CourseListInSession');
|
|
|
+ $courses = Tracking::get_courses_list_from_session($id_session);
|
|
|
+ }
|
|
|
|
|
|
$a_courses = array_keys($courses);
|
|
|
|
|
|
- if (!api_is_session_admin()) {
|
|
|
- $menu_items[] = Display::url(Display::return_icon('stats.png', get_lang('MyStats'),'',ICON_SIZE_MEDIUM),api_get_path(WEB_CODE_PATH)."auth/my_progress.php" );
|
|
|
- $menu_items[] = Display::url(Display::return_icon('user.png', get_lang('Students'), array(), 32), "index.php?view=drh_students&display=yourstudents");
|
|
|
- $menu_items[] = Display::url(Display::return_icon('teacher.png', get_lang('Trainers'), array(), 32), 'teachers.php');
|
|
|
- $menu_items[] = Display::return_icon('course_na.png', get_lang('Courses'), array(), 32);
|
|
|
- $menu_items[] = Display::url(Display::return_icon('session.png', get_lang('Sessions'), array(), 32), 'session.php');
|
|
|
- }
|
|
|
+ if (!api_is_session_admin()) {
|
|
|
+ $menu_items[] = Display::url(Display::return_icon('stats.png', get_lang('MyStats'),'',ICON_SIZE_MEDIUM),api_get_path(WEB_CODE_PATH)."auth/my_progress.php" );
|
|
|
+ $menu_items[] = Display::url(Display::return_icon('user.png', get_lang('Students'), array(), 32), "index.php?view=drh_students&display=yourstudents");
|
|
|
+ $menu_items[] = Display::url(Display::return_icon('teacher.png', get_lang('Trainers'), array(), 32), 'teachers.php');
|
|
|
+ $menu_items[] = Display::return_icon('course_na.png', get_lang('Courses'), array(), 32);
|
|
|
+ $menu_items[] = Display::url(Display::return_icon('session.png', get_lang('Sessions'), array(), 32), 'session.php');
|
|
|
+ }
|
|
|
|
|
|
echo '<div class="actions">';
|
|
|
$nb_menu_items = count($menu_items);
|
|
|
if ($nb_menu_items > 1) {
|
|
|
foreach ($menu_items as $key => $item) {
|
|
|
- echo $item;
|
|
|
+ echo $item;
|
|
|
}
|
|
|
}
|
|
|
if (count($a_courses) > 0) {
|
|
@@ -123,28 +129,34 @@ if (isset($_GET['action'])) {
|
|
|
|
|
|
if ($show_import_icon) {
|
|
|
echo "<div align=\"right\">";
|
|
|
- echo '<a href="user_import.php?id_session='.$id_session.'&action=export&type=xml">'.Display::return_icon('excel.gif', get_lang('ImportUserListXMLCSV')).' '.get_lang('ImportUserListXMLCSV').'</a>';
|
|
|
+ echo '<a href="user_import.php?id_session='.$id_session.'&action=export&type=xml">'.
|
|
|
+ Display::return_icon('excel.gif', get_lang('ImportUserListXMLCSV')).' '.get_lang('ImportUserListXMLCSV').'</a>';
|
|
|
echo "</div><br />";
|
|
|
}
|
|
|
|
|
|
if (!api_is_drh() && !api_is_session_admin() && !api_is_platform_admin()) {
|
|
|
$courses = Tracking::get_courses_followed_by_coach($_user['user_id'], $id_session);
|
|
|
- $a_courses = array_keys($courses);
|
|
|
+ $a_courses = array_keys($courses);
|
|
|
+}
|
|
|
+
|
|
|
+if (api_drh_can_access_all_session_content()) {
|
|
|
+ if (!isset($_GET['user_id'])) {
|
|
|
+ $a_courses = $coursesFromSession;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
$nb_courses = count($a_courses);
|
|
|
|
|
|
$table = new SortableTable('tracking_list_course', 'count_courses');
|
|
|
-$table -> set_header(0, get_lang('CourseTitle'), false);
|
|
|
-$table -> set_header(1, get_lang('NbStudents'), false);
|
|
|
-$table -> set_header(2, get_lang('TimeSpentInTheCourse').Display :: return_icon('info3.gif', get_lang('TimeOfActiveByTraining'), array('align' => 'absmiddle', 'hspace' => '3px')), false);
|
|
|
-$table -> set_header(3, get_lang('ThematicAdvance'), false);
|
|
|
-$table -> set_header(4, get_lang('AvgStudentsProgress').Display :: return_icon('info3.gif', get_lang('AvgAllUsersInAllCourses'), array('align' => 'absmiddle', 'hspace' => '3px')), false);
|
|
|
-$table -> set_header(5, get_lang('AvgCourseScore').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('AvgAssignments'), false);
|
|
|
-$table -> set_header(8, get_lang('Details'), false);
|
|
|
+$table->set_header(0, get_lang('CourseTitle'), false);
|
|
|
+$table->set_header(1, get_lang('NbStudents'), false);
|
|
|
+$table->set_header(2, get_lang('TimeSpentInTheCourse').Display :: return_icon('info3.gif', get_lang('TimeOfActiveByTraining'), array('align' => 'absmiddle', 'hspace' => '3px')), false);
|
|
|
+$table->set_header(3, get_lang('ThematicAdvance'), false);
|
|
|
+$table->set_header(4, get_lang('AvgStudentsProgress').Display :: return_icon('info3.gif', get_lang('AvgAllUsersInAllCourses'), array('align' => 'absmiddle', 'hspace' => '3px')), false);
|
|
|
+$table->set_header(5, get_lang('AvgCourseScore').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('AvgAssignments'), false);
|
|
|
+$table->set_header(8, get_lang('Details'), false);
|
|
|
|
|
|
$csv_header[] = array(
|
|
|
get_lang('CourseTitle', ''),
|
|
@@ -153,7 +165,6 @@ $csv_header[] = array(
|
|
|
get_lang('ThematicAdvance', ''),
|
|
|
get_lang('AvgStudentsProgress', ''),
|
|
|
get_lang('AvgCourseScore', ''),
|
|
|
-
|
|
|
get_lang('AvgMessages', ''),
|
|
|
get_lang('AvgAssignments', '')
|
|
|
);
|
|
@@ -173,20 +184,21 @@ if (is_array($a_courses)) {
|
|
|
|
|
|
$rs = Database::query($sql);
|
|
|
$users = array();
|
|
|
- while ($row = Database::fetch_array($rs)) { $users[] = $row['user_id']; }
|
|
|
+ while ($row = Database::fetch_array($rs)) {
|
|
|
+ $users[] = $row['user_id'];
|
|
|
+ }
|
|
|
|
|
|
if (count($users) > 0) {
|
|
|
$nb_students_in_course = count($users);
|
|
|
-
|
|
|
+
|
|
|
$avg_progress_in_course = Tracking :: get_avg_student_progress ($users, $course_code, array(), $id_session);
|
|
|
$avg_score_in_course = Tracking :: get_avg_student_score ($users, $course_code, array(), $id_session);
|
|
|
$avg_time_spent_in_course = Tracking :: get_time_spent_on_the_course ($users, $course_code, $id_session);
|
|
|
$messages_in_course = Tracking :: count_student_messages ($users, $course_code, $id_session);
|
|
|
$assignments_in_course = Tracking :: count_student_assignments ($users, $course_code, $id_session);
|
|
|
-
|
|
|
$avg_time_spent_in_course = api_time_to_hms($avg_time_spent_in_course / $nb_students_in_course);
|
|
|
$avg_progress_in_course = round($avg_progress_in_course / $nb_students_in_course, 2);
|
|
|
-
|
|
|
+
|
|
|
if (is_numeric($avg_score_in_course)) {
|
|
|
$avg_score_in_course = round($avg_score_in_course / $nb_students_in_course, 2).'%';
|
|
|
}
|
|
@@ -201,7 +213,7 @@ if (is_array($a_courses)) {
|
|
|
|
|
|
$tematic_advance_progress = 0;
|
|
|
$thematic = new Thematic();
|
|
|
- $tematic_advance = $thematic->get_total_average_of_thematic_advances($course_code, $id_session);
|
|
|
+ $tematic_advance = $thematic->get_total_average_of_thematic_advances($course_code, $id_session);
|
|
|
|
|
|
if (!empty($tematic_advance)) {
|
|
|
$tematic_advance_csv = $tematic_advance_progress.'%';
|
|
@@ -210,16 +222,27 @@ if (is_array($a_courses)) {
|
|
|
$tematic_advance_progress = '-';
|
|
|
}
|
|
|
|
|
|
- $table_row = array();
|
|
|
- $table_row[] = $course['title'];
|
|
|
- $table_row[] = $nb_students_in_course;
|
|
|
- $table_row[] = is_null($avg_time_spent_in_course)?'-':$avg_time_spent_in_course;
|
|
|
- $table_row[] = $tematic_advance_progress;
|
|
|
- $table_row[] = is_null($avg_progress_in_course) ? '-' : $avg_progress_in_course.'%';
|
|
|
- $table_row[] = is_null($avg_score_in_course) ? '-' : $avg_score_in_course;
|
|
|
- $table_row[] = is_null($messages_in_course)?'-':$messages_in_course;
|
|
|
- $table_row[] = is_null($assignments_in_course)?'-':$assignments_in_course;
|
|
|
- $table_row[] = '<a href="../tracking/courseLog.php?cidReq='.$course_code.'&id_session='.$id_session.'"><img src="'.api_get_path(WEB_IMG_PATH).'2rightarrow.gif" border="0" /></a>';
|
|
|
+ $courseIcon = '<a href="../tracking/courseLog.php?cidReq='.$course_code.'&id_session='.$id_session.'">
|
|
|
+ <img src="'.api_get_path(WEB_IMG_PATH).'2rightarrow.gif" border="0" />
|
|
|
+ </a>';
|
|
|
+
|
|
|
+ if (!empty($coursesFromSession)) {
|
|
|
+ if (!in_array($course_code, $coursesFromSession)) {
|
|
|
+ $courseIcon = Display::return_icon('2rightarrow_na.gif', get_lang('Course'), array());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ $table_row = array(
|
|
|
+ $course['title'],
|
|
|
+ $nb_students_in_course,
|
|
|
+ is_null($avg_time_spent_in_course)?'-':$avg_time_spent_in_course,
|
|
|
+ $tematic_advance_progress,
|
|
|
+ is_null($avg_progress_in_course) ? '-' : $avg_progress_in_course.'%',
|
|
|
+ is_null($avg_score_in_course) ? '-' : $avg_score_in_course,
|
|
|
+ is_null($messages_in_course)?'-':$messages_in_course,
|
|
|
+ is_null($assignments_in_course)?'-':$assignments_in_course,
|
|
|
+ $courseIcon
|
|
|
+ );
|
|
|
|
|
|
$csv_content[] = array (
|
|
|
$course['title'],
|
|
@@ -232,13 +255,9 @@ if (is_array($a_courses)) {
|
|
|
$assignments_in_course,
|
|
|
);
|
|
|
|
|
|
- $table -> addRow($table_row, 'align="right"');
|
|
|
+ $table->addRow($table_row, 'align="right"');
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
$table -> display();
|
|
|
|
|
|
Display :: display_footer();
|