ソースを参照

Minor fixing exercise result column in My reporting

Julio Montoya 13 年 前
コミット
abb4448e0d

+ 1 - 1
main/exercice/admin.php

@@ -58,7 +58,7 @@ require_once 'exercise.lib.php';
 
 $this_section=SECTION_COURSES;
 
-$is_allowedToEdit=api_is_allowed_to_edit(null,true);
+$is_allowedToEdit = api_is_allowed_to_edit(null,true);
 
 if (!$is_allowedToEdit) {
 	api_not_allowed(true);

+ 3 - 11
main/exercice/exercice.php

@@ -652,6 +652,7 @@ if ($show == 'test') {
         echo '</div>';
     }
 }
+
 if ($show == 'test') {
     ?>    
     <script type="text/javascript">
@@ -683,16 +684,7 @@ if ($show == 'test') {
     $online_icon  = Display::return_icon('online.png', get_lang('Visible'),array('width'=>'12px'));
     $offline_icon = Display::return_icon('offline.png',get_lang('Invisible'),array('width'=>'12px'));
     
-    while ($row = Database :: fetch_array($result,'ASSOC')) {        
-        /*$status = $online_icon;
-        if (empty($row['active'])) {
-            $status = $offline_icon;    
-        }
-        if (!(api_is_platform_admin() || api_is_allowed_to_edit()) ) {
-        	$status = '';
-        }
-        $lis.= Display::tag('li','<a href="#tabs-'.$i.'">'.$status.' '.$row['title'].'</a>');
-        $i++;*/
+    while ($row = Database :: fetch_array($result,'ASSOC')) {
         $exercise_list[] = $row;
     } 
     
@@ -784,7 +776,7 @@ if ($show == 'test') {
 	                }
 				}
                       
-                // Teacher only
+                // Teacher only                
                 if ($is_allowedToEdit) {                   
                     $show_quiz_edition = true;                
                     $table_lp_item    = Database::get_course_table(TABLE_LP_ITEM);

+ 7 - 26
main/exercice/exercise_show.php

@@ -112,7 +112,6 @@ if (!$is_allowedToEdit) {
 //Unset session for clock time
 exercise_time_control_delete($exercise_id);
 
-$nameTools=get_lang('CorrectTest');
 if (isset($_SESSION['gradebook'])) {
 	$gradebook=	Security::remove_XSS($_SESSION['gradebook']);
 }
@@ -122,33 +121,15 @@ if (!empty($gradebook) && $gradebook=='view') {
 }
 
 $fromlink = '';
-if($origin=='user_course') {
-	$interbreadcrumb[] = array ("url" => "../user/user.php?cidReq=".Security::remove_XSS($_GET['course']), "name" => get_lang("Users"));
-	$interbreadcrumb[] = array("url" => "../mySpace/myStudents.php?student=".$student_id."&course=".$_course['id']."&details=true&origin=".Security::remove_XSS($_GET['origin']) , "name" => get_lang("DetailsStudentInCourse"));
-} else if($origin=='tracking_course') {
- 	$interbreadcrumb[] = array ("url" => api_get_path(WEB_COURSE_PATH).$_course['directory'], 'name' => $_course['title']);
-	$interbreadcrumb[] = array ("url" => "../tracking/courseLog.php?cidReq=".$cidReq.'&studentlist=true&id_session='.$_SESSION['id_session'], "name" => get_lang("Tracking"));
-	$interbreadcrumb[] = array ("url" => "../mySpace/myStudents.php?student=".$student_id.'&details=true&origin='.$origin.'&course='.Security::remove_XSS($_GET['cidReq']), "name" => get_lang("DetailsStudentInCourse"));
-	$interbreadcrumb[] = array ("url" => "../mySpace/lp_tracking.php?action=stats&course=".$cidReq."&student_id=".$student_id."&lp_id=".Security::remove_XSS($_GET['my_lp_id'])."&origin=".Security::remove_XSS($_GET['origin']) , "name" => get_lang("LearningPathDetails"));
-
-	$from_myspace = false;
-	if (isset ($_GET['from']) && $_GET['from'] == 'myspace') {
-		$fromlink = '&from=myspace';
-		$this_section = SECTION_TRACKING;
-	} else {
-		$this_section = SECTION_COURSES;
-	}
-} elseif($origin=='student_progress') {
-	$this_section = SECTION_TRACKING;
-	$interbreadcrumb[] = array ("url" => "../auth/my_progress.php?id_session".Security::remove_XSS($_GET['id_session'])."&course=".$_cid, "name" => get_lang('MyProgress'));
-	unset($_cid);
-} else {
-	$interbreadcrumb[]=array("url" => "exercice.php?gradebook=$gradebook","name" => get_lang('Exercices'));
-	$this_section=SECTION_COURSES;
-}
+
+$interbreadcrumb[]=array("url" => "exercice.php?gradebook=$gradebook","name" => get_lang('Exercices'));
+$interbreadcrumb[]=array("url" => "overview.php?exerciseId=".$exercise_id.'&id_session='.api_get_session_id(),"name" => $objExercise->name);
+$interbreadcrumb[]=array("url" => "#","name" => get_lang('Result'));
+
+$this_section=SECTION_COURSES;
 
 if ($origin != 'learnpath') {
-	Display::display_header($nameTools,get_lang('Exercise'));
+	Display::display_header('');
 } else {
 	Display::display_reduced_header();
 }

+ 5 - 1
main/exercice/overview.php

@@ -47,8 +47,12 @@ if ($origin != 'learnpath') {
 $html = '';
 
 $is_allowed_to_edit = api_is_allowed_to_edit(null,true);
+$edit_link = '';
+if ($is_allowed_to_edit ) {
+	$edit_link = Display::url(Display::return_icon('edit.png', get_lang('Edit'), array(), 22), api_get_path(WEB_CODE_PATH).'exercice/admin.php?'.api_get_cidreq().'&id_session='.api_get_session_id().'&exerciseId='.$objExercise->id);
+}
 
-$html .= Display::tag('h1', $objExercise->name);
+$html .= Display::tag('h1', $objExercise->name .' '.$edit_link);
 $html .= Display::div($objExercise->description, array('class'=>'exercise_description'));
 
 //Buttons

+ 2 - 1
main/inc/lib/tracking.lib.php

@@ -353,7 +353,7 @@ class Tracking {
 				$session_id = intval($session_id);
 				$condition_session = " AND session_id = $session_id ";
 			}
-			$sql = "SELECT count(id) FROM $tbl_course_quiz WHERE active <> -1 $condition_quiz ";
+			$sql = "SELECT count(id) FROM $tbl_course_quiz WHERE active <> -1 $condition_quiz ";			
 			$count_quiz = Database::fetch_row(Database::query($sql));
 
 			$quiz_avg_total_score = 0;
@@ -439,6 +439,7 @@ class Tracking {
                     AND orig_lp_item_id = $lp_item_id
                     AND exe_user_id= $student_id 
                     AND session_id = $session_id ";
+			
 			$rs = Database::query($sql);
 			$row = Database::fetch_row($rs);
 			$count_attempts = $row[0];

+ 12 - 14
main/mySpace/index.php

@@ -20,13 +20,12 @@ unset($_SESSION['this_section']);//for hmtl editor repository
 
 ob_start();
 
-$export_csv = isset($_GET['export']) && $_GET['export'] == 'csv' ? true : false;
-
-$display 	= isset($_GET['display']) ? Security::remove_XSS($_GET['display']) : null;
+$export_csv  = isset($_GET['export']) && $_GET['export'] == 'csv' ? true : false;
+$display 	 = isset($_GET['display']) ? Security::remove_XSS($_GET['display']) : null;
 $csv_content = array();
-$nameTools = get_lang('MySpace');
+$nameTools   = get_lang('MySpace');
 
-$user_id = api_get_user_id();
+$user_id 	 = api_get_user_id();
 $nb_sessions = 0;
 
 // access control
@@ -118,7 +117,7 @@ if ($is_session_admin) {
 
 // Get views
 $views = array('admin', 'teacher', 'coach', 'drh');
-$view = 'teacher';
+$view  = 'teacher';
 if (isset($_GET['view']) && in_array($_GET['view'], $views)) {
 	$view = $_GET['view'];
 }
@@ -128,12 +127,9 @@ $nb_teacher_courses = 0;
 $title = null;
 global $_configuration;
 
-
-
-// interbreadcrumbs
-// && isset($display) && $display != 'yourstudents'
-
+//If is a teacher coach or admin
 if (api_is_allowed_to_create_course()) {
+	
 	$session_id = isset($_GET['session_id']) ? intval($_GET['session_id']): 0;
 	if (!empty($session_id)) {
 		$courses = Tracking::get_courses_followed_by_coach($user_id, $session_id);
@@ -143,13 +139,15 @@ if (api_is_allowed_to_create_course()) {
 
 	$nb_teacher_courses = count($courses);	
 
-	$sessions = Tracking::get_sessions_coached_by_user($user_id);	
+	$sessions 	 = Tracking::get_sessions_coached_by_user($user_id);	
 	$nb_sessions = count($sessions);
 
-	if ($nb_teacher_courses || $nb_sessions) {	    
+	if ($nb_teacher_courses || $nb_sessions) {
+			    
 		if (!$is_coach && !$is_platform_admin) {
 			$view = 'teacher';
 		}
+				
 		if ($view == 'teacher' && empty($session_id)) {
 			$menu_items[] = get_lang('TeacherInterface');
 
@@ -241,7 +239,7 @@ if ($nb_teacher_courses > 0 ) {
 	echo '<div id="actions" class="actions">';
 	echo '<a href="'.api_get_path(WEB_CODE_PATH).'auth/my_progress.php">'.Display::return_icon('stats.png', get_lang('MyStats'),'','32').'</a>';//
 	echo '</div>';
-	Display::display_warning_message(get_lang('HaveNoCourse'));
+	//Display::display_warning_message(get_lang('HaveNoCourse'));
 }
 
 echo Display::tag('h2', $title);

+ 6 - 36
main/mySpace/myStudents.php

@@ -12,7 +12,6 @@ $language_file = array('registration', 'index', 'tracking', 'exercice', 'admin',
 require_once '../inc/global.inc.php';
 require_once api_get_path(LIBRARY_PATH).'tracking.lib.php';
 require_once api_get_path(LIBRARY_PATH).'export.lib.inc.php';
-require_once api_get_path(LIBRARY_PATH).'usermanager.lib.php';
 require_once api_get_path(LIBRARY_PATH).'course.lib.php';
 require_once api_get_path(SYS_CODE_PATH).'newscorm/learnpath.class.php';
 require_once api_get_path(SYS_CODE_PATH).'mySpace/myspace.lib.php';
@@ -179,17 +178,6 @@ $tbl_stats_access 			= Database :: get_statistic_table(TABLE_STATISTIC_TRACK_E_A
 $tbl_stats_exercices 		= Database :: get_statistic_table(TABLE_STATISTIC_TRACK_E_EXERCICES);
 $tbl_stats_exercices_attempts= Database :: get_statistic_table(TABLE_STATISTIC_TRACK_E_ATTEMPT);
 
-//$tbl_course_lp_view = 'lp_view';
-//$tbl_course_lp_view_item = 'lp_item_view';
-//$tbl_course_lp_item = 'lp_item';
-//$tbl_course_lp = 'lp';
-//$tbl_course_quiz = 'quiz';
-//$course_quiz_question = 'quiz_question';
-//$course_quiz_rel_question = 'quiz_rel_question';
-//$course_quiz_answer = 'quiz_answer';
-//$course_student_publication = Database :: get_course_table(TABLE_STUDENT_PUBLICATION);
-
-
 if (isset($_GET['user_id']) && $_GET['user_id'] != "") {
 	$user_id = intval($_GET['user_id']);
 } else {
@@ -216,24 +204,7 @@ if ($check) {
 			if (api_is_course_admin() && !empty($course) && !empty($lp_id) && !empty($student_id)) {					   
 				$course_info 	= api_get_course_info($course);                    
                 delete_student_lp_events($student_id, $lp_id, $course_info, $session_id);
-                
-                /*
-				$lp_view_table 	= Database::get_course_table(TABLE_LP_VIEW, $course_info['db_name']);
-				$lp_item_view_table 	= Database::get_course_table(TABLE_LP_ITEM_VIEW, $course_info['db_name']);
-                
-				//make sure we have the exact lp_view_id
-				$sqlview       = "SELECT id FROM $lp_view_table WHERE user_id = $student_id AND lp_id = $lp_id AND session_id= $session_id";					
-				$resultview    = Database::query($sqlview);
-				$view          = Database::fetch_array($resultview, 'ASSOC');
-				$lp_view_id    = $view['id'] ;					
-				
-				$sql_delete = "DELETE FROM $lp_item_view_table  WHERE lp_view_id = $view_id ";
-				$result = Database::query($sql_delete);
-					
-				$sql_delete = "DELETE FROM $lp_view_table  WHERE user_id = $student_id AND lp_id= $lp_id AND session_id= $session_id ";
-				$result = Database::query($sql_delete);
-                */
-				
+			
 				//@todo delete the stats.track_e_exercices records. First implement this http://support.chamilo.org/issues/1334					
 				Display::display_confirmation_message(get_lang('LPWasReset'));
 			}				
@@ -722,7 +693,7 @@ if ($timezone !== null) {
 			<table class="data_table">
 				<tr>
 					<th><?php echo get_lang('Exercices'); ?></th>
-					<th><?php echo get_lang('Score').Display :: return_icon('info3.gif', get_lang('LastScoreTest'), array('align' => 'absmiddle', 'hspace' => '3px')) ?></th>
+					<th><?php echo get_lang('AverageScore').Display :: return_icon('info3.gif', get_lang('AverageScore'), array('align' => 'absmiddle', 'hspace' => '3px')) ?></th>
 					<th><?php echo get_lang('Attempts'); ?></th>
 					<th><?php echo get_lang('CorrectTest'); ?></th>
 				</tr>
@@ -736,17 +707,16 @@ if ($timezone !== null) {
 		);
 
 		$t_quiz = Database :: get_course_table(TABLE_QUIZ_TEST, $info_course['db_name']);
-		$sql_exercices = "SELECT quiz.title,id
-											FROM " . $t_quiz . " AS quiz
-											WHERE active='1' AND quiz.session_id = $session_id ORDER BY quiz.title ASC
-											";
+		$sql_exercices = "SELECT quiz.title, id FROM " . $t_quiz . " AS quiz
+						  WHERE active='1' AND quiz.session_id = $session_id ORDER BY quiz.title ASC ";
 
 		$result_exercices = Database::query($sql_exercices);
 		$i = 0;
 		if (Database :: num_rows($result_exercices) > 0) {
 			while ($exercices = Database :: fetch_array($result_exercices)) {					
 				$exercise_id = intval($exercices['id']);
-				$count_attempts   = Tracking::count_student_exercise_attempts($student_id, $course_code, $exercise_id,$session_id);
+				
+				$count_attempts   = Tracking::count_student_exercise_attempts($student_id, $course_code, $exercise_id, 0, 0, $session_id);				
 				$score_percentage = Tracking::get_avg_student_exercise_score($student_id, $course_code, $exercise_id, $session_id);                
 
 				$csv_content[] = array (