Setting correctly the course obj when using the ExerciseDistributionController

skala
jmontoya 12 years ago
parent 37787b2eb0
commit e1ea01c8b2
  1. 6
      main/inc/global.inc.php
  2. 2
      src/ChamiloLMS/Controller/Admin/QuestionManager/ExerciseDistributionController.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;
}

@ -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);

Loading…
Cancel
Save