exercise_jump.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php //$id $
  2. /* For licensing terms, see /license.txt */
  3. /**
  4. * Sets needed course variables and then jumps to the exercises result page.
  5. * This intermediate page is needed because the user is not inside a course
  6. * when visiting the gradebook, and several course scripts rely on these
  7. * variables.
  8. * Most code here is ripped from /main/course_home/course_home.php
  9. * @author Bert Steppé
  10. */
  11. require_once '../inc/global.inc.php';
  12. api_block_anonymous_users();
  13. $this_section=SECTION_COURSES;
  14. require_once api_get_path(LIBRARY_PATH).'course.lib.php';
  15. $course_code = api_get_course_id();
  16. $course_info = Database::get_course_info($course_code);
  17. $course_title = $course_info['title'];
  18. $course_code = $return_result['code'];
  19. $gradebook=Security::remove_XSS($_GET['gradebook']);
  20. $dbname = $course_info['db_name'];
  21. $_course['name'] = $course_title;
  22. $_course['official_code'] = $course_code;
  23. if (isset($_GET['doexercise'])) {
  24. header('Location: ../exercice/exercise_submit.php?cidReq='.$cidReq.'&gradebook='.$gradebook.'&origin=&learnpath_id=&learnpath_item_id=&exerciseId='.Security::remove_XSS($_GET['doexercise']));
  25. exit;
  26. } else {
  27. if (isset($_GET['gradebook'])) {
  28. $add_url = '&gradebook=view&exerciseId='.intval($_GET['exerciseId']);
  29. }
  30. header('Location: ../exercice/exercice.php?cidReq='.Security::remove_XSS($cidReq).'&show=result'.$add_url);
  31. exit;
  32. }