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 ''; echo $_SESSION['oLP']->display_item_form($_GET['type'], get_lang('EnterDataNewModule')); break; case 'document': - if(isset($_GET['file']) && is_numeric($_GET['file'])) { + if (isset($_GET['file']) && is_numeric($_GET['file'])) { echo $_SESSION['oLP']->display_document_form('add', 0, $_GET['file']); } else { echo $_SESSION['oLP']->display_document_form('add', 0); diff --git a/main/newscorm/lp_controller.php b/main/newscorm/lp_controller.php index cdaaacaa8f..e4a5c778d0 100755 --- a/main/newscorm/lp_controller.php +++ b/main/newscorm/lp_controller.php @@ -212,7 +212,6 @@ switch ($action) { if ($debug > 0) error_log('New LP - add item action triggered', 0); - if (!$lp_found) { //check if the learnpath ID was defined, otherwise send back to list if ($debug > 0) error_log('New LP - No learnpath given for add item', 0); @@ -227,13 +226,11 @@ switch ($action) { $_SESSION['oLP']->set_modified_on(); if (isset($_SESSION['post_time']) && $_SESSION['post_time'] == $_POST['post_time']) { - // Check post_time to ensure ??? (counter-hacking measure?) require 'lp_add_item.php'; } else { - + $_SESSION['post_time'] = $_POST['post_time']; - if ($_POST['type'] == TOOL_DOCUMENT) { if (isset($_POST['path']) && $_GET['edit'] != 'true') { $document_id = $_POST['path'];