@ -171,7 +171,10 @@ class CourseRestorer
}
}
$sample_text = implode("\n", $sample_text);
$this->course->encoding = api_detect_encoding($sample_text, $course_info['language']);
$this->course->encoding = api_detect_encoding(
$sample_text,
$course_info['language']
);
}
// Encoding conversion of the course, if it is needed.
@ -179,7 +182,11 @@ class CourseRestorer
foreach ($this->tools_to_restore as $tool) {
$function_build = 'restore_'.$tool;
$this->$function_build($session_id, $respect_base_content, $destination_course_code);
$this->$function_build(
$session_id,
$respect_base_content,
$destination_course_code
);
}
if ($update_course_settings) {
@ -253,7 +260,6 @@ class CourseRestorer
$params['visibility'] = $course_info['visibility'];
$params['department_name'] = $course_info['department_name'];
$params['department_url'] = $course_info['department_url'];
$params['category_code'] = $course_info['categoryCode'];
$params['subscribe'] = $course_info['subscribe_allowed'];
$params['unsubscribe'] = $course_info['unsubscribe'];
@ -542,7 +548,7 @@ class CourseRestorer
if (UTF8_CONVERT) {
$content = utf8_encode($content);
}
$content = DocumentManager::replace_urls_inside_content_html_from_copy_cours e(
$content = DocumentManager::replaceUrlWithNewCourseCod e(
$content,
$this->course->code,
$this->course->destination_path,
@ -662,7 +668,7 @@ class CourseRestorer
if (UTF8_CONVERT) {
$content = utf8_encode($content);
}
$content = DocumentManager::replace_urls_inside_content_html_from_copy_cours e(
$content = DocumentManager::replaceUrlWithNewCourseCod e(
$content,
$this->course->code,
$this->course->destination_path,
@ -725,7 +731,7 @@ class CourseRestorer
if (UTF8_CONVERT) {
$content = utf8_encode($content);
}
$content = DocumentManager::replace_urls_inside_content_html_from_copy_cours e(
$content = DocumentManager::replaceUrlWithNewCourseCod e(
$content,
$this->course->code,
$this->course->destination_path,
@ -791,7 +797,7 @@ class CourseRestorer
if (UTF8_CONVERT) {
$content = utf8_encode($content);
}
$content = DocumentManager::replace_urls_inside_content_html_from_copy_cours e(
$content = DocumentManager::replaceUrlWithNewCourseCod e(
$content,
$this->course->code,
$this->course->destination_path,
@ -867,7 +873,7 @@ class CourseRestorer
if (UTF8_CONVERT) {
$content = utf8_encode($content);
}
$content = DocumentManager::replace_urls_inside_content_html_from_copy_cours e(
$content = DocumentManager::replaceUrlWithNewCourseCod e(
$content,
$this->course->code,
$this->course->destination_path,
@ -1070,7 +1076,7 @@ class CourseRestorer
$params['forum_id'] = 0;
unset($params['iid']);
$params['forum_comment'] = DocumentManager::replace_urls_inside_content_html_from_copy_cours e(
$params['forum_comment'] = DocumentManager::replaceUrlWithNewCourseCod e(
$params['forum_comment'],
$this->course->code,
$this->course->destination_path,
@ -1130,7 +1136,7 @@ class CourseRestorer
if ($forum_cat & & !$forum_cat->is_restored()) {
$params = (array) $forum_cat->obj;
$params['c_id'] = $this->destination_course_id;
$params['cat_comment'] = DocumentManager::replace_urls_inside_content_html_from_copy_cours e(
$params['cat_comment'] = DocumentManager::replaceUrlWithNewCourseCod e(
$params['cat_comment'],
$this->course->code,
$this->course->destination_path,
@ -1234,7 +1240,7 @@ class CourseRestorer
$params['post_id'] = 0;
unset($params['iid']);
$params['post_text'] = DocumentManager::replace_urls_inside_content_html_from_copy_cours e(
$params['post_text'] = DocumentManager::replaceUrlWithNewCourseCod e(
$params['post_text'],
$this->course->code,
$this->course->destination_path,
@ -1356,7 +1362,9 @@ class CourseRestorer
$new_id = Database::insert($link_cat_table, $params);
if ($new_id) {
$sql = "UPDATE $link_cat_table SET id = iid WHERE iid = $new_id";
$sql = "UPDATE $link_cat_table
SET id = iid
WHERE iid = $new_id";
Database::query($sql);
api_set_default_visibility($new_id, TOOL_LINK_CATEGORY);
}
@ -1385,7 +1393,7 @@ class CourseRestorer
id='".self::DBUTF8escapestring($tool_intro->id)."'";
Database::query($sql);
$tool_intro->intro_text = DocumentManager::replace_urls_inside_content_html_from_copy_cours e(
$tool_intro->intro_text = DocumentManager::replaceUrlWithNewCourseCod e(
$tool_intro->intro_text,
$this->course->code,
$this->course->destination_path,
@ -1424,7 +1432,7 @@ class CourseRestorer
$resources = $this->course->resources;
foreach ($resources[RESOURCE_EVENT] as $id => $event) {
// check resources inside html from ckeditor tool and copy correct urls into recipient course
$event->content = DocumentManager::replace_urls_inside_content_html_from_copy_cours e(
$event->content = DocumentManager::replaceUrlWithNewCourseCod e(
$event->content,
$this->course->code,
$this->course->destination_path,
@ -1544,7 +1552,7 @@ class CourseRestorer
$title = isset($courseDescription['title']) ? $courseDescription['title'] : '';
// check resources inside html from ckeditor tool and copy correct urls into recipient course
$description_content = DocumentManager::replace_urls_inside_content_html_from_copy_cours e(
$description_content = DocumentManager::replaceUrlWithNewCourseCod e(
$content,
$this->course->code,
$this->course->destination_path,
@ -1588,7 +1596,7 @@ class CourseRestorer
$resources = $this->course->resources;
foreach ($resources[RESOURCE_ANNOUNCEMENT] as $id => $announcement) {
// check resources inside html from ckeditor tool and copy correct urls into recipient course
$announcement->content = DocumentManager::replace_urls_inside_content_html_from_copy_cours e(
$announcement->content = DocumentManager::replaceUrlWithNewCourseCod e(
$announcement->content,
$this->course->code,
$this->course->destination_path,
@ -1736,7 +1744,7 @@ class CourseRestorer
if ($id != -1) {
// check resources inside html from ckeditor tool and copy correct urls into recipient course
$quiz->description = DocumentManager::replace_urls_inside_content_html_from_copy_cours e(
$quiz->description = DocumentManager::replaceUrlWithNewCourseCod e(
$quiz->description,
$this->course->code,
$this->course->destination_path,
@ -1846,7 +1854,7 @@ class CourseRestorer
$table_options = Database::get_course_table(TABLE_QUIZ_QUESTION_OPTION);
// check resources inside html from ckeditor tool and copy correct urls into recipient course
$question->description = DocumentManager::replace_urls_inside_content_html_from_copy_cours e(
$question->description = DocumentManager::replaceUrlWithNewCourseCod e(
$question->description,
$this->course->code,
$this->course->destination_path,
@ -1901,7 +1909,7 @@ class CourseRestorer
foreach ($temp as $index => $answer) {
// check resources inside html from ckeditor tool and copy correct urls into recipient course
$answer['answer'] = DocumentManager::replace_urls_inside_content_html_from_copy_cours e(
$answer['answer'] = DocumentManager::replaceUrlWithNewCourseCod e(
$answer['answer'],
$this->course->code,
$this->course->destination_path,
@ -1909,7 +1917,7 @@ class CourseRestorer
$this->course->info['path']
);
$answer['comment'] = DocumentManager::replace_urls_inside_content_html_from_copy_cours e(
$answer['comment'] = DocumentManager::replaceUrlWithNewCourseCod e(
$answer['comment'],
$this->course->code,
$this->course->destination_path,
@ -1950,7 +1958,7 @@ class CourseRestorer
} else {
foreach ($question->answers as $index => $answer) {
// check resources inside html from ckeditor tool and copy correct urls into recipient course
$answer['answer'] = DocumentManager::replace_urls_inside_content_html_from_copy_cours e(
$answer['answer'] = DocumentManager::replaceUrlWithNewCourseCod e(
$answer['answer'],
$this->course->code,
$this->course->destination_path,
@ -1958,7 +1966,7 @@ class CourseRestorer
$this->course->info['path']
);
$answer['comment'] = DocumentManager::replace_urls_inside_content_html_from_copy_cours e(
$answer['comment'] = DocumentManager::replaceUrlWithNewCourseCod e(
$answer['comment'],
$this->course->code,
$this->course->destination_path,
@ -2220,7 +2228,7 @@ class CourseRestorer
$result_check = Database::query($sql);
// check resources inside html from ckeditor tool and copy correct urls into recipient course
$survey->title = DocumentManager::replace_urls_inside_content_html_from_copy_cours e(
$survey->title = DocumentManager::replaceUrlWithNewCourseCod e(
$survey->title,
$this->course->code,
$this->course->destination_path,
@ -2228,7 +2236,7 @@ class CourseRestorer
$this->course->info['path']
);
$survey->subtitle = DocumentManager::replace_urls_inside_content_html_from_copy_cours e(
$survey->subtitle = DocumentManager::replaceUrlWithNewCourseCod e(
$survey->subtitle,
$this->course->code,
$this->course->destination_path,
@ -2236,7 +2244,7 @@ class CourseRestorer
$this->course->info['path']
);
$survey->intro = DocumentManager::replace_urls_inside_content_html_from_copy_cours e(
$survey->intro = DocumentManager::replaceUrlWithNewCourseCod e(
$survey->intro,
$this->course->code,
$this->course->destination_path,
@ -2244,7 +2252,7 @@ class CourseRestorer
$this->course->info['path']
);
$survey->surveythanks = DocumentManager::replace_urls_inside_content_html_from_copy_cours e(
$survey->surveythanks = DocumentManager::replaceUrlWithNewCourseCod e(
$survey->surveythanks,
$this->course->code,
$this->course->destination_path,
@ -2414,7 +2422,7 @@ class CourseRestorer
$table_ans = Database::get_course_table(TABLE_SURVEY_QUESTION_OPTION);
// check resources inside html from ckeditor tool and copy correct urls into recipient course
$question->survey_question = DocumentManager::replace_urls_inside_content_html_from_copy_cours e(
$question->survey_question = DocumentManager::replaceUrlWithNewCourseCod e(
$question->survey_question,
$this->course->code,
$this->course->destination_path,
@ -2443,7 +2451,7 @@ class CourseRestorer
foreach ($question->answers as $index => $answer) {
// check resources inside html from ckeditor tool and copy correct urls into recipient course
$answer['option_text'] = DocumentManager::replace_urls_inside_content_html_from_copy_cours e(
$answer['option_text'] = DocumentManager::replaceUrlWithNewCourseCod e(
$answer['option_text'],
$this->course->code,
$this->course->destination_path,
@ -2947,7 +2955,7 @@ class CourseRestorer
}
// check resources inside html from ckeditor tool and copy correct urls into recipient course
$glossary->description = DocumentManager::replace_urls_inside_content_html_from_copy_cours e(
$glossary->description = DocumentManager::replaceUrlWithNewCourseCod e(
$glossary->description,
$this->course->code,
$this->course->destination_path,
@ -3001,7 +3009,7 @@ class CourseRestorer
// the sql statement to insert the groups from the old course to the new course
// check resources inside html from ckeditor tool and copy correct urls into recipient course
$wiki->content = DocumentManager::replace_urls_inside_content_html_from_copy_cours e(
$wiki->content = DocumentManager::replaceUrlWithNewCourseCod e(
$wiki->content,
$this->course->code,
$this->course->destination_path,
@ -3084,7 +3092,7 @@ class CourseRestorer
foreach ($resources[RESOURCE_THEMATIC] as $id => $thematic) {
// check resources inside html from ckeditor tool and copy correct urls into recipient course
$thematic->params['content'] = DocumentManager::replace_urls_inside_content_html_from_copy_cours e(
$thematic->params['content'] = DocumentManager::replaceUrlWithNewCourseCod e(
$thematic->params['content'],
$this->course->code,
$this->course->destination_path,
@ -3175,7 +3183,7 @@ class CourseRestorer
$resources = $this->course->resources;
foreach ($resources[RESOURCE_ATTENDANCE] as $id => $obj) {
// check resources inside html from ckeditor tool and copy correct urls into recipient course
$obj->params['description'] = DocumentManager::replace_urls_inside_content_html_from_copy_cours e(
$obj->params['description'] = DocumentManager::replaceUrlWithNewCourseCod e(
$obj->params['description'],
$this->course->code,
$this->course->destination_path,
@ -3235,7 +3243,7 @@ class CourseRestorer
foreach ($resources[RESOURCE_WORK] as $obj) {
// check resources inside html from ckeditor tool and copy correct urls into recipient course
$obj->params['description'] = DocumentManager::replace_urls_inside_content_html_from_copy_cours e(
$obj->params['description'] = DocumentManager::replaceUrlWithNewCourseCod e(
$obj->params['description'],
$this->course->code,
$this->course->destination_path,