exercise_jump.php 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <?php
  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. * @package chamilo.gradebook
  11. */
  12. /**
  13. * Init
  14. */
  15. //require_once '../inc/global.inc.php';
  16. api_block_anonymous_users();
  17. $this_section=SECTION_COURSES;
  18. $course_code = api_get_course_id();
  19. $course_info = api_get_course_info($course_code);
  20. $course_title = $course_info['title'];
  21. $course_code = $return_result['code'];
  22. $gradebook = Security::remove_XSS($_GET['gradebook']);
  23. $session_id = api_get_session_id();
  24. $cidReq = Security::remove_XSS($_GET['cidReq']);
  25. $type = Security::remove_XSS($_GET['type']);
  26. $doExerciseUrl = api_get_path(WEB_CODE_PATH).'exercice/overview.php?session_id='.$session_id.'&cidReq='.$cidReq.'&gradebook='.$gradebook.'&origin=&learnpath_id=&learnpath_item_id=&exerciseId='.intval($_GET['doexercise']);
  27. // no support for hot potatoes
  28. if ($type == LINK_HOTPOTATOES) {
  29. $doExerciseUrl = api_get_path(WEB_CODE_PATH).'exercice/exercice.php?session_id='.$session_id.'&cidReq='.Security::remove_XSS($cidReq);
  30. }
  31. $_course['name'] = $course_title;
  32. $_course['official_code'] = $course_code;
  33. if (isset($_GET['doexercise'])) {
  34. header('Location: '.$doExerciseUrl);
  35. exit;
  36. } else {
  37. if (isset($_GET['gradebook'])) {
  38. $add_url = '&gradebook=view&exerciseId='.intval($_GET['exerciseId']);
  39. }
  40. header('Location: '.api_get_path(WEB_CODE_PATH).'exercice/overview.php?session_id='.$session_id.'&cidReq='.Security::remove_XSS($cidReq).'&'.$add_url);
  41. exit;
  42. }