Browse Source

two bugfixes for course copy of wiki pages

Patrick Cool 15 years ago
parent
commit
f76ab2f652

+ 8 - 0
main/coursecopy/classes/CourseRestorer.class.php

@@ -1432,6 +1432,7 @@ class CourseRestorer
 		{
 			// wiki table of the target course
 			$table_wiki = Database :: get_course_table('wiki', $this->course->destination_db);
+			$table_wiki_conf 	= Database :: get_course_table('wiki_conf', $this->course->destination_db);
 
 			// storing all the resources that have to be copied in an array
 			$resources = $this->course->resources;
@@ -1452,6 +1453,13 @@ class CourseRestorer
 				$result = Database::query($sql, __FILE__, __LINE__);
 				$new_id = Database::insert_id();
 				$this->course->resources[RESOURCE_WIKI][$id]->destination_id = $new_id;
+				
+				// we also add an entry in wiki_conf
+				$sql = "INSERT INTO $table_wiki_conf 
+						(page_id, task, feedback1, feedback2, feedback3, fprogress1, fprogress2, fprogress3, max_size, max_text, max_version, startdate_assig, enddate_assig, delayedsubmit) 
+						VALUES
+						('".Database::escape_string($wiki->page_id)."', '', '', '', '', '', '', '', NULL, 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0)";
+				$result = Database::query($sql, __FILE__, __LINE__);						
 			}
 		}
 	}	

+ 1 - 2
main/coursecopy/classes/wiki.class.php

@@ -21,14 +21,13 @@ class Wiki extends Resource
 	function Wiki($id, $reflink, $title, $content, $user_id, $group_id, $timestamp, $template, $menu)
 	{
 		parent::Resource($id,RESOURCE_WIKI);
+		$this->page_id					= $id;
 		$this->reflink 					= $reflink;
 		$this->title 					= $title;
 		$this->content					= $content;
 		$this->user_id					= $user_id;
 		$this->group_id					= $group_id;
 		$this->dtime					= $timestamp;
-		$this->template					= $template;
-		$this->menu						= $menu;
 	}
 
 	function show()