MDL-2013 - Stop resource auto-linking from occuring when resources are hidden
This commit is contained in:
+16
-2
@@ -32,9 +32,23 @@
|
||||
|
||||
if (empty($resourcelist)) {
|
||||
|
||||
/// The resources are sorted from long to short so longer ones can be linked first.
|
||||
/* get all non-hidden resources from this course
|
||||
* sorted from long to short so longer ones can be
|
||||
* linked first. And order by section so we try to
|
||||
* link to the top resource first.
|
||||
*/
|
||||
$resource_sql = "SELECT r.id, r.name
|
||||
FROM {$CFG->prefix}resource r,
|
||||
{$CFG->prefix}course_modules cm,
|
||||
{$CFG->prefix}modules m
|
||||
WHERE m.name = 'resource' AND
|
||||
cm.module = m.id AND
|
||||
cm.visible = 1 AND
|
||||
r.id = cm.instance AND
|
||||
cm.course = {$courseid}
|
||||
ORDER BY CHAR_LENGTH(r.name) DESC, cm.section ASC;";
|
||||
|
||||
if (!$resources = get_records('resource', 'course', $courseid, 'CHAR_LENGTH(name) DESC', 'id,name')) {
|
||||
if (!$resources = get_records_sql($resource_sql) ){
|
||||
$nothingtodo = true;
|
||||
return $text;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user