Quellcode durchsuchen

[svn r10237] hotspot fixes --> fixed, only language file prob

Luk Vanlanduyt vor 18 Jahren
Ursprung
Commit
a447a70c69

+ 2 - 2
main/exercice/answer.class.php

@@ -1,4 +1,4 @@
-<?php // $Id: answer.class.php 10197 2006-11-26 18:45:33Z pcool $
+<?php // $Id: answer.class.php 10237 2006-11-28 14:54:07Z develop-it $
 /*
 ============================================================================== 
 	Dokeos - elearning and course management software
@@ -364,7 +364,7 @@ $this->hotspot_coordinates[$i]=$object->hotspot_coordinates;
 		$this->new_nbrAnswers++;
 
 		$id=$this->new_nbrAnswers;
-
+		
 		$this->new_answer[$id]=$answer;
 		$this->new_correct[$id]=$correct;
 		$this->new_comment[$id]=$comment;

+ 3 - 3
main/exercice/answer_admin.inc.php

@@ -1,4 +1,4 @@
-<?php // $Id: answer_admin.inc.php 10110 2006-11-22 15:20:46Z develop-it $
+<?php // $Id: answer_admin.inc.php 10237 2006-11-28 14:54:07Z develop-it $
 /*
 ==============================================================================
 	Dokeos - elearning and course management software
@@ -579,9 +579,9 @@ if($submitAnswers || $buttonBack)
 					{
 						$questionWeighting+=$weighting[$i];
 					}
-		
+					
 					// creates answer
-					$objAnswer->createAnswer($reponse[$i],'',$comment[$i],$weighting[$i],$i,$hotspot_coordinates[$i],$hotspot_type[$i]);
+					$objAnswer->createAnswer($reponse[$i], '',$comment[$i],$weighting[$i],$i,$hotspot_coordinates[$i],$hotspot_type[$i]);
 		        }  // end for()
 				// saves the answers into the data base
 				$objAnswer->save();

+ 32 - 4
main/exercice/exercise_result.php

@@ -1,4 +1,4 @@
-<?php // $Id: exercise_result.php 10234 2006-11-28 13:43:34Z develop-it $
+<?php // $Id: exercise_result.php 10237 2006-11-28 14:54:07Z develop-it $
 /*
 ============================================================================== 
 	Dokeos - elearning and course management software
@@ -214,8 +214,8 @@ function display_free_answer($answer)
 
 function display_hotspot_answer($answerId, $answer, $studentChoice, $answerComment)
 {
-	//global $hotspot_colors;
-	$hotspot_colors = array("", // $i starts from 1 on next loop (ugly fix)
+	global $hotspot_colors;
+	$lhotspot_colors = array("", // $i starts from 1 on next loop (ugly fix)
             						"#4271B5",
 									"#FE8E16",
 									"#3B3B3B",
@@ -569,6 +569,31 @@ $exerciseTitle=api_parse_tex($exerciseTitle);
 										{
 											$matching[$answerId]=$answer;
 										}
+										break;
+				// for hotspot with no order
+				case HOT_SPOT :			$studentChoice=$choice[$answerId];
+
+										if($studentChoice)
+										{
+											$questionScore+=$answerWeighting;
+											$totalScore+=$answerWeighting;
+										}
+
+										break;
+				// for hotspot with fixed order
+				case HOT_SPOT_ORDER :	$studentChoice=$choice['order'][$answerId];
+
+										if($studentChoice == $answerId)
+										{
+											$questionScore+=$answerWeighting;
+											$totalScore+=$answerWeighting;
+											$studentChoice = true;
+										}
+										else
+										{
+											$studentChoice = false;
+										}
+
 										break;
 			} // end switch Answertype
 
@@ -602,9 +627,12 @@ $exerciseTitle=api_parse_tex($exerciseTitle);
 				}
 				elseif($answerType == HOT_SPOT)
 				{
-					echo $answerId . ':' . $answer . ':' . $studentChoice . ':' . $answerComment;
 					display_hotspot_answer($answerId, $answer, $studentChoice, $answerComment);
 				}
+				elseif($answerType == HOT_SPOT_ORDER)
+				{
+					display_hotspot_order_answer($answerId, $answer, $studentChoice, $answerComment);
+				}
 				else
 				{
 					?>					

+ 1 - 1
main/plugin/hotspot/hotspot.js

@@ -12,7 +12,7 @@ function validateFlashVar(counter, lang_1, lang_2)
 	
 	if(counter == flashVar)
 	{
-		//alert (lang_1 + counter + lang_2);
+		alert (lang_1 + counter + lang_2);
 		alert(lang_1);
 		return false;
 	}