mirror of
https://github.com/moodle/moodle.git
synced 2025-03-14 12:40:01 +01:00
MDL-2013 - stop resource auto-linking from occuring when resources are hidden
merged from MOODLE_19_STABLE
This commit is contained in:
parent
e69499c8df
commit
0bf540bb64
@ -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;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user