From b4ed8e914552424a974c7fb6ed572ab963817b57 Mon Sep 17 00:00:00 2001 From: jmontoyaa Date: Tue, 28 Mar 2017 11:20:00 +0200 Subject: [PATCH] Avoid invisible LP if blocked for user/lp subscription. See BT#10882 --- main/lp/learnpathList.class.php | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/main/lp/learnpathList.class.php b/main/lp/learnpathList.class.php index 86a1225838..7255f70b80 100755 --- a/main/lp/learnpathList.class.php +++ b/main/lp/learnpathList.class.php @@ -108,10 +108,8 @@ class LearnpathList $order "; - $learningPaths = Database::getManager() - ->createQuery($dql) - ->getResult(); - + $learningPaths = Database::getManager()->createQuery($dql)->getResult(); + $showBlockedPrerequisite = api_get_configuration_value('show_prerequisite_as_blocked'); $names = []; /** @var CLp $row */ foreach ($learningPaths as $row) { @@ -149,6 +147,14 @@ class LearnpathList $session_id ); + // If option is not true then don't show invisible LP to user + if ($showBlockedPrerequisite !== true && !api_is_allowed_to_edit()) { + $lpVisibility = learnpath::is_lp_visible_for_student($row->getIid(), $user_id); + if ($lpVisibility === false) { + continue; + } + } + $this->list[$row->getIid()] = array( 'lp_type' => $row->getLpType(), 'lp_session' => $row->getSessionId(),