aiken.php 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. <?php
  2. /* For licensing terms, see /license.txt */
  3. /**
  4. * Code for Aiken import integration.
  5. * @package chamilo.exercise
  6. * @author Ronny Velasquez <ronny.velasquez@beeznest.com>
  7. * @author César Perales <cesar.perales@gmail.com> Updated function names and import files for Aiken format support
  8. */
  9. /**
  10. * Code
  11. */
  12. // name of the language file that needs to be included
  13. $language_file = array('exercice', 'gradebook');
  14. // including the global Chamilo file
  15. require_once '../inc/global.inc.php';
  16. $lib_path = api_get_path(LIBRARY_PATH);
  17. $main_path = api_get_path(SYS_CODE_PATH);
  18. require_once $lib_path.'document.lib.php';
  19. require_once $lib_path.'fileUpload.lib.php';
  20. require_once $lib_path.'fileManage.lib.php';
  21. // including additional libraries
  22. require_once 'exercise.class.php';
  23. require_once 'question.class.php';
  24. require_once 'answer.class.php';
  25. require_once 'unique_answer.class.php';
  26. require_once $main_path.'exercice/export/aiken/aiken_import.inc.php';
  27. require_once $main_path.'exercice/export/aiken/aiken_classes.php';
  28. // section (for the tabs)
  29. $this_section = SECTION_COURSES;
  30. // access restriction: only teachers are allowed here
  31. if (!api_is_allowed_to_edit(null, true)) {
  32. api_not_allowed();
  33. }
  34. // the breadcrumbs
  35. $interbreadcrumb[]= array ("url"=>"exercice.php", "name"=> get_lang('Exercices'));
  36. $is_allowedToEdit = api_is_allowed_to_edit(null, true);
  37. $message = '';
  38. // import file
  39. if ((api_is_allowed_to_edit(null, true))) {
  40. if (isset($_POST['submit'])) {
  41. $message = aiken_import_file($_FILES['userFile']);
  42. if (is_numeric($message) && !empty($message)) {
  43. header('Location: admin.php?' . api_get_cidreq() . '&exerciseId=' . $message);
  44. exit;
  45. }
  46. }
  47. }
  48. // display header
  49. Display::display_header(get_lang('ImportAikenQuiz'), 'Exercises');
  50. // display Aiken form
  51. aiken_display_form($message);
  52. // display the footer
  53. Display::display_footer();