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 __DIR__.'/../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.'exercise/export/aiken/aiken_import.inc.php';
  14. require_once $main_path.'exercise/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(
  23. "url" => 'exercise.php?'.api_get_cidreq(),
  24. "name" => get_lang('Exercises'),
  25. );
  26. $is_allowedToEdit = api_is_allowed_to_edit(null, true);
  27. // import file
  28. if ((api_is_allowed_to_edit(null, true))) {
  29. if (isset($_POST['submit'])) {
  30. $id = aiken_import_file($_FILES['userFile']);
  31. if (is_numeric($id) && !empty($id)) {
  32. header('Location: admin.php?'.api_get_cidreq().'&exerciseId='.$id);
  33. exit;
  34. }
  35. }
  36. }
  37. // display header
  38. Display::display_header(get_lang('ImportAikenQuiz'), 'Exercises');
  39. // display Aiken form
  40. aiken_display_form();
  41. // display the footer
  42. Display::display_footer();