upload.scorm.php 1.4 KB

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