upload.scorm.php 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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=='not_a_learning_path') {
  19. $msg = urlencode(get_lang('ScormUnknownPackageFormat'));
  20. $dialogtype = 'error';
  21. } elseif ($error == 'not_enough_space') {
  22. $msg = urlencode(get_lang('ScormNotEnoughSpaceInCourseToInstallPackage'));
  23. $dialogtype = 'error';
  24. } elseif ($error == 'not_scorm_content') {
  25. $msg = urlencode(get_lang('ScormPackageFormatNotScorm'));
  26. $dialogtype = 'error';
  27. } else {
  28. if (api_get_setting('search_enabled')=='true') {
  29. require_once(api_get_path(LIBRARY_PATH) . 'specific_fields_manager.lib.php');
  30. $specific_fields = get_specific_field_list();
  31. foreach ($specific_fields as $specific_field) {
  32. $values = explode(',', trim($_POST[$specific_field['code']]));
  33. if ( !empty($values) ) {
  34. foreach ($values as $value) {
  35. $value = trim($value);
  36. if ( !empty($value) ) {
  37. add_specific_field_value($specific_field['id'], api_get_course_id(), TOOL_LEARNPATH, $oScorm->lp_id, $value);
  38. }
  39. }
  40. }
  41. }
  42. }
  43. $msg = urlencode(get_lang('UplUploadSucceeded'));
  44. $dialogtype = 'confirmation';
  45. }
  46. header('location: ../newscorm/lp_controller.php?action=list&dialog_box='.$msg.'&dialogtype='.$dialogtype);
  47. exit;
  48. ?>