From 2c7132469c32f68967b1c4dd1c8115ff8870f8e3 Mon Sep 17 00:00:00 2001 From: Julio Montoya Date: Tue, 20 Sep 2011 15:13:11 +0200 Subject: [PATCH] Minor fixing reporting titles --- main/mySpace/course.php | 19 ++----- main/mySpace/index.php | 100 ++++++++++++++++-------------------- main/mySpace/myStudents.php | 2 +- main/mySpace/student.php | 7 ++- 4 files changed, 50 insertions(+), 78 deletions(-) diff --git a/main/mySpace/course.php b/main/mySpace/course.php index 6f5967f1b3..3034bbb108 100755 --- a/main/mySpace/course.php +++ b/main/mySpace/course.php @@ -1,17 +1,13 @@ '; @@ -254,10 +247,4 @@ $table -> setColAttributes(0, array('align' => 'left')); $table -> setColAttributes(7, array('align' => 'center')); $table -> display(); -/* - ============================================================================== - FOOTER - ============================================================================== - */ - -Display :: display_footer(); +Display :: display_footer(); \ No newline at end of file diff --git a/main/mySpace/index.php b/main/mySpace/index.php index 3bd3a26a05..a9c448493c 100755 --- a/main/mySpace/index.php +++ b/main/mySpace/index.php @@ -9,7 +9,6 @@ $cidReset = true; require_once '../inc/global.inc.php'; // including additional libraries -require_once api_get_path(LIBRARY_PATH).'tracking.lib.php'; require_once api_get_path(LIBRARY_PATH).'export.lib.inc.php'; require_once 'myspace.lib.php'; @@ -30,8 +29,8 @@ $is_platform_admin = api_is_platform_admin(); $is_drh = api_is_drh(); $is_session_admin = api_is_session_admin(); -$nb_sessions = 0; -$nb_teacher_courses = 0; +$count_sessions = 0; +$count_courses = 0; $title = null; // access control @@ -56,15 +55,8 @@ if (!$export_csv) { // Database table definitions $tbl_user = Database :: get_main_table(TABLE_MAIN_USER); -$tbl_course = Database :: get_main_table(TABLE_MAIN_COURSE); -$tbl_course_user = Database :: get_main_table(TABLE_MAIN_COURSE_USER); -$tbl_class = Database :: get_main_table(TABLE_MAIN_CLASS); $tbl_sessions = Database :: get_main_table(TABLE_MAIN_SESSION); -$tbl_session_course = Database :: get_main_table(TABLE_MAIN_SESSION_COURSE); -$tbl_session_user = Database :: get_main_table(TABLE_MAIN_SESSION_USER); $tbl_session_course_user = Database :: get_main_table(TABLE_MAIN_SESSION_COURSE_USER); -$tbl_admin = Database :: get_main_table(TABLE_MAIN_ADMIN); -$tbl_track_cours_access = Database :: get_statistic_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS); /* * FUNCTIONS */ @@ -82,8 +74,8 @@ function rsort_users($a, $b) { } function count_sessions_coached() { - global $nb_sessions; - return $nb_sessions; + global $count_sessions; + return $count_sessions; } function sort_sessions($a, $b) { @@ -123,8 +115,6 @@ global $_configuration; //If is a teacher or admin if (api_is_allowed_to_create_course() || api_is_drh()) { - - } if ($is_platform_admin) { @@ -151,12 +141,13 @@ if ($is_drh) { echo '
'; echo ''; + if ($display == 'useroverview' || $display == 'sessionoverview' || $display == 'courseoverview') { echo ''; echo Display::return_icon("export_csv.png", get_lang('ExportAsCSV'),array(), 32); echo ''; } -echo ''. Display::return_icon('printer.png', get_lang('Print'),'','32').''; +echo ''.Display::return_icon('printer.png', get_lang('Print'),'','32').''; echo ''; if (!empty($session_id)) { @@ -167,52 +158,31 @@ if (!empty($session_id)) { // Actions menu $nb_menu_items = count($menu_items); - if (empty($session_id)) { if ($nb_menu_items > 1) { foreach ($menu_items as $key => $item) { echo $item; } } -} - +} echo '
'; - -if ($nb_teacher_courses || $nb_sessions) { - //If we are in course - if (empty($session_id)) { - if ($nb_teacher_courses) { - $title = ' '.get_lang('Courses').' ('.$nb_teacher_courses.') '; - } - } else { - //If we are in Course Session - $session_name = api_get_session_name($session_id); - $title = Display::return_icon('session.png', get_lang('Session'), array(), 22).' '.$session_name; - $menu_items[] = ''.get_lang('TeacherInterface').''; - } -} - - - -//if (empty($session_id) && $view == 'teacher') { if (empty($session_id)) { //Getting courses followed by a coach (No session courses) $courses = CourseManager::get_course_list_as_coach($user_id, false); + if (isset($courses[0])) { $courses = $courses[0]; } //Getting students from courses and courses in sessions (For show the total students that the user follows) - $students = CourseManager::get_user_list_from_courses_as_coach($user_id); + $students = CourseManager::get_user_list_from_courses_as_coach($user_id); // Sessions for the coach - $sessions = Tracking::get_sessions_coached_by_user($user_id); - $nb_sessions = count($sessions); - - //If is drh + $sessions = Tracking::get_sessions_coached_by_user($user_id); + //If is drh if ($is_drh) { // get data for human resources manager $students = array_keys(UserManager::get_users_followed_by_drh($user_id, STUDENT)); @@ -222,10 +192,13 @@ if (empty($session_id)) { } } - - //Courses for the teacher - $nb_teacher_courses = count($courses); + //Courses for the user + $count_courses = count($courses); + + //Sessions for the user + $count_sessions = count($sessions); + //Students $nb_students = count($students); @@ -279,7 +252,7 @@ if (empty($session_id)) { $avg_results_to_exercises += $avg_student_score; } - if ($nb_students > 0) { + if ($nb_students > 0 && $view != 'admin') { echo Display::tag('h2', ' '.get_lang('Students').' ('.$nb_students.')'); @@ -298,7 +271,7 @@ if (empty($session_id)) { if ($export_csv) { //csv part - $csv_content[] = array(get_lang('Probationers', '')); + $csv_content[] = array(get_lang('Students', '')); $csv_content[] = array(get_lang('InactivesStudents', ''), $nb_inactive_students ); $csv_content[] = array(get_lang('AverageTimeSpentOnThePlatform', ''), $avg_time_spent); $csv_content[] = array(get_lang('AverageCoursePerStudent', ''), $avg_courses_per_student); @@ -357,15 +330,30 @@ if (empty($session_id)) { $courses = Tracking::get_courses_followed_by_coach($user_id, $session_id); } + + +if ($count_courses || $count_sessions) { + //If we are in course + if (empty($session_id)) { + if ($count_courses) { + $title = ' '.get_lang('Courses').' ('.$count_courses.') '; + } + } else { + //If we are in Course Session + $session_name = api_get_session_name($session_id); + $title = Display::return_icon('session.png', get_lang('Session'), array(), 22).' '.$session_name; + $menu_items[] = ''.get_lang('TeacherInterface').''; + } +} + + + if (api_is_allowed_to_create_course() && $view == 'teacher') { //Courses - if ($nb_teacher_courses) { - - - - echo Display::tag('h2', $title); + if ($count_courses) { + echo Display::tag('h2', $title); $table = new SortableTable('courses', 'get_number_of_courses' ,array('MySpace','get_course_data')); $parameters['view'] = 'teacher'; @@ -395,8 +383,8 @@ if (api_is_allowed_to_create_course() && $view == 'teacher') { } // Display list of sessions - if ($nb_sessions > 0 && !isset($_GET['session_id'])) { - echo '

 '.get_lang('Sessions').' ('.$nb_sessions.')'.'

