Browse Source

Adding route in order to load course and course_session objs.

Julio Montoya 11 years ago
parent
commit
4f226405c7
1 changed files with 10 additions and 0 deletions
  1. 10 0
      main/inc/global.inc.php

+ 10 - 0
main/inc/global.inc.php

@@ -697,12 +697,22 @@ $app->before(
 
 
         // Check if we are inside a Chamilo course tool
+
         $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;
+        }
+
+
         // Setting course entity for controllers and templates
         if ($isCourseTool) {
             // The course parameter is loaded
             $course = $request->get('course');
+            if (empty($course)) {
+                $course = $request->get('cidReq');
+            }
 
             // Converting /courses/XXX/ to a Entity/Course object
             $course = $app['orm.em']->getRepository('Entity\Course')->findOneByCode($course);