diff --git a/main/document/document.php b/main/document/document.php index 1247cafdda..f684f80ebd 100755 --- a/main/document/document.php +++ b/main/document/document.php @@ -355,6 +355,9 @@ for ($i = 0; $i < $array_len; $i++) { if( $i == $array_len - 1 && !isset($_GET['createdir']) ) { $url_dir = '#'; } + if ($url_to_who == 'learning_path') { + $url_to_who = get_lang('LearningPaths'); + } $interbreadcrumb[] = array('url' => $url_dir, 'name' => $url_to_who); } //does not repeat the name group in the url @@ -1182,6 +1185,7 @@ $table->display(); if (count($docs_and_folders) > 1) { if ($is_allowed_to_edit || $group_member_with_upload_rights) { + // Getting the course quota $course_quota = DocumentManager::get_course_quota(); diff --git a/main/newscorm/learnpath.class.php b/main/newscorm/learnpath.class.php index cdbd37c229..e8fae73f4f 100755 --- a/main/newscorm/learnpath.class.php +++ b/main/newscorm/learnpath.class.php @@ -4827,11 +4827,45 @@ class learnpath { $dir = '/' . $dir; if ($dir[strlen($dir) - 1] != '/') $dir .= '/'; + $filepath = api_get_path(SYS_COURSE_PATH) . $_course['path'] . '/document' . $dir; + + if (empty($_POST['dir']) && empty($_GET['dir'])) { + + //Creating learning_path folder + $dir = '/learning_path'; + $filepath = api_get_path(SYS_COURSE_PATH) . $_course['path'] . '/document'; + $folder = null; + if (!is_dir($filepath.'/'.$dir)) { + $folder = create_unexisting_directory($_course, api_get_user_id(), api_get_session_id(), 0, 0, $filepath, $dir , get_lang('LearningPaths')); + } else { + $folder = true; + } + + $dir = '/learning_path/'; + //Creating LP folder + if ($folder) { + $title = replace_dangerous_char($this->name); + $dir = $dir.$title; + $filepath = api_get_path(SYS_COURSE_PATH) . $_course['path'] . '/document'; + if (!is_dir($filepath.'/'.$dir)) { + $folder = create_unexisting_directory($_course, api_get_user_id(), api_get_session_id(), 0, 0, $filepath, $dir , $this->name); + } else { + $folder = true; + } + $dir = $dir.'/'; + if ($folder) { + $filepath = api_get_path(SYS_COURSE_PATH) . $_course['path'] . '/document'.$dir; + } + } + } + if (!is_dir($filepath)) { $filepath = api_get_path(SYS_COURSE_PATH) . $_course['path'] . '/document/'; $dir = '/'; } + + // stripslashes() before calling replace_dangerous_char() because $_POST['title'] // is already escaped twice when it gets here. $title = replace_dangerous_char(stripslashes($_POST['title'])); @@ -4885,14 +4919,10 @@ class learnpath { if ($new_title) $ct .= ", title='" . Database :: escape_string(htmlspecialchars($new_title, ENT_QUOTES, $charset)) . ".html '"; - $sql_update = " - UPDATE " . $tbl_doc . " - SET " . substr($ct, 1) . " - WHERE id = " . $document_id; + $sql_update = "UPDATE " . $tbl_doc ." SET " . substr($ct, 1)." WHERE id = " . $document_id; Database::query($sql_update); } } - return $document_id; } } @@ -6309,8 +6339,7 @@ class learnpath { if ($action == 'add') { $return .= get_lang('CreateTheDocument'); - } - elseif ($action == 'move') { + } elseif ($action == 'move') { $return .= get_lang('MoveTheCurrentDocument'); } else { $return .= get_lang('EditTheCurrentDocument'); diff --git a/main/newscorm/lp_add_item.php b/main/newscorm/lp_add_item.php index 78e58e6cf6..67455bbd9f 100755 --- a/main/newscorm/lp_add_item.php +++ b/main/newscorm/lp_add_item.php @@ -328,7 +328,7 @@ echo '