@@ -4827,11 +4827,45 @@ public function create_document($_course) {
48274827 $ dir = '/ ' . $ dir ;
48284828 if ($ dir [strlen ($ dir ) - 1 ] != '/ ' )
48294829 $ dir .= '/ ' ;
4830+
48304831 $ filepath = api_get_path (SYS_COURSE_PATH ) . $ _course ['path ' ] . '/document ' . $ dir ;
4832+
4833+ if (empty ($ _POST ['dir ' ]) && empty ($ _GET ['dir ' ])) {
4834+
4835+ //Creating learning_path folder
4836+ $ dir = '/learning_path ' ;
4837+ $ filepath = api_get_path (SYS_COURSE_PATH ) . $ _course ['path ' ] . '/document ' ;
4838+ $ folder = null ;
4839+ if (!is_dir ($ filepath .'/ ' .$ dir )) {
4840+ $ folder = create_unexisting_directory ($ _course , api_get_user_id (), api_get_session_id (), 0 , 0 , $ filepath , $ dir , get_lang ('LearningPaths ' ));
4841+ } else {
4842+ $ folder = true ;
4843+ }
4844+
4845+ $ dir = '/learning_path/ ' ;
4846+ //Creating LP folder
4847+ if ($ folder ) {
4848+ $ title = replace_dangerous_char ($ this ->name );
4849+ $ dir = $ dir .$ title ;
4850+ $ filepath = api_get_path (SYS_COURSE_PATH ) . $ _course ['path ' ] . '/document ' ;
4851+ if (!is_dir ($ filepath .'/ ' .$ dir )) {
4852+ $ folder = create_unexisting_directory ($ _course , api_get_user_id (), api_get_session_id (), 0 , 0 , $ filepath , $ dir , $ this ->name );
4853+ } else {
4854+ $ folder = true ;
4855+ }
4856+ $ dir = $ dir .'/ ' ;
4857+ if ($ folder ) {
4858+ $ filepath = api_get_path (SYS_COURSE_PATH ) . $ _course ['path ' ] . '/document ' .$ dir ;
4859+ }
4860+ }
4861+ }
4862+
48314863 if (!is_dir ($ filepath )) {
48324864 $ filepath = api_get_path (SYS_COURSE_PATH ) . $ _course ['path ' ] . '/document/ ' ;
48334865 $ dir = '/ ' ;
48344866 }
4867+
4868+
48354869 // stripslashes() before calling replace_dangerous_char() because $_POST['title']
48364870 // is already escaped twice when it gets here.
48374871 $ title = replace_dangerous_char (stripslashes ($ _POST ['title ' ]));
@@ -4885,14 +4919,10 @@ public function create_document($_course) {
48854919 if ($ new_title )
48864920 $ ct .= ", title=' " . Database :: escape_string (htmlspecialchars ($ new_title , ENT_QUOTES , $ charset )) . ".html ' " ;
48874921
4888- $ sql_update = "
4889- UPDATE " . $ tbl_doc . "
4890- SET " . substr ($ ct , 1 ) . "
4891- WHERE id = " . $ document_id ;
4922+ $ sql_update = "UPDATE " . $ tbl_doc ." SET " . substr ($ ct , 1 )." WHERE id = " . $ document_id ;
48924923 Database::query ($ sql_update );
48934924 }
48944925 }
4895-
48964926 return $ document_id ;
48974927 }
48984928 }
@@ -6309,8 +6339,7 @@ public function display_document_form($action = 'add', $id = 0, $extra_info = 'n
63096339
63106340 if ($ action == 'add ' ) {
63116341 $ return .= get_lang ('CreateTheDocument ' );
6312- }
6313- elseif ($ action == 'move ' ) {
6342+ } elseif ($ action == 'move ' ) {
63146343 $ return .= get_lang ('MoveTheCurrentDocument ' );
63156344 } else {
63166345 $ return .= get_lang ('EditTheCurrentDocument ' );
0 commit comments