Allow teacher to access content see BT#12815

pull/2487/head
jmontoyaa 8 years ago
parent 15841a797a
commit e71e60ab89
  1. 49
      plugin/studentfollowup/StudentFollowUpPlugin.php

@ -125,38 +125,37 @@ class StudentFollowUpPlugin extends Plugin
if ($post) {
$isDrhRelatedViaPost = true;
}
}
// Check if course session coach
$sessions = SessionManager::get_sessions_by_user($studentId);
if (!empty($sessions)) {
foreach ($sessions as $session) {
$sessionId = $session['session_id'];
$sessionDrhInfo = SessionManager::getSessionFollowedByDrh(
$currentUserId,
$sessionId
// Check if course session coach
$sessions = SessionManager::get_sessions_by_user($studentId);
if (!empty($sessions)) {
foreach ($sessions as $session) {
$sessionId = $session['session_id'];
$sessionDrhInfo = SessionManager::getSessionFollowedByDrh(
$currentUserId,
$sessionId
);
if (!empty($sessionDrhInfo)) {
$isDrhRelatedToSession = true;
break;
}
foreach ($session['courses'] as $course) {
//$isCourseCoach = api_is_coach($sessionId, $course['real_id']);
$coachList = SessionManager::getCoachesByCourseSession(
$sessionId,
$course['real_id']
);
if (!empty($sessionDrhInfo)) {
$isDrhRelatedToSession = true;
break;
}
foreach ($session['courses'] as $course) {
//$isCourseCoach = api_is_coach($sessionId, $course['real_id']);
$coachList = SessionManager::getCoachesByCourseSession(
$sessionId,
$course['real_id']
);
if (!empty($coachList) && in_array($currentUserId, $coachList)) {
$isCourseCoach = true;
break(2);
}
if (!empty($coachList) && in_array($currentUserId, $coachList)) {
$isCourseCoach = true;
break(2);
}
}
}
$isCareTaker = $isDrhRelatedViaPost && $isDrhRelatedToSession;
}
$isCareTaker = $isDrhRelatedViaPost && $isDrhRelatedToSession;
$isAllow = $isAdmin || $isCareTaker || $isDrhRelatedToSession || $isCourseCoach;
$showPrivate = $isAdmin || $isCareTaker;
}

Loading…
Cancel
Save