form.scorm.php 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  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(TOOL_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. ?>
  40. <div id="dynamic_div" style="display:block;margin-left:40%;margin-top:10px;height:50px;">
  41. </div>
  42. <div id="upload_form_div" name="form_div" style="display:block;">
  43. <table border="0">
  44. <form method="POST" action="upload.php" id="upload_form" enctype="multipart/form-data" onsubmit="myUpload.start('dynamic_div','../img/progress_bar.gif','<?php echo(get_lang('Uploading'));?>','upload_form_div');">
  45. <input type="hidden" name="curdirpath" value="<?php echo $path; ?>">
  46. <input type="hidden" name="tool" value="<?php echo $my_tool; ?>">
  47. <tr>
  48. <?php
  49. echo '<td>'.get_lang('FileToUpload').'</td>'."\n";
  50. echo '<td><input type="file" name="user_file"></td>'."\n";
  51. echo '</tr><tr>'."\n";
  52. echo '<td>'.get_lang('ContentMaker').'</td>'."\n";
  53. include('../newscorm/content_makers.inc.php');
  54. echo '<td><select name="content_maker">'."\n";
  55. foreach($content_origins as $indx => $origin){
  56. if($indx == 1){
  57. echo ' <option value="'.$origin.'" selected="selected">'.$origin.'</option>';
  58. }else{
  59. echo ' <option value="'.$origin.'">'.$origin.'</option>';
  60. }
  61. }
  62. echo " </<select></td>\n";
  63. echo '</tr><tr>'."\n";
  64. echo '<td>'.get_lang('ContentProximity').'</td>'."\n";
  65. echo ' <td><select name="content_proximity">'."\n" .
  66. ' <option value="local" selected="selected">'.get_lang('Local').'</option>' .
  67. ' <option value="remote">'.get_lang('Remote').'</option>' .
  68. " </select></td>\n" ;
  69. echo '</tr><tr>'."\n";
  70. echo '<td colspan="2" align="right"><input type="submit" name="submit" value="'.get_lang('Download').'"></td>';
  71. echo '</tr><tr>'."\n";
  72. echo '<td colspan="2">&nbsp;</td>'."\n";
  73. echo '</tr><tr>'."\n";
  74. echo '<td>'.get_lang('Or').' '.strtolower(get_lang('UploadLocalFileFromGarbageDir')).'</td>'."\n";
  75. $list = get_zip_files_in_garbage();
  76. if(count($list)>0){
  77. echo '<td><select name="file_name">'."\n";
  78. foreach($list as $file){
  79. echo ' <option value="'.$file.'">'.$file.'</option>'."\n";
  80. }
  81. echo '</select></td>'."\n";
  82. echo '</tr><tr>'."\n";
  83. echo '<td colspan="2" align="right"><input type="submit" name="submit" value="'.get_lang('Download').'"></td>';
  84. echo '<td></td>'."\n";
  85. }else{
  86. echo '<td align="center">{'.get_lang('Empty').'}</td>';
  87. }
  88. echo '</tr>'."\n";
  89. ?>
  90. </form>
  91. </table>
  92. </div>
  93. <br/>
  94. <?php
  95. /*
  96. ==============================================================================
  97. FOOTER
  98. ==============================================================================
  99. */
  100. Display::display_footer();
  101. ?>