aiken.php 1.6 KB

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