瀏覽代碼

Fix PHP warnings.

Julio Montoya 10 年之前
父節點
當前提交
9d72c0526f

文件差異過大導致無法顯示
+ 423 - 187
main/coursecopy/classes/CourseBuilder.class.php


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

@@ -888,10 +888,17 @@ class CourseRestorer
 			$resources = $this->course->resources;
 			foreach ($resources[RESOURCE_FORUM] as $id => $forum) {
                 $params = (array)$forum->obj;
-                if ($this->course->resources[RESOURCE_FORUMCATEGORY][$params['forum_category']]->destination_id == -1) {
-                    $cat_id = $this->restore_forum_category($params['forum_category'], $sessionId);
-                } else {
-                    $cat_id = $this->course->resources[RESOURCE_FORUMCATEGORY][$params['forum_category']]->destination_id;
+                $cat_id = '';
+                if (isset($this->course->resources[RESOURCE_FORUMCATEGORY]) &&
+                    isset($this->course->resources[RESOURCE_FORUMCATEGORY][$params['forum_category']])) {
+                    if ($this->course->resources[RESOURCE_FORUMCATEGORY][$params['forum_category']]->destination_id == -1) {
+                        $cat_id = $this->restore_forum_category(
+                            $params['forum_category'],
+                            $sessionId
+                        );
+                    } else {
+                        $cat_id = $this->course->resources[RESOURCE_FORUMCATEGORY][$params['forum_category']]->destination_id;
+                    }
                 }
 
                 $params = self::DBUTF8_array($params);
@@ -1861,12 +1868,15 @@ class CourseRestorer
 							// Delete the existing survey with the same code and language and import the one of the source course
 							// getting the information of the survey (used for when the survey is shared)
 
-							$sql_select_existing_survey = "SELECT * FROM $table_sur WHERE c_id = ".$this->destination_course_id." AND survey_id='".self::DBUTF8escapestring(Database::result($result_check,0,0))."'";
-							$result = Database::query($sql_select_existing_survey);
+							$sql = "SELECT * FROM $table_sur
+							        WHERE
+							            c_id = ".$this->destination_course_id." AND
+							            survey_id='".self::DBUTF8escapestring(Database::result($result_check,0,0))."'";
+							$result = Database::query($sql);
 							$survey_data = Database::fetch_array($result,'ASSOC');
 
 							// if the survey is shared => also delete the shared content
-							if (is_numeric($survey_data['survey_share'])) {
+							if (isset($survey_data['survey_share']) && is_numeric($survey_data['survey_share'])) {
 								survey_manager::delete_survey($survey_data['survey_share'], true,$this->destination_course_id);
 							}
 							$return = survey_manager :: delete_survey($survey_data['survey_id'],false,$this->destination_course_id);
@@ -2158,7 +2168,7 @@ class CourseRestorer
 							"prerequisite = '".		self::DBUTF8escapestring($item['prerequisite'])."', " .
 							"parameters='".			self::DBUTF8escapestring($item['parameters'])."', " .
 							"audio='".				self::DBUTF8escapestring($item['audio'])."', " .
-							"launch_data = '".		self::DBUTF8escapestring($item['launch_dataprereq_type'])."'";
+							"launch_data = '".		self::DBUTF8escapestring($item['launch_data'])."'";
 
 					Database::query($sql);
 

+ 7 - 1
main/coursecopy/classes/DummyCourseCreator.class.php

@@ -154,7 +154,13 @@ class DummyCourseCreator
 			$year = intval(date('Y'));
 			$time = mktime($hour,$minute,$second,$month,$day,$year);
 			$end_date = date('Y-m-d H:m:s', $time);
-			$event = new Event($i, $this->get_dummy_content('title'), $this->get_dummy_content('text'), $start_date, $end_date);
+			$event = new CalendarEvent(
+				$i,
+				$this->get_dummy_content('title'),
+				$this->get_dummy_content('text'),
+				$start_date,
+				$end_date
+			);
 			$event->item_properties[] = $property;
 			$this->course->add_resource($event);
 		}

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

@@ -8,7 +8,7 @@ require_once 'Resource.class.php';
  * @author Bart Mollet <bart.mollet@hogent.be>
  * @package chamilo.backup
  */
-class Event extends Resource
+class CalendarEvent extends Resource
 {
 	/**
 	 * The title
@@ -55,7 +55,8 @@ class Event extends Resource
 	 * @param string $hour
 	 * @param int $duration
 	 */
-	function Event($id, $title, $content, $start_date, $end_date, $attachment_path = null, $attachment_filename= null, $attachment_size= null, $attachment_comment= null, $all_day = 0) {
+	function CalendarEvent($id, $title, $content, $start_date, $end_date, $attachment_path = null, $attachment_filename= null, $attachment_size= null, $attachment_comment= null, $all_day = 0)
+	{
 		parent::Resource($id,RESOURCE_EVENT);
 
 		$this->title 				= $title;

+ 1 - 1
main/coursecopy/import_backup.php

@@ -157,7 +157,7 @@ if (Security::check_token('post') && (
         'post',
         api_get_path(WEB_CODE_PATH) . 'coursecopy/import_backup.php?' . api_get_cidreq(),
         '',
-        'multipart/form-data'
+        array('enctype' => 'multipart/form-data')
     );
     $form->addElement('header', get_lang('SelectBackupFile'));
     $renderer = $form->defaultRenderer();

部分文件因文件數量過多而無法顯示