diff --git a/mod_form.php b/mod_form.php index a15524d..f9ece12 100644 --- a/mod_form.php +++ b/mod_form.php @@ -117,21 +117,7 @@ public function definition() { } } else { - $catlist = core_course_category::make_categories_list('', 0, ' / '); - - foreach ($mycourses as $mycourse) { - $courselabel = $catlist[$mycourse->category] . ' / ' . $mycourse->fullname.' ('.$mycourse->shortname.')'; - if (empty($mycourse->visible)) { - if ($config->displayhiddencourses || $mycourse->id == $currentrefcourseid) { - $hiddenlabel = ' '.get_string('hiddencourse', 'subcourse'); - $options[$mycourse->id] = $courselabel.$hiddenlabel; - } - } else { - $options[$mycourse->id] = $courselabel; - } - } - - $mform->addElement('autocomplete', 'refcourse', get_string('refcourselabel', 'subcourse'), $options); + $mform->addElement('course', 'refcourse', get_string('refcourselabel', 'subcourse'), ['limittoenrolled' => 1]); if (!empty($includekeepref)) { $mform->disabledIf('refcourse', 'refcoursecurrent', 'checked');