Browse Source

Use correct activity names in session link selector.

40-behatfixes
Dan Marsden 3 years ago
parent
commit
f3f9a84932
  1. 29
      locallib.php

29
locallib.php

@ -1184,25 +1184,18 @@ function attendance_get_automarkoptions() {
* @return array $automarkcmoptions - list of course module names associated to this course. * @return array $automarkcmoptions - list of course module names associated to this course.
*/ */
function attendance_get_coursemodulenames($id) { function attendance_get_coursemodulenames($id) {
$coursecontext = context_course::instance($id);
global $DB; $modinfo = get_fast_modinfo($coursecontext->instanceid);
$automarkcmoptions = []; $automarkcmoptions = [];
foreach ($modinfo->get_instances() as $instances) {
$sql = "SELECT DISTINCT cm.id, cm.module, m.name foreach ($instances as $cm) {
FROM {course_modules} cm if (!$cm->uservisible) {
JOIN {modules} m ON m.id = cm.module continue;
WHERE cm.course = :cmcourse }
AND cm.visible = :cmvisible if (empty($cm->completion)) {
AND cm.completion = :cmcompletion"; continue;
}
$coursemodulenames = $DB->get_records_sql($sql, array( $automarkcmoptions[$cm->id] = shorten_text($cm->get_formatted_name()). ' ';
'cmcourse' => $id,
'cmvisible' => 1,
'cmcompletion' => 1
));
if ($coursemodulenames) {
foreach ($coursemodulenames as $coursemodulename) {
$automarkcmoptions[$coursemodulename->id] = format_string($coursemodulename->name);
} }
} }
return $automarkcmoptions; return $automarkcmoptions;

Loading…
Cancel
Save