diff --git a/main/inc/global.inc.php b/main/inc/global.inc.php index d7c268b6b4..e6591f7cbd 100644 --- a/main/inc/global.inc.php +++ b/main/inc/global.inc.php @@ -695,13 +695,17 @@ $app->before( } })); - // Check if we are inside a Chamilo course tool + // Check if we are inside a Chamilo course tool (or we need to set the $this->getCourse() in the controllers) $isCourseTool = (strpos($request->getPathInfo(), 'courses/') === false) ? false : true; if (!$isCourseTool) { // @todo add a before in controller in order to load the courses and course_session object $isCourseTool = (strpos($request->getPathInfo(), 'question_manager/exercise_distribution/') === false) ? false : true; + } + + if (!$isCourseTool) { + // @todo add a before in controller in order to load the courses and course_session object $isCourseTool = (strpos($request->getPathInfo(), 'question_manager/questions/') === false) ? false : true; } diff --git a/src/ChamiloLMS/Controller/Admin/QuestionManager/ExerciseDistributionController.php b/src/ChamiloLMS/Controller/Admin/QuestionManager/ExerciseDistributionController.php index d071a9f3fa..966405560c 100644 --- a/src/ChamiloLMS/Controller/Admin/QuestionManager/ExerciseDistributionController.php +++ b/src/ChamiloLMS/Controller/Admin/QuestionManager/ExerciseDistributionController.php @@ -34,7 +34,7 @@ class ExerciseDistributionController extends CommonController $course = $this->getCourse(); if (empty($course)) { - throw new \Exception('Could not get a valid course.'); + // throw new \Exception('Could not get a valid course.'); } $criteria = array('exerciseId' => $exerciseId);