|
|
@ -856,20 +856,19 @@ class SystemAnnouncementManager |
|
|
|
foreach ($promotionList as $promotionId) { |
|
|
|
foreach ($promotionList as $promotionId) { |
|
|
|
$sessionList = SessionManager::get_all_sessions_by_promotion($promotionId); |
|
|
|
$sessionList = SessionManager::get_all_sessions_by_promotion($promotionId); |
|
|
|
foreach ($sessionList as $session) { |
|
|
|
foreach ($sessionList as $session) { |
|
|
|
$sessionRelUser = SessionManager::getUserStatusInSession($userId, $session['id']); |
|
|
|
$sessionId = $session['id']; |
|
|
|
|
|
|
|
// Check student |
|
|
|
if (!($sessionRelUser instanceof SessionRelUser)) { |
|
|
|
if ($visible === self::VISIBLE_STUDENT && |
|
|
|
continue; |
|
|
|
SessionManager::isUserSubscribedAsStudent($sessionId, $userId) |
|
|
|
} |
|
|
|
) { |
|
|
|
|
|
|
|
|
|
|
|
$status = $sessionRelUser->getRelationType(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ($visible === self::VISIBLE_TEACHER && $status === 2) { |
|
|
|
|
|
|
|
$show = true; |
|
|
|
$show = true; |
|
|
|
break 2; |
|
|
|
break 2; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if ($visible === self::VISIBLE_STUDENT && $status === 0) { |
|
|
|
// Check course coach |
|
|
|
|
|
|
|
$coaches = SessionManager::getCoachesBySession($sessionId); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ($visible === self::VISIBLE_TEACHER && in_array($userId, $coaches)) { |
|
|
|
$show = true; |
|
|
|
$show = true; |
|
|
|
break 2; |
|
|
|
break 2; |
|
|
|
} |
|
|
|
} |
|
|
@ -880,6 +879,7 @@ class SystemAnnouncementManager |
|
|
|
continue; |
|
|
|
continue; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
$announcementData = [ |
|
|
|
$announcementData = [ |
|
|
|
'id' => $announcement->id, |
|
|
|
'id' => $announcement->id, |
|
|
|
'title' => $announcement->title, |
|
|
|
'title' => $announcement->title, |
|
|
|