aiken.php 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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. require_once $lib_path.'document.lib.php';
  19. require_once $lib_path.'fileUpload.lib.php';
  20. require_once $lib_path.'fileManage.lib.php';
  21. // including additional libraries
  22. require_once 'exercise.class.php';
  23. require_once 'question.class.php';
  24. require_once 'answer.class.php';
  25. require_once 'unique_answer.class.php';
  26. require_once $main_path.'exercice/export/aiken/aiken_import.inc.php';
  27. require_once $main_path.'exercice/export/aiken/aiken_classes.php';
  28. // section (for the tabs)
  29. $this_section = SECTION_COURSES;
  30. // access restriction: only teachers are allowed here
  31. if (!api_is_allowed_to_edit(null, true)) {
  32. api_not_allowed();
  33. }
  34. // the breadcrumbs
  35. $interbreadcrumb[]= array ("url"=>"exercice.php", "name"=> get_lang('Exercices'));
  36. $is_allowedToEdit = api_is_allowed_to_edit(null, true);
  37. // display header
  38. Display::display_header(get_lang('ImportAikenQuiz'), 'Exercises');
  39. $msg = '';
  40. // import file
  41. if ((api_is_allowed_to_edit(null, true))) {
  42. if (isset($_POST['submit'])) {
  43. $msg = aiken_import_file($_FILES['userFile']);
  44. }
  45. }
  46. // display Aiken form
  47. aiken_display_form($msg);
  48. // display the footer
  49. Display::display_footer();