Fix course listener to read $cidReset values

pull/2650/head
Julio Montoya 6 years ago
parent 166199747f
commit 32f36dd1f9
  1. 15
      src/CourseBundle/EventListener/CourseListener.php

@ -51,7 +51,7 @@ class CourseListener
if ($request->attributes->get('_route') === '_wdt') { if ($request->attributes->get('_route') === '_wdt') {
return; return;
} }
// Ignore toolbar
if ($request->attributes->get('_profiler') === '_wdt') { if ($request->attributes->get('_profiler') === '_wdt') {
return; return;
} }
@ -102,9 +102,15 @@ class CourseListener
} }
} }
global $cidReset;
if ($cidReset === true) {
$this->removeCourseFromSession($request);
return;
}
if (!empty($course)) { if (!empty($course)) {
$sessionHandler->set('courseObj', $course); $sessionHandler->set('courseObj', $course);
$courseInfo = api_get_course_info($courseCode); $courseInfo = api_get_course_info($course->getCode());
$container->get('twig')->addGlobal('course', $course); $container->get('twig')->addGlobal('course', $course);
$sessionHandler->set('_real_cid', $course->getId()); $sessionHandler->set('_real_cid', $course->getId());
@ -228,7 +234,10 @@ class CourseListener
$groupId = (int) $request->get('gidReq'); $groupId = (int) $request->get('gidReq');
$sessionId = (int) $request->get('id_session'); $sessionId = (int) $request->get('id_session');
$cidReset = $sessionHandler->get('cid_reset', false);
// cidReset is set in the global.inc.php files
global $cidReset;
//$cidReset = $sessionHandler->get('cid_reset', false);
// This controller implements ToolInterface? Then set the course/session // This controller implements ToolInterface? Then set the course/session
if (is_array($controllerList) && if (is_array($controllerList) &&

Loading…
Cancel
Save