mirror of
https://github.com/moodle/moodle.git
synced 2025-04-21 16:32:18 +02:00
MDL-50851 tool_uploadcourse: allow to set tags
This commit is contained in:
parent
ac840cf487
commit
54f63cd11b
@ -659,6 +659,10 @@ class tool_uploadcourse_course {
|
||||
$this->data = $coursedata;
|
||||
$this->enrolmentdata = tool_uploadcourse_helper::get_enrolment_data($this->rawdata);
|
||||
|
||||
if (isset($this->rawdata['tags']) && strval($this->rawdata['tags']) !== '') {
|
||||
$this->data['tags'] = preg_split('/\s*,\s*/', trim($this->rawdata['tags']), -1, PREG_SPLIT_NO_EMPTY);
|
||||
}
|
||||
|
||||
// Restore data.
|
||||
// TODO Speed up things by not really extracting the backup just yet, but checking that
|
||||
// the backup file or shortname passed are valid. Extraction should happen in proceed().
|
||||
|
@ -261,6 +261,7 @@ class tool_uploadcourse_course_testcase extends advanced_testcase {
|
||||
'groupmode' => '2',
|
||||
'groupmodeforce' => '1',
|
||||
'enablecompletion' => '1',
|
||||
'tags' => 'Cat, Dog',
|
||||
|
||||
'role_teacher' => 'Knight',
|
||||
'role_manager' => 'Jedi',
|
||||
@ -297,6 +298,7 @@ class tool_uploadcourse_course_testcase extends advanced_testcase {
|
||||
$this->assertEquals($data['groupmode'], $course->groupmode);
|
||||
$this->assertEquals($data['groupmodeforce'], $course->groupmodeforce);
|
||||
$this->assertEquals($data['enablecompletion'], $course->enablecompletion);
|
||||
$this->assertEquals($data['tags'], join(', ', core_tag_tag::get_item_tags_array('core', 'course', $course->id)));
|
||||
|
||||
// Roles.
|
||||
$roleids = array();
|
||||
|
Loading…
x
Reference in New Issue
Block a user