form.scorm.php 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. <?php //$id: $
  2. /**
  3. * Display 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. * Small function to list files in garbage/
  10. */
  11. function get_zip_files_in_garbage(){
  12. $list = array();
  13. $dh = opendir(api_get_path(SYS_CODE_PATH).'garbage/');
  14. if($dh === false){
  15. //ignore
  16. }else{
  17. while($entry = readdir($dh)){
  18. if(substr($entry,0,1) == '.'){/*ignore files starting with . */}
  19. else
  20. {
  21. if(preg_match('/^.*\.zip$/i',$entry)){
  22. $list[] = $entry;
  23. }
  24. }
  25. }
  26. natcasesort($list);
  27. closedir($dh);
  28. }
  29. return $list;
  30. }
  31. /**
  32. * Just display the form needed to upload a SCORM and give its settings
  33. */
  34. $nameTools = get_lang("FileUpload");
  35. $interbreadcrumb[]= array ("url"=>"../newscorm/lp_controller.php?action=list", "name"=> get_lang("Learnpath"));
  36. Display::display_header($nameTools,"Path");
  37. //show the title
  38. api_display_tool_title(get_lang("Learnpath")." - ".$nameTools.$add_group_to_title);
  39. require_once (api_get_path(LIBRARY_PATH).'formvalidator/FormValidator.class.php');
  40. include('../newscorm/content_makers.inc.php');
  41. $form = new FormValidator('','POST','upload.php','','id="upload_form" enctype="multipart/form-data" style="background-image: url(\'../img/scorm.jpg\'); background-repeat: no-repeat; background-position: 600px;"');
  42. $form->addElement('hidden', 'curdirpath', $path);
  43. $form->addElement('hidden', 'tool', $my_tool);
  44. $form->addElement('file','user_file',get_lang('FileToUpload'));
  45. $select_content_marker = &$form->addElement('select','content_maker',get_lang('ContentMaker'));
  46. foreach($content_origins as $index => $origin){
  47. $select_content_marker->addOption($origin,$origin);
  48. }
  49. $select_content_proximity = &$form->addElement('select','content_proximity',get_lang('ContentProximity'));
  50. $select_content_proximity->addOption(get_lang('Local'),"local");
  51. $select_content_proximity->addOption(get_lang('Remote'),"remote");
  52. $select_content_proximity -> setSelected("local");
  53. $form->addElement('submit', 'submit', get_lang('Send'));
  54. $form->addElement('html', '<br><br><br>');
  55. /*$list = get_zip_files_in_garbage();
  56. if(count($list)>0){
  57. $select_file_name = &$form->addElement('select','file_name',get_lang('Or').' '.strtolower(get_lang('UploadLocalFileFromGarbageDir')));
  58. foreach($list as $file){
  59. $select_file_name->addOption($file,$file);
  60. }
  61. $form->addElement('submit', 'submit', get_lang('Download'));
  62. }
  63. else{
  64. $text_empty = &$form->addElement('text', 'empty', get_lang('Or').' '.strtolower(get_lang('UploadLocalFileFromGarbageDir')));
  65. $defaults["empty"] = get_lang('Empty');
  66. $text_empty->freeze();
  67. }*/
  68. $form->add_real_progress_bar('uploadScorm','user_file');
  69. $form->setDefaults($defaults);
  70. $form->display();
  71. ?>
  72. <br/>
  73. <?php
  74. /*
  75. ==============================================================================
  76. FOOTER
  77. ==============================================================================
  78. */
  79. Display::display_footer();
  80. ?>