Browse Source

[svn r20141] logic changes - added link breadcrumb and fixed bug in log of exercice - (partial FS#3909)

Isaac Flores 16 years ago
parent
commit
7a12e50fb3
2 changed files with 35 additions and 22 deletions
  1. 16 13
      main/exercice/exercice.php
  2. 19 9
      main/exercice/exercice_history.php

+ 16 - 13
main/exercice/exercice.php

@@ -1,5 +1,5 @@
 <?php
-// $Id: exercice.php 20131 2009-04-27 17:59:35Z cvargas1 $
+// $Id: exercice.php 20141 2009-04-27 23:04:08Z iflorespaz $
 
 /*
 ==============================================================================
@@ -160,7 +160,7 @@ if ($show == 'result' && $_REQUEST['comments'] == 'update' && ($is_allowedToEdit
 	$TBL_RECORDING = Database :: get_statistic_table('track_e_attempt_recording');
 	$total_weighting = $_REQUEST['totalWeighting'];
 	
-		$my_post_info=array(); 
+	$my_post_info=array(); 
 	$post_content_id=array();
 	$comments_exist=false;
 	foreach ($_POST as $key_index=>$key_value) {
@@ -170,23 +170,26 @@ if ($show == 'result' && $_REQUEST['comments'] == 'update' && ($is_allowedToEdit
 			$comments_exist=true;
 		}
 	}
-	//var_dump($comments_exist);
+
 	$loop_in_track=($comments_exist===true) ? (count($_POST)/2) : count($_POST);
-	//var_dump($loop_in_track);
-	$k=$post_content_id[0];
-	for ($i=$k;$i<($loop_in_track+$k);$i++) {
-		
-		//echo $_POST['marks_'.$i].' y '.$_POST['comments_'.$i].'<br/>';
+	$array_content_id_exe=array();
+	if ($comments_exist===true) {
+		$array_content_id_exe=array_slice($post_content_id,$loop_in_track);
+	} else {
+		$array_content_id_exe=$post_content_id;
+	}
+
+	for ($i=0;$i<$loop_in_track;$i++) {
 		
-		$my_marks=$_POST['marks_'.$i];
-		$contain_comments=$_POST['comments_'.$i];
+		$my_marks=$_POST['marks_'.$array_content_id_exe[$i]];
+		$contain_comments=$_POST['comments_'.$array_content_id_exe[$i]];
 		
 		if (isset($contain_comments)) {
-			$my_comments=$_POST['comments_'.$i];
+			$my_comments=$_POST['comments_'.$array_content_id_exe[$i]];
 		} else {
 			$my_comments='';
 		}
-			$my_questionid=$i;
+			$my_questionid=$array_content_id_exe[$i];
 			$sql = "SELECT question from $TBL_QUESTIONS WHERE id = '$my_questionid'";
 			$result =api_sql_query($sql, __FILE__, __LINE__);
 			$ques_name = Database::result($result,0,"question");
@@ -221,7 +224,7 @@ if ($show == 'result' && $_REQUEST['comments'] == 'update' && ($is_allowedToEdit
 			
 	}
 	$post_content_id=array();
-	
+	$array_content_id_exe=array();
 	/*foreach ($_POST as $key => $v) {
 		$keyexp = explode('_', $key);
 

+ 19 - 9
main/exercice/exercice_history.php

@@ -60,23 +60,34 @@ if(!$is_allowedToEdit){
 	exit;
 }
 
+$interbreadcrumb[]= array (
+	'url' => 'exercice.php'.'?show=result',
+	'name' => get_lang('Exercices')
+);
+$interbreadcrumb[]= array (
+	'url' => 'exercice.php'.'?show=result&amp;filter=2',
+	'name' => get_lang('StudentScore')
+);
+$interbreadcrumb[]= array (
+	'url' => 'exercice_history.php'.'?exe_id='.Security::remove_XSS($_GET['exe_id']),
+	'name' => get_lang('Details')
+);
+
 $TBL_USER          	    = Database::get_main_table(TABLE_MAIN_USER);
 $TBL_EXERCICES			= Database::get_course_table(TABLE_QUIZ_TEST);
 $TBL_EXERCICES_QUESTION	= Database::get_course_table(TABLE_QUIZ_QUESTION);
 $TBL_TRACK_EXERCICES	= Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_EXERCICES);
 $TBL_TRACK_ATTEMPT_RECORDING= Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_ATTEMPT_RECORDING);
 //$nameTools=get_lang('Exercices');
-	Display::display_header($nameTools,"Exercise");
-	if(isset($_GET['message']))
-	{
-		if (in_array($_GET['message'], array('ExerciseEdited')))
-		{
-			Display::display_confirmation_message(get_lang($_GET['message']));
+Display::display_header($nameTools,"Exercise");
+
+	if(isset($_GET['message'])) {
+		if (in_array($_GET['message'], array('ExerciseEdited'))) {
+			$my_message_history=Security::remove_XSS($_GET['message']);
+			Display::display_confirmation_message(get_lang($my_message_history));
 		}
 	}
 
-
-
 //include_once(api_get_path(LIBRARY_PATH).'events.lib.inc.php');
 
 //event_access_tool(TOOL_QUIZ);
@@ -100,7 +111,6 @@ $TBL_TRACK_ATTEMPT_RECORDING= Database::get_statistic_table(TABLE_STATISTIC_TRAC
 $sql = 'SELECT * FROM '.$TBL_EXERCICES;
 $query = api_sql_query($sql,__FILE__,__LINE__);
 */
-
 $sql = "SELECT *, quiz_question.question, CONCAT(firstname,' ',lastname) as full_name FROM $TBL_TRACK_ATTEMPT_RECORDING t,$TBL_USER,$TBL_EXERCICES_QUESTION quiz_question WHERE quiz_question.id = question_id AND user_id = author AND exe_id = '".(int)$_GET['exe_id']."' ORDER BY t.insert_date desc,question ASC";
 $query = api_sql_query($sql,__FILE__,__LINE__);
 while($row = Database::fetch_array($query)){