exercise_jump.php 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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. require_once '../inc/global.inc.php';
  13. api_block_anonymous_users();
  14. $this_section=SECTION_COURSES;
  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. $session_id = api_get_session_id();
  21. $cidReq = Security::remove_XSS($_GET['cidReq']);
  22. $type = Security::remove_XSS($_GET['type']);
  23. $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']);
  24. // no support for hot potatoes
  25. if ($type == LINK_HOTPOTATOES) {
  26. $doExerciseUrl = api_get_path(WEB_CODE_PATH).'exercice/exercice.php?session_id='.$session_id.'&cidReq='.Security::remove_XSS($cidReq);
  27. }
  28. $_course['name'] = $course_title;
  29. $_course['official_code'] = $course_code;
  30. if (isset($_GET['doexercise'])) {
  31. header('Location: '.$doExerciseUrl);
  32. exit;
  33. } else {
  34. if (isset($_GET['gradebook'])) {
  35. $add_url = '&gradebook=view&exerciseId='.intval($_GET['exerciseId']);
  36. }
  37. header('Location: '.api_get_path(WEB_CODE_PATH).'exercice/overview.php?session_id='.$session_id.'&cidReq='.Security::remove_XSS($cidReq).'&'.$add_url);
  38. exit;
  39. }