Fix condition.

1.10.x
Julio Montoya 11 years ago
parent 2410962062
commit ada067400b
  1. 13
      main/tracking/courseLog.php

@ -50,21 +50,28 @@ if (api_is_drh()) {
if (api_drh_can_access_all_session_content()) {
// If the drh has been configured to be allowed to see all session content, give him access to the session courses
$coursesFromSession = SessionManager::getAllCoursesFollowedByUser(api_get_user_id(), null);
$coursesFromSessionCodeList = array();
if (!empty($coursesFromSession)) {
$coursesFromSession = array_keys($coursesFromSession);
foreach ($coursesFromSession as $course) {
$coursesFromSessionCodeList[$course['code']] = $course['code'];
}
}
$coursesFollowedList = CourseManager::get_courses_followed_by_drh(api_get_user_id());
if (!empty($coursesFollowedList)) {
$coursesFollowedList = array_keys($coursesFollowedList);
}
if (!in_array($courseCode, $coursesFollowedList)) {
if (!in_array($courseCode, $coursesFromSession)) {
if (!in_array($courseCode, $coursesFromSessionCodeList)) {
api_not_allowed();
}
}
} else {
// If the drh has *not* been configured to be allowed to see all session content, then check if he has also been given access to the corresponding courses
// If the drh has *not* been configured to be allowed to see all session content,
// then check if he has also been given access to the corresponding courses
$coursesFollowedList = CourseManager::get_courses_followed_by_drh(api_get_user_id());
$coursesFollowedList = array_keys($coursesFollowedList);
if (!in_array(api_get_course_id(), $coursesFollowedList)) {

Loading…
Cancel
Save