From 838d458375dff335cda5595554c642faeb8da086 Mon Sep 17 00:00:00 2001 From: Julio Montoya Date: Fri, 8 Jun 2012 15:30:53 +0200 Subject: [PATCH] Fixing bug when uploading an scorm package when the learning_path folder doesn't exists see #4841 --- main/newscorm/learnpath.class.php | 13 ++++++++++--- main/newscorm/lp_controller.php | 3 --- main/newscorm/lp_list.php | 2 ++ main/newscorm/lp_upload.php | 2 ++ 4 files changed, 14 insertions(+), 6 deletions(-) diff --git a/main/newscorm/learnpath.class.php b/main/newscorm/learnpath.class.php index a6e315a123..94bf26cd6c 100644 --- a/main/newscorm/learnpath.class.php +++ b/main/newscorm/learnpath.class.php @@ -5271,9 +5271,11 @@ class learnpath { return $return; } - public function generate_lp_folder($course) { - $filepath = ''; - //Creating learning_path folder + /** + * Creates the default learning path folder + */ + public function generate_learning_path_folder($course) { + //Creating learning_path folder $dir = '/learning_path'; $filepath = api_get_path(SYS_COURSE_PATH) . $course['path'] . '/document'; $folder = null; @@ -5282,8 +5284,13 @@ class learnpath { } else { $folder = true; } + return $folder; + } + public function generate_lp_folder($course) { + $filepath = ''; $dir = '/learning_path/'; + $folder = self::generate_learning_path_folder($course); //Creating LP folder if ($folder) { //Limits title size diff --git a/main/newscorm/lp_controller.php b/main/newscorm/lp_controller.php index d4453b0120..9fddcf167e 100644 --- a/main/newscorm/lp_controller.php +++ b/main/newscorm/lp_controller.php @@ -442,9 +442,7 @@ switch ($action) { $_SESSION['refresh'] = 1; require 'lp_view_item.php'; } - break; - case 'upload': if (!$is_allowed_to_edit) { api_not_allowed(true); @@ -489,7 +487,6 @@ switch ($action) { if (!$lp_found) { error_log('New LP - No learnpath given for export_to_pdf', 0); require 'lp_list.php'; } else { $result = $_SESSION['oLP']->scorm_export_to_pdf($_GET['lp_id']); - var_dump($result);exit; if (!$result) { require 'lp_list.php'; } diff --git a/main/newscorm/lp_list.php b/main/newscorm/lp_list.php index 95e414fb7f..b576c3abbc 100644 --- a/main/newscorm/lp_list.php +++ b/main/newscorm/lp_list.php @@ -503,4 +503,6 @@ if (!empty($flat_list)) { echo ''; } } +$course_info = api_get_course_info(); +$result = learnpath::generate_learning_path_folder($course_info); Display::display_footer(); \ No newline at end of file diff --git a/main/newscorm/lp_upload.php b/main/newscorm/lp_upload.php index 01668d840f..be8fb7eb58 100644 --- a/main/newscorm/lp_upload.php +++ b/main/newscorm/lp_upload.php @@ -56,6 +56,8 @@ if ($_SERVER['REQUEST_METHOD'] == 'POST' && count($_FILES) > 0 && !empty($_FILES $maker = Database::escape_string($_REQUEST['content_maker']); } + + switch ($type) { case 'scorm': require_once 'scorm.class.php';