upload.scorm.php 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <?php
  2. /* For licensing terms, see /license.txt */
  3. /**
  4. * Process part of the SCORM sub-process for upload. This script MUST BE included by upload/index.php
  5. * as it prepares most of the variables needed here.
  6. * @package chamilo.upload
  7. * @author Yannick Warnier <ywarnier@beeznest.org>
  8. */
  9. /**
  10. * Process the SCORM package and return to the SCORM tool
  11. */
  12. $language_file = 'scorm';
  13. $cwdir = getcwd();
  14. require_once '../newscorm/lp_upload.php';
  15. //reinit current working directory as many functions in upload change it
  16. chdir($cwdir);
  17. $error = api_failure::get_last_failure();
  18. if ($error == 'upload_file_too_big'){
  19. $msg = urlencode(get_lang('UplFileTooBig'));
  20. $dialogtype = 'error';
  21. }else if ($error=='not_a_learning_path') {
  22. $msg = urlencode(get_lang('ScormUnknownPackageFormat'));
  23. $dialogtype = 'error';
  24. } elseif ($error == 'not_enough_space') {
  25. $msg = urlencode(get_lang('ScormNotEnoughSpaceInCourseToInstallPackage'));
  26. $dialogtype = 'error';
  27. } elseif ($error == 'not_scorm_content') {
  28. $msg = urlencode(get_lang('ScormPackageFormatNotScorm'));
  29. $dialogtype = 'error';
  30. } else {
  31. if (api_get_setting('search_enabled')=='true') {
  32. require_once api_get_path(LIBRARY_PATH) . 'specific_fields_manager.lib.php';
  33. $specific_fields = get_specific_field_list();
  34. foreach ($specific_fields as $specific_field) {
  35. $values = explode(',', trim($_POST[$specific_field['code']]));
  36. if ( !empty($values) ) {
  37. foreach ($values as $value) {
  38. $value = trim($value);
  39. if ( !empty($value) ) {
  40. add_specific_field_value($specific_field['id'], api_get_course_id(), TOOL_LEARNPATH, $oScorm->lp_id, $value);
  41. }
  42. }
  43. }
  44. }
  45. }
  46. $msg = urlencode(get_lang('UplUploadSucceeded'));
  47. $dialogtype = 'confirmation';
  48. }
  49. header('location: ../newscorm/lp_controller.php?action=list&dialog_box='.$msg.'&dialogtype='.$dialogtype);
  50. exit;