aiken.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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. require_once '../inc/global.inc.php';
  10. $lib_path = api_get_path(LIBRARY_PATH);
  11. $main_path = api_get_path(SYS_CODE_PATH);
  12. // including additional libraries
  13. require_once $main_path.'exercice/export/aiken/aiken_import.inc.php';
  14. require_once $main_path.'exercice/export/aiken/aiken_classes.php';
  15. // section (for the tabs)
  16. $this_section = SECTION_COURSES;
  17. // access restriction: only teachers are allowed here
  18. if (!api_is_allowed_to_edit(null, true)) {
  19. api_not_allowed();
  20. }
  21. // the breadcrumbs
  22. $interbreadcrumb[]= array ("url"=>"exercise.php", "name"=> get_lang('Exercises'));
  23. $is_allowedToEdit = api_is_allowed_to_edit(null, true);
  24. $message = '';
  25. // import file
  26. if ((api_is_allowed_to_edit(null, true))) {
  27. if (isset($_POST['submit'])) {
  28. $message = aiken_import_file($_FILES['userFile']);
  29. if (is_numeric($message) && !empty($message)) {
  30. header('Location: admin.php?' . api_get_cidreq() . '&exerciseId=' . $message);
  31. exit;
  32. }
  33. }
  34. }
  35. // display header
  36. Display::display_header(get_lang('ImportAikenQuiz'), 'Exercises');
  37. // display Aiken form
  38. aiken_display_form($message);
  39. // display the footer
  40. Display::display_footer();