Browse Source

[svn r11369] Added hotspot_ fields to answer table backup/restore code

Yannick Warnier 18 years ago
parent
commit
61544ab0b8

+ 2 - 2
main/coursecopy/classes/CourseBuilder.class.php

@@ -1,4 +1,4 @@
-<?php // $Id: CourseBuilder.class.php 11368 2007-03-03 13:02:29Z yannoo $
+<?php // $Id: CourseBuilder.class.php 11369 2007-03-03 18:41:11Z yannoo $
 /*
 ==============================================================================
 	Dokeos - elearning and course management software
@@ -278,7 +278,7 @@ class CourseBuilder
 			$db_result2 = api_sql_query($sql, __FILE__, __LINE__);
 			while ($obj2 = Database::fetch_object($db_result2))
 			{
-				$question->add_answer($obj2->answer, $obj2->correct, $obj2->comment, $obj2->ponderation, $obj2->position);
+				$question->add_answer($obj2->answer, $obj2->correct, $obj2->comment, $obj2->ponderation, $obj2->position, $obj2->hotspot_coordinates, $obj2->hotspot_type);
 			}
 			$this->course->add_resource($question);
 		}

+ 3 - 2
main/coursecopy/classes/CourseRestorer.class.php

@@ -1,7 +1,7 @@
 <?php
 
 
-// $Id: CourseRestorer.class.php 11362 2007-03-03 10:14:21Z yannoo $
+// $Id: CourseRestorer.class.php 11369 2007-03-03 18:41:11Z yannoo $
 /*
 ==============================================================================
 	Dokeos - elearning and course management software
@@ -248,6 +248,7 @@ class CourseRestorer
 
 	/**
 	 * Restore scorm documents
+	 * TODO @TODO check that the restore function with renaming doesn't break the scorm structure!
 	 */
 	function restore_scorm_documents()
 	{
@@ -603,7 +604,7 @@ class CourseRestorer
 			$new_id = Database::get_last_insert_id();
 			foreach ($question->answers as $index => $answer)
 			{
-				$sql = "INSERT INTO ".$table_ans." SET id= '". ($index +1)."',question_id = '".$new_id."', answer = '".Database::escape_string($answer['answer'])."', correct = '".$answer['correct']."', comment = '".Database::escape_string($answer['comment'])."', ponderation='".$answer['ponderation']."', position = '".$answer['position']."'";
+				$sql = "INSERT INTO ".$table_ans." SET id= '". ($index +1)."',question_id = '".$new_id."', answer = '".Database::escape_string($answer['answer'])."', correct = '".$answer['correct']."', comment = '".Database::escape_string($answer['comment'])."', ponderation='".$answer['ponderation']."', position = '".$answer['position']."', hotspot_coordinates = '".$answer['hotspot_coordinates']."', hotspot_type = '".$answer['hotspot_type']."'";
 				api_sql_query($sql, __FILE__, __LINE__);
 			}
 			$this->course->resources[RESOURCE_QUIZQUESTION][$id]->destination_id = $new_id;

+ 4 - 2
main/coursecopy/classes/QuizQuestion.class.php

@@ -1,4 +1,4 @@
-<?php // $Id: QuizQuestion.class.php 3935 2005-03-28 16:45:23Z yannoo $
+<?php // $Id: QuizQuestion.class.php 11369 2007-03-03 18:41:11Z yannoo $
 /*
 ============================================================================== 
 	Dokeos - elearning and course management software
@@ -75,7 +75,7 @@ class QuizQuestion extends Resource
 	/**
 	 * Add an answer to this QuizQuestion
 	 */
-	function add_answer($answer_text,$correct,$comment,$ponderation,$position)
+	function add_answer($answer_text,$correct,$comment,$ponderation,$position,$hotspot_coordinates,$hotspot_type)
 	{
 		$answer = array();
 		$answer['answer'] = $answer_text;
@@ -83,6 +83,8 @@ class QuizQuestion extends Resource
 		$answer['comment'] = $comment;
 		$answer['ponderation'] = $ponderation;
 		$answer['position'] = $position;
+		$answer['hotspot_coordinates'] = $hotspot_coordinates;
+		$answer['hotspot_type'] = $hotspot_type;
 		$this->answers[] = $answer;
 	}
 	/**