Minor - change function name replace_urls_inside_content_html_from_copy_course

pull/2487/head
Julio 8 years ago
parent dec484916c
commit 4dde42e1e1
  1. 8
      main/exercise/answer.class.php
  2. 4
      main/exercise/question.class.php
  3. 3
      main/inc/lib/document.lib.php
  4. 58
      src/Chamilo/CourseBundle/Component/CourseCopy/CourseRestorer.php

@ -836,13 +836,13 @@ class Answer
foreach ($temp as $index => $answer) { foreach ($temp as $index => $answer) {
if ($this->course['id'] != $course_info['id']) { if ($this->course['id'] != $course_info['id']) {
// check resources inside html from ckeditor tool and copy correct urls into recipient course // check resources inside html from ckeditor tool and copy correct urls into recipient course
$answer['answer'] = DocumentManager::replace_urls_inside_content_html_from_copy_course( $answer['answer'] = DocumentManager::replaceUrlWithNewCourseCode(
$answer['answer'], $answer['answer'],
$this->course['id'], $this->course['id'],
$course_info['id'] $course_info['id']
); );
$answer['comment'] = DocumentManager::replace_urls_inside_content_html_from_copy_course( $answer['comment'] = DocumentManager::replaceUrlWithNewCourseCode(
$answer['comment'], $answer['comment'],
$this->course['id'], $this->course['id'],
$course_info['id'] $course_info['id']
@ -882,12 +882,12 @@ class Answer
} else { } else {
for ($i = 1; $i <= $this->nbrAnswers; $i++) { for ($i = 1; $i <= $this->nbrAnswers; $i++) {
if ($this->course['id'] != $course_info['id']) { if ($this->course['id'] != $course_info['id']) {
$this->answer[$i] = DocumentManager::replace_urls_inside_content_html_from_copy_course( $this->answer[$i] = DocumentManager::replaceUrlWithNewCourseCode(
$this->answer[$i], $this->answer[$i],
$this->course['id'], $this->course['id'],
$course_info['id'] $course_info['id']
); );
$this->comment[$i] = DocumentManager::replace_urls_inside_content_html_from_copy_course( $this->comment[$i] = DocumentManager::replaceUrlWithNewCourseCode(
$this->comment[$i], $this->comment[$i],
$this->course['id'], $this->course['id'],
$course_info['id'] $course_info['id']

@ -1439,12 +1439,12 @@ abstract class Question
// Using the same method used in the course copy to transform URLs // Using the same method used in the course copy to transform URLs
if ($this->course['id'] != $course_info['id']) { if ($this->course['id'] != $course_info['id']) {
$description = DocumentManager::replace_urls_inside_content_html_from_copy_course( $description = DocumentManager::replaceUrlWithNewCourseCode(
$description, $description,
$this->course['code'], $this->course['code'],
$course_info['id'] $course_info['id']
); );
$question = DocumentManager::replace_urls_inside_content_html_from_copy_course( $question = DocumentManager::replaceUrlWithNewCourseCode(
$question, $question,
$this->course['code'], $this->course['code'],
$course_info['id'] $course_info['id']

@ -2587,7 +2587,7 @@ class DocumentManager
* *
* @return string new content html with replaced urls or return false if content is not a string * @return string new content html with replaced urls or return false if content is not a string
*/ */
public static function replace_urls_inside_content_html_from_copy_course( public static function replaceUrlWithNewCourseCode(
$content_html, $content_html,
$origin_course_code, $origin_course_code,
$destination_course_directory, $destination_course_directory,
@ -2621,7 +2621,6 @@ class DocumentManager
if (!empty($orig_source_html)) { if (!empty($orig_source_html)) {
foreach ($orig_source_html as $source) { foreach ($orig_source_html as $source) {
// Get information about source url // Get information about source url
$real_orig_url = $source[0]; // url $real_orig_url = $source[0]; // url
$scope_url = $source[1]; // scope (local, remote) $scope_url = $source[1]; // scope (local, remote)

@ -548,7 +548,7 @@ class CourseRestorer
if (UTF8_CONVERT) { if (UTF8_CONVERT) {
$content = utf8_encode($content); $content = utf8_encode($content);
} }
$content = DocumentManager::replace_urls_inside_content_html_from_copy_course( $content = DocumentManager::replaceUrlWithNewCourseCode(
$content, $content,
$this->course->code, $this->course->code,
$this->course->destination_path, $this->course->destination_path,
@ -668,7 +668,7 @@ class CourseRestorer
if (UTF8_CONVERT) { if (UTF8_CONVERT) {
$content = utf8_encode($content); $content = utf8_encode($content);
} }
$content = DocumentManager::replace_urls_inside_content_html_from_copy_course( $content = DocumentManager::replaceUrlWithNewCourseCode(
$content, $content,
$this->course->code, $this->course->code,
$this->course->destination_path, $this->course->destination_path,
@ -731,7 +731,7 @@ class CourseRestorer
if (UTF8_CONVERT) { if (UTF8_CONVERT) {
$content = utf8_encode($content); $content = utf8_encode($content);
} }
$content = DocumentManager::replace_urls_inside_content_html_from_copy_course( $content = DocumentManager::replaceUrlWithNewCourseCode(
$content, $content,
$this->course->code, $this->course->code,
$this->course->destination_path, $this->course->destination_path,
@ -797,7 +797,7 @@ class CourseRestorer
if (UTF8_CONVERT) { if (UTF8_CONVERT) {
$content = utf8_encode($content); $content = utf8_encode($content);
} }
$content = DocumentManager::replace_urls_inside_content_html_from_copy_course( $content = DocumentManager::replaceUrlWithNewCourseCode(
$content, $content,
$this->course->code, $this->course->code,
$this->course->destination_path, $this->course->destination_path,
@ -873,7 +873,7 @@ class CourseRestorer
if (UTF8_CONVERT) { if (UTF8_CONVERT) {
$content = utf8_encode($content); $content = utf8_encode($content);
} }
$content = DocumentManager::replace_urls_inside_content_html_from_copy_course( $content = DocumentManager::replaceUrlWithNewCourseCode(
$content, $content,
$this->course->code, $this->course->code,
$this->course->destination_path, $this->course->destination_path,
@ -1076,7 +1076,7 @@ class CourseRestorer
$params['forum_id'] = 0; $params['forum_id'] = 0;
unset($params['iid']); unset($params['iid']);
$params['forum_comment'] = DocumentManager::replace_urls_inside_content_html_from_copy_course( $params['forum_comment'] = DocumentManager::replaceUrlWithNewCourseCode(
$params['forum_comment'], $params['forum_comment'],
$this->course->code, $this->course->code,
$this->course->destination_path, $this->course->destination_path,
@ -1136,7 +1136,7 @@ class CourseRestorer
if ($forum_cat && !$forum_cat->is_restored()) { if ($forum_cat && !$forum_cat->is_restored()) {
$params = (array) $forum_cat->obj; $params = (array) $forum_cat->obj;
$params['c_id'] = $this->destination_course_id; $params['c_id'] = $this->destination_course_id;
$params['cat_comment'] = DocumentManager::replace_urls_inside_content_html_from_copy_course( $params['cat_comment'] = DocumentManager::replaceUrlWithNewCourseCode(
$params['cat_comment'], $params['cat_comment'],
$this->course->code, $this->course->code,
$this->course->destination_path, $this->course->destination_path,
@ -1240,7 +1240,7 @@ class CourseRestorer
$params['post_id'] = 0; $params['post_id'] = 0;
unset($params['iid']); unset($params['iid']);
$params['post_text'] = DocumentManager::replace_urls_inside_content_html_from_copy_course( $params['post_text'] = DocumentManager::replaceUrlWithNewCourseCode(
$params['post_text'], $params['post_text'],
$this->course->code, $this->course->code,
$this->course->destination_path, $this->course->destination_path,
@ -1393,7 +1393,7 @@ class CourseRestorer
id='".self::DBUTF8escapestring($tool_intro->id)."'"; id='".self::DBUTF8escapestring($tool_intro->id)."'";
Database::query($sql); Database::query($sql);
$tool_intro->intro_text = DocumentManager::replace_urls_inside_content_html_from_copy_course( $tool_intro->intro_text = DocumentManager::replaceUrlWithNewCourseCode(
$tool_intro->intro_text, $tool_intro->intro_text,
$this->course->code, $this->course->code,
$this->course->destination_path, $this->course->destination_path,
@ -1432,7 +1432,7 @@ class CourseRestorer
$resources = $this->course->resources; $resources = $this->course->resources;
foreach ($resources[RESOURCE_EVENT] as $id => $event) { foreach ($resources[RESOURCE_EVENT] as $id => $event) {
// check resources inside html from ckeditor tool and copy correct urls into recipient course // check resources inside html from ckeditor tool and copy correct urls into recipient course
$event->content = DocumentManager::replace_urls_inside_content_html_from_copy_course( $event->content = DocumentManager::replaceUrlWithNewCourseCode(
$event->content, $event->content,
$this->course->code, $this->course->code,
$this->course->destination_path, $this->course->destination_path,
@ -1552,7 +1552,7 @@ class CourseRestorer
$title = isset($courseDescription['title']) ? $courseDescription['title'] : ''; $title = isset($courseDescription['title']) ? $courseDescription['title'] : '';
// check resources inside html from ckeditor tool and copy correct urls into recipient course // check resources inside html from ckeditor tool and copy correct urls into recipient course
$description_content = DocumentManager::replace_urls_inside_content_html_from_copy_course( $description_content = DocumentManager::replaceUrlWithNewCourseCode(
$content, $content,
$this->course->code, $this->course->code,
$this->course->destination_path, $this->course->destination_path,
@ -1596,7 +1596,7 @@ class CourseRestorer
$resources = $this->course->resources; $resources = $this->course->resources;
foreach ($resources[RESOURCE_ANNOUNCEMENT] as $id => $announcement) { foreach ($resources[RESOURCE_ANNOUNCEMENT] as $id => $announcement) {
// check resources inside html from ckeditor tool and copy correct urls into recipient course // check resources inside html from ckeditor tool and copy correct urls into recipient course
$announcement->content = DocumentManager::replace_urls_inside_content_html_from_copy_course( $announcement->content = DocumentManager::replaceUrlWithNewCourseCode(
$announcement->content, $announcement->content,
$this->course->code, $this->course->code,
$this->course->destination_path, $this->course->destination_path,
@ -1744,7 +1744,7 @@ class CourseRestorer
if ($id != -1) { if ($id != -1) {
// check resources inside html from ckeditor tool and copy correct urls into recipient course // check resources inside html from ckeditor tool and copy correct urls into recipient course
$quiz->description = DocumentManager::replace_urls_inside_content_html_from_copy_course( $quiz->description = DocumentManager::replaceUrlWithNewCourseCode(
$quiz->description, $quiz->description,
$this->course->code, $this->course->code,
$this->course->destination_path, $this->course->destination_path,
@ -1854,7 +1854,7 @@ class CourseRestorer
$table_options = Database::get_course_table(TABLE_QUIZ_QUESTION_OPTION); $table_options = Database::get_course_table(TABLE_QUIZ_QUESTION_OPTION);
// check resources inside html from ckeditor tool and copy correct urls into recipient course // check resources inside html from ckeditor tool and copy correct urls into recipient course
$question->description = DocumentManager::replace_urls_inside_content_html_from_copy_course( $question->description = DocumentManager::replaceUrlWithNewCourseCode(
$question->description, $question->description,
$this->course->code, $this->course->code,
$this->course->destination_path, $this->course->destination_path,
@ -1909,7 +1909,7 @@ class CourseRestorer
foreach ($temp as $index => $answer) { foreach ($temp as $index => $answer) {
// check resources inside html from ckeditor tool and copy correct urls into recipient course // check resources inside html from ckeditor tool and copy correct urls into recipient course
$answer['answer'] = DocumentManager::replace_urls_inside_content_html_from_copy_course( $answer['answer'] = DocumentManager::replaceUrlWithNewCourseCode(
$answer['answer'], $answer['answer'],
$this->course->code, $this->course->code,
$this->course->destination_path, $this->course->destination_path,
@ -1917,7 +1917,7 @@ class CourseRestorer
$this->course->info['path'] $this->course->info['path']
); );
$answer['comment'] = DocumentManager::replace_urls_inside_content_html_from_copy_course( $answer['comment'] = DocumentManager::replaceUrlWithNewCourseCode(
$answer['comment'], $answer['comment'],
$this->course->code, $this->course->code,
$this->course->destination_path, $this->course->destination_path,
@ -1958,7 +1958,7 @@ class CourseRestorer
} else { } else {
foreach ($question->answers as $index => $answer) { foreach ($question->answers as $index => $answer) {
// check resources inside html from ckeditor tool and copy correct urls into recipient course // check resources inside html from ckeditor tool and copy correct urls into recipient course
$answer['answer'] = DocumentManager::replace_urls_inside_content_html_from_copy_course( $answer['answer'] = DocumentManager::replaceUrlWithNewCourseCode(
$answer['answer'], $answer['answer'],
$this->course->code, $this->course->code,
$this->course->destination_path, $this->course->destination_path,
@ -1966,7 +1966,7 @@ class CourseRestorer
$this->course->info['path'] $this->course->info['path']
); );
$answer['comment'] = DocumentManager::replace_urls_inside_content_html_from_copy_course( $answer['comment'] = DocumentManager::replaceUrlWithNewCourseCode(
$answer['comment'], $answer['comment'],
$this->course->code, $this->course->code,
$this->course->destination_path, $this->course->destination_path,
@ -2228,7 +2228,7 @@ class CourseRestorer
$result_check = Database::query($sql); $result_check = Database::query($sql);
// check resources inside html from ckeditor tool and copy correct urls into recipient course // check resources inside html from ckeditor tool and copy correct urls into recipient course
$survey->title = DocumentManager::replace_urls_inside_content_html_from_copy_course( $survey->title = DocumentManager::replaceUrlWithNewCourseCode(
$survey->title, $survey->title,
$this->course->code, $this->course->code,
$this->course->destination_path, $this->course->destination_path,
@ -2236,7 +2236,7 @@ class CourseRestorer
$this->course->info['path'] $this->course->info['path']
); );
$survey->subtitle = DocumentManager::replace_urls_inside_content_html_from_copy_course( $survey->subtitle = DocumentManager::replaceUrlWithNewCourseCode(
$survey->subtitle, $survey->subtitle,
$this->course->code, $this->course->code,
$this->course->destination_path, $this->course->destination_path,
@ -2244,7 +2244,7 @@ class CourseRestorer
$this->course->info['path'] $this->course->info['path']
); );
$survey->intro = DocumentManager::replace_urls_inside_content_html_from_copy_course( $survey->intro = DocumentManager::replaceUrlWithNewCourseCode(
$survey->intro, $survey->intro,
$this->course->code, $this->course->code,
$this->course->destination_path, $this->course->destination_path,
@ -2252,7 +2252,7 @@ class CourseRestorer
$this->course->info['path'] $this->course->info['path']
); );
$survey->surveythanks = DocumentManager::replace_urls_inside_content_html_from_copy_course( $survey->surveythanks = DocumentManager::replaceUrlWithNewCourseCode(
$survey->surveythanks, $survey->surveythanks,
$this->course->code, $this->course->code,
$this->course->destination_path, $this->course->destination_path,
@ -2422,7 +2422,7 @@ class CourseRestorer
$table_ans = Database::get_course_table(TABLE_SURVEY_QUESTION_OPTION); $table_ans = Database::get_course_table(TABLE_SURVEY_QUESTION_OPTION);
// check resources inside html from ckeditor tool and copy correct urls into recipient course // 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_course( $question->survey_question = DocumentManager::replaceUrlWithNewCourseCode(
$question->survey_question, $question->survey_question,
$this->course->code, $this->course->code,
$this->course->destination_path, $this->course->destination_path,
@ -2451,7 +2451,7 @@ class CourseRestorer
foreach ($question->answers as $index => $answer) { foreach ($question->answers as $index => $answer) {
// check resources inside html from ckeditor tool and copy correct urls into recipient course // 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_course( $answer['option_text'] = DocumentManager::replaceUrlWithNewCourseCode(
$answer['option_text'], $answer['option_text'],
$this->course->code, $this->course->code,
$this->course->destination_path, $this->course->destination_path,
@ -2955,7 +2955,7 @@ class CourseRestorer
} }
// check resources inside html from ckeditor tool and copy correct urls into recipient course // check resources inside html from ckeditor tool and copy correct urls into recipient course
$glossary->description = DocumentManager::replace_urls_inside_content_html_from_copy_course( $glossary->description = DocumentManager::replaceUrlWithNewCourseCode(
$glossary->description, $glossary->description,
$this->course->code, $this->course->code,
$this->course->destination_path, $this->course->destination_path,
@ -3009,7 +3009,7 @@ class CourseRestorer
// the sql statement to insert the groups from the old course to the new course // 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 // check resources inside html from ckeditor tool and copy correct urls into recipient course
$wiki->content = DocumentManager::replace_urls_inside_content_html_from_copy_course( $wiki->content = DocumentManager::replaceUrlWithNewCourseCode(
$wiki->content, $wiki->content,
$this->course->code, $this->course->code,
$this->course->destination_path, $this->course->destination_path,
@ -3092,7 +3092,7 @@ class CourseRestorer
foreach ($resources[RESOURCE_THEMATIC] as $id => $thematic) { foreach ($resources[RESOURCE_THEMATIC] as $id => $thematic) {
// check resources inside html from ckeditor tool and copy correct urls into recipient course // 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_course( $thematic->params['content'] = DocumentManager::replaceUrlWithNewCourseCode(
$thematic->params['content'], $thematic->params['content'],
$this->course->code, $this->course->code,
$this->course->destination_path, $this->course->destination_path,
@ -3183,7 +3183,7 @@ class CourseRestorer
$resources = $this->course->resources; $resources = $this->course->resources;
foreach ($resources[RESOURCE_ATTENDANCE] as $id => $obj) { foreach ($resources[RESOURCE_ATTENDANCE] as $id => $obj) {
// check resources inside html from ckeditor tool and copy correct urls into recipient course // 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_course( $obj->params['description'] = DocumentManager::replaceUrlWithNewCourseCode(
$obj->params['description'], $obj->params['description'],
$this->course->code, $this->course->code,
$this->course->destination_path, $this->course->destination_path,
@ -3243,7 +3243,7 @@ class CourseRestorer
foreach ($resources[RESOURCE_WORK] as $obj) { foreach ($resources[RESOURCE_WORK] as $obj) {
// check resources inside html from ckeditor tool and copy correct urls into recipient course // 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_course( $obj->params['description'] = DocumentManager::replaceUrlWithNewCourseCode(
$obj->params['description'], $obj->params['description'],
$this->course->code, $this->course->code,
$this->course->destination_path, $this->course->destination_path,

Loading…
Cancel
Save