Fix wrong link category validation see BT#13395

pull/2487/head
Julio 8 years ago
parent 2c784373c9
commit 3aad89cc86
  1. 24
      main/inc/lib/link.lib.php

@ -1629,28 +1629,14 @@ class Link extends Model
echo Display::return_icon('forum_nestedview.png', get_lang('NestedView'), '', ICON_SIZE_MEDIUM).'</a>';
}
echo '</div>';
// Displaying the links which have no category (thus category = 0 or NULL),
// if none present this will not be displayed
$sql = "
SELECT COUNT(1) AS count FROM $tbl_link l
INNER JOIN $tblCIP c
ON (l.c_id = c.c_id AND l.iid = c.ref)
WHERE
c.tool = 'link' AND
c.visibility != 2 AND
l.c_id = $course_id AND
(l.category_id = 0 OR l.category_id IS NULL)
";
$result = Database::query($sql);
$count = Database::result($result, 0, 'count');
$linksPerCategory = self::showLinksPerCategory(0, $course_id, $session_id);
if ($count && !$countCategories) {
if (empty($countCategories)) {
echo $linksPerCategory;
} elseif ($count && $countCategories) {
echo Display::panel($linksPerCategory, get_lang('NoCategory'));
} else {
if (!empty($linksPerCategory)) {
echo Display::panel($linksPerCategory, get_lang('NoCategory'));
}
}
$counter = 0;

Loading…
Cancel
Save