aiken.php 1.5 KB

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