diff --git a/main/admin/course_intro_pdf_import.php b/main/admin/course_intro_pdf_import.php index 09e4549e4e..6994756d6b 100644 --- a/main/admin/course_intro_pdf_import.php +++ b/main/admin/course_intro_pdf_import.php @@ -41,7 +41,8 @@ if ($_POST['formSent']) { } else { $errors = import_pdfs($courses, $subDir); if (count($errors) == 0) { - save_data($courses); + // save_data($courses); + error_log('Course intros imported successfully in '.__FILE__.', line '.__LINE__); } } } @@ -54,6 +55,8 @@ if (count($errors) != 0) { } $error_message .= ''; Display :: display_normal_message($error_message, false); +} elseif ($_POST['formSent']) { + Display :: display_confirmation_message('CourseIntroductionsAllImportesSuccessfully', false); } ?>
@@ -108,6 +111,7 @@ function import_pdfs($file, $subDir = '/') { require_once api_get_path(LIBRARY_PATH).'app_view.php'; require_once '../course_description/course_description_controller.php'; $list = scandir($baseDir.$uploadPath); + $i = 0; foreach ($list as $file) { if (substr($file,0,1) == '.' or !is_file($baseDir.$uploadPath.$file)) { continue; @@ -149,6 +153,11 @@ function import_pdfs($file, $subDir = '/') { error_log($parts[0].' is not a course, apparently'); $errors[] = array('Line' => 0, 'Code' => $parts[0], 'Title' => $parts[0].' - '.get_lang('CodeDoesNotExists')); } + error_log($parts[0]); + $i++; //found at least one entry that is not a dir or a . + } + if ($i == 0) { + $errors[] = array('Line' => 0, 'Code' => '.', 'Title' => get_lang('NoPDFFoundAtRoot')); } return $errors; }