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 " . sql_length('r.name') . " DESC, cm.section ASC"; if (!$resources = get_records_sql($resource_sql) ){ $nothingtodo = true; return $text; } $resourcelist = array(); foreach ($resources as $resource) { $currentname = trim($resource->name); $entitisedname = s($currentname); $strippedname = strip_tags($currentname); /// Avoid empty or unlinkable resource names if (!empty($strippedname)) { $resourcelist[] = new filterobject($currentname, 'frametarget.'>', '', false, true); if ($currentname != $entitisedname) { /// If name has some entity (& " < >) add that filter too. MDL-17518 $resourcelist[] = new filterobject($entitisedname, 'frametarget.'>', '', false, true); } } } } return filter_phrases($text, $resourcelist); // Look for all these links in the text } ?>