aiken.php 1.4 KB

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