aiken.php 1.4 KB

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