MDL-10965 tool_generator: use existing course element

This commit is contained in:
Marina Glancy 2019-04-03 11:47:52 +02:00
parent 88d2677e43
commit 2c8b8af4bd
3 changed files with 7 additions and 21 deletions

View File

@ -47,8 +47,7 @@ class tool_generator_make_testplan_form extends moodleform {
tool_generator_testplan_backend::get_size_choices());
$mform->setDefault('size', tool_generator_testplan_backend::DEFAULT_SIZE);
$mform->addElement('select', 'courseid', get_string('targetcourse', 'tool_generator'),
tool_generator_testplan_backend::get_course_options());
$mform->addElement('course', 'courseid', get_string('targetcourse', 'tool_generator'));
$mform->addElement('advcheckbox', 'updateuserspassword', get_string('updateuserspassword', 'tool_generator'));
$mform->addHelpButton('updateuserspassword', 'updateuserspassword', 'tool_generator');

View File

@ -71,25 +71,6 @@ class tool_generator_testplan_backend extends tool_generator_backend {
return $options;
}
/**
* Gets the list of courses that can be used used to generate a test.
*
* @return array The list of options as courseid => name
*/
public static function get_course_options() {
$courses = get_courses('all', 'c.sortorder ASC', 'c.id, c.shortname, c.fullname');
if (!$courses) {
print_error('error_nocourses', 'tool_generator');
}
$options = array();
unset($courses[1]);
foreach ($courses as $course) {
$options[$course->id] = $course->fullname . '(' . $course->shortname . ')';
}
return $options;
}
/**
* Getter for moodle-performance-comparison project URL.
*

View File

@ -0,0 +1,6 @@
This files describes API changes in core libraries and APIs,
information provided here is intended especially for developers.
=== 3.7 ===
* Function tool_generator_testplan_backend::get_course_options() is removed, the 'course' form element is used instead.