'; + if ($count_sessions > 0 && !isset($_GET['session_id'])) { + echo '

 '.get_lang('Sessions').' ('.$count_sessions.')'.'

'; $table = new SortableTable('tracking_sessions', 'count_sessions_coached'); $table->set_header(0, get_lang('Title'), false); $table->set_header(1, get_lang('Date'), false); @@ -524,10 +512,8 @@ if ($is_platform_admin && $view == 'admin' && $display != 'yourstudents') { echo ' ( '.get_lang('ExportUserOverviewOptions').' )'; } echo ' | '.get_lang('DisplaySessionOverview').''; - echo ' | '.get_lang('DisplayCourseOverview').''; - - echo ' | '.get_lang('LPQuestionListResults').''; - + echo ' | '.get_lang('DisplayCourseOverview').''; + echo ' | '.get_lang('LPQuestionListResults').''; echo ' | '.get_lang('LPExerciseResultsBySession').''; diff --git a/main/mySpace/myStudents.php b/main/mySpace/myStudents.php index 0c0ce57573..2f7ca74042 100755 --- a/main/mySpace/myStudents.php +++ b/main/mySpace/myStudents.php @@ -443,7 +443,7 @@ if (!empty($_GET['student'])) { $url_big_image = $big_image . '?rnd=' . time(); $img_attributes = 'src="' . $image_file . '?rand=' . time() . '" ' . 'alt="' . api_get_person_name($info_user['firstname'], $info_user['lastname']) . '" ' . - 'style="float:' . ($text_dir == 'rtl' ? 'left' : 'right') . '; padding:5px;" '; + 'style="float:' . ($text_dir == 'rtl' ? 'right' : 'left') . '; padding:5px;" '; if ($image_array['file'] == 'unknown.jpg') { echo ''; diff --git a/main/mySpace/student.php b/main/mySpace/student.php index 7a2af5e772..1f0aeb713c 100755 --- a/main/mySpace/student.php +++ b/main/mySpace/student.php @@ -19,10 +19,10 @@ if (isset($_GET['id_coach']) && intval($_GET['id_coach']) != 0) { $sql = 'SELECT lastname, firstname FROM '.Database::get_main_table(TABLE_MAIN_USER).' WHERE user_id='.intval($_GET['id_coach']); $rs = Database::query($sql); $coach_name = api_get_person_name(Database::result($rs, 0, 1), Database::result($rs, 0, 0)); - $title = get_lang('Probationers').' - '.$coach_name; + $title = get_lang('Students').' - '.$coach_name; } else { $nameTools = get_lang("Students"); - $title = get_lang('Probationers'); + $title = get_lang('Students'); } $this_section = SECTION_TRACKING; @@ -130,8 +130,7 @@ if (api_is_allowed_to_create_course() || api_is_drh()) { $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'); - - echo '
'; + echo '
'; $nb_menu_items = count($menu_items); if ($nb_menu_items > 1) { foreach ($menu_items as $key => $item) {