diff --git a/main/lp/learnpath.class.php b/main/lp/learnpath.class.php index 7e914a02af..278df7beae 100755 --- a/main/lp/learnpath.class.php +++ b/main/lp/learnpath.class.php @@ -2423,10 +2423,10 @@ class learnpath } // @todo remove this query and load the row info as a parameter - $tbl_learnpath = Database::get_course_table(TABLE_LP_MAIN); + $table = Database::get_course_table(TABLE_LP_MAIN); // Get current prerequisite $sql = "SELECT id, prerequisite, subscribe_users, publicated_on, expired_on - FROM $tbl_learnpath + FROM $table WHERE iid = $lp_id"; $rs = Database::query($sql); $now = time(); @@ -13031,6 +13031,42 @@ EOD; } } + $courseInfo = api_get_course_info(); + foreach ($itemList['document'] as $documentId) { + $documentInfo = DocumentManager::get_document_data_by_id($documentId, api_get_course_id()); + $items = DocumentManager::get_resources_from_source_html( + $documentInfo['absolute_path'], + true, + TOOL_DOCUMENT + ); + + if (!empty($items)) { + foreach ($items as $item) { + // Get information about source url + $url = $item[0]; // url + $scope = $item[1]; // scope (local, remote) + $type = $item[2]; // type (rel, abs, url) + + $origParseUrl = parse_url($url); + $realOrigPath = isset($origParseUrl['path']) ? $origParseUrl['path'] : null; + + if ($scope == 'local') { + if ($type == 'abs' || $type == 'rel') { + $documentFile = strstr($realOrigPath, 'document'); + if (strpos($realOrigPath, $documentFile) !== false) { + $documentFile = str_replace('document', '', $documentFile); + $itemDocumentId = DocumentManager::get_document_id($courseInfo, $documentFile); + // Document found! Add it to the list + if ($itemDocumentId) { + $itemList['document'][] = $itemDocumentId; + } + } + } + } + } + } + } + $courseBuilder->build_documents( api_get_session_id(), $this->get_course_int_id(), diff --git a/main/lp/learnpathItem.class.php b/main/lp/learnpathItem.class.php index d5460354af..5a606f4824 100755 --- a/main/lp/learnpathItem.class.php +++ b/main/lp/learnpathItem.class.php @@ -1046,17 +1046,15 @@ class learnpathItem if ($recursivity > $max) { return []; } - if (!isset($type)) { - $type = $this->get_type(); - } + + $type = empty($type) ? $this->get_type() : $type; + if (!isset($abs_path)) { $path = $this->get_file_path(); $abs_path = api_get_path(SYS_COURSE_PATH).api_get_course_path().'/'.$path; } $files_list = []; - $type = $this->get_type(); - switch ($type) { case TOOL_DOCUMENT: case TOOL_QUIZ: diff --git a/main/lp/lp_controller.php b/main/lp/lp_controller.php index 3fd645907f..bcef81dadd 100755 --- a/main/lp/lp_controller.php +++ b/main/lp/lp_controller.php @@ -860,10 +860,6 @@ switch ($action) { } break; case 'export_to_course_build': - if (!learnpath::is_lp_visible_for_student($_SESSION['oLP']->lp_id, api_get_user_id())) { - api_not_allowed(); - } - if (api_is_allowed_to_edit()) { if (!$lp_found) { require 'lp_list.php'; diff --git a/src/Chamilo/CoreBundle/Component/Editor/CkEditor/CkEditor.php b/src/Chamilo/CoreBundle/Component/Editor/CkEditor/CkEditor.php index d4d0f4e9e8..c38b0ec575 100644 --- a/src/Chamilo/CoreBundle/Component/Editor/CkEditor/CkEditor.php +++ b/src/Chamilo/CoreBundle/Component/Editor/CkEditor/CkEditor.php @@ -97,6 +97,8 @@ class CkEditor extends Editor /** * @param array $templates + * + * @return string */ public function formatTemplates($templates) { diff --git a/src/Chamilo/CourseBundle/Component/CourseCopy/CourseRestorer.php b/src/Chamilo/CourseBundle/Component/CourseCopy/CourseRestorer.php index d1669a67f6..834c565782 100644 --- a/src/Chamilo/CourseBundle/Component/CourseCopy/CourseRestorer.php +++ b/src/Chamilo/CourseBundle/Component/CourseCopy/CourseRestorer.php @@ -2799,7 +2799,7 @@ class CourseRestorer // if is an sco $old_prerequisite[$new_item_id] = $item['prerequisite']; } else { - $old_prerequisite[$new_item_id] = $new_item_ids[$item['prerequisite']]; + $old_prerequisite[$new_item_id] = isset($new_item_ids[$item['prerequisite']]) ? $new_item_ids[$item['prerequisite']] : ''; } }