upload.scorm.php 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  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. }else{
  21. if (api_get_setting('search_enabled')=='true') {
  22. require_once(api_get_path(LIBRARY_PATH) . 'specific_fields_manager.lib.php');
  23. $specific_fields = get_specific_field_list();
  24. foreach ($specific_fields as $specific_field) {
  25. $values = explode(',', trim($_POST[$specific_field['code']]));
  26. if ( !empty($values) ) {
  27. foreach ($values as $value) {
  28. $value = trim($value);
  29. if ( !empty($value) ) {
  30. add_specific_field_value($specific_field['id'], api_get_course_id(), TOOL_LEARNPATH, $oScorm->lp_id, $value);
  31. }
  32. }
  33. }
  34. }
  35. }
  36. $msg = urlencode(get_lang('UplUploadSucceeded'));
  37. }
  38. header('location: ../newscorm/lp_controller.php?action=list&dialog_box='.$msg);
  39. ?>