Lp reports - show all LP even if they are blocked by a prerequisite

see BT#14394
pull/2547/head
Julio 8 years ago
parent 7e658e0c14
commit c2788a8b8b
  1. 31
      main/lp/learnpathList.class.php
  2. 4
      main/mySpace/myStudents.php

@ -28,12 +28,13 @@ class LearnpathList
* (only displays) items if he has enough permissions to view them.
*
* @param int $user_id
* @param string $course_code Optional course code (otherwise we use api_get_course_id())
* @param int $session_id Optional session id (otherwise we use api_get_session_id())
* @param string $course_code Optional course code (otherwise we use api_get_course_id())
* @param int $session_id Optional session id (otherwise we use api_get_session_id())
* @param string $order_by
* @param bool $check_publication_dates
* @param int $categoryId
* @param bool $ignoreCategoryFilter
* @param bool $ignoreLpVisibility get the list of LPs for reports
*/
public function __construct(
$user_id,
@ -42,7 +43,8 @@ class LearnpathList
$order_by = null,
$check_publication_dates = false,
$categoryId = null,
$ignoreCategoryFilter = false
$ignoreCategoryFilter = false,
$ignoreLpVisibility = false
) {
$course_info = api_get_course_info($course_code);
@ -90,7 +92,7 @@ class LearnpathList
$categoryFilter = '';
if ($ignoreCategoryFilter == false) {
if (!empty($categoryId)) {
$categoryId = intval($categoryId);
$categoryId = (int) $categoryId;
$categoryFilter = " AND lp.categoryId = $categoryId";
} else {
$categoryFilter = " AND (lp.categoryId = 0 OR lp.categoryId IS NULL) ";
@ -129,11 +131,10 @@ class LearnpathList
)
";
$res2 = Database::query($sql2);
$pub = 'i';
if (Database::num_rows($res2) > 0) {
$row2 = Database::fetch_array($res2);
$pub = $row2['visibility'];
} else {
$pub = 'i';
}
// Check if visible.
@ -145,14 +146,16 @@ class LearnpathList
);
// 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->getId(),
$user_id,
$course_code
);
if ($lpVisibility === false) {
continue;
if ($ignoreLpVisibility === false) {
if ($showBlockedPrerequisite !== true && !api_is_allowed_to_edit()) {
$lpVisibility = learnpath::is_lp_visible_for_student(
$row->getId(),
$user_id,
$course_code
);
if ($lpVisibility === false) {
continue;
}
}
}

@ -1176,7 +1176,9 @@ if (empty($details)) {
$sessionId,
null,
false,
$categoryId
$categoryId,
false,
true
);
$flat_list = $list->get_flat_list();

Loading…
Cancel
Save