upload.scorm.php 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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. $cwdir = getcwd();
  10. require_once '../newscorm/lp_upload.php';
  11. // Reinit current working directory as many functions in upload change it
  12. chdir($cwdir);
  13. $error = api_failure::get_last_failure();
  14. if ($error == 'upload_file_too_big') {
  15. $msg = urlencode(get_lang('UplFileTooBig'));
  16. $dialogtype = 'error';
  17. } else {
  18. if ($error == 'not_a_learning_path') {
  19. $msg = urlencode(get_lang('ScormUnknownPackageFormat'));
  20. $dialogtype = 'error';
  21. } elseif ($error == 'not_enough_space') {
  22. $msg = urlencode(
  23. get_lang('ScormNotEnoughSpaceInCourseToInstallPackage')
  24. );
  25. $dialogtype = 'error';
  26. } elseif ($error == 'not_scorm_content') {
  27. $msg = urlencode(get_lang('ScormPackageFormatNotScorm'));
  28. $dialogtype = 'error';
  29. } else {
  30. if (api_get_setting('search_enabled') == 'true') {
  31. require_once api_get_path(LIBRARY_PATH) . 'specific_fields_manager.lib.php';
  32. $specific_fields = get_specific_field_list();
  33. foreach ($specific_fields as $specific_field) {
  34. $values = explode(',', trim($_POST[$specific_field['code']]));
  35. if (!empty($values)) {
  36. foreach ($values as $value) {
  37. $value = trim($value);
  38. if (!empty($value)) {
  39. add_specific_field_value(
  40. $specific_field['id'],
  41. api_get_course_id(),
  42. TOOL_LEARNPATH,
  43. $oScorm->lp_id,
  44. $value
  45. );
  46. }
  47. }
  48. }
  49. }
  50. }
  51. $msg = urlencode(get_lang('UplUploadSucceeded'));
  52. $dialogtype = 'confirmation';
  53. }
  54. }
  55. header('location: ../newscorm/lp_controller.php?action=list&dialog_box=' . $msg . '&dialogtype=' . $dialogtype);
  56. exit;