MDL-52252 tags: course module tags small correction
This commit is contained in:
@@ -604,9 +604,7 @@ abstract class moodleform_mod extends moodleform {
|
||||
$mform->addElement('header', 'tagshdr', get_string('tags', 'tag'));
|
||||
$mform->addElement('tags', 'tags', get_string('tags'), array('itemtype' => 'course_modules', 'component' => 'core'));
|
||||
if ($this->_cm) {
|
||||
$modinfo = get_fast_modinfo($COURSE);
|
||||
$cm = $modinfo->get_cm($this->_cm->id);
|
||||
$tags = core_tag_tag::get_item_tags_array('core', 'course_modules', $cm->id);
|
||||
$tags = core_tag_tag::get_item_tags_array('core', 'course_modules', $this->_cm->id);
|
||||
$mform->setDefault('tags', $tags);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1521,9 +1521,12 @@ class core_course_courselib_testcase extends advanced_testcase {
|
||||
switch ($type) {
|
||||
case 'assign':
|
||||
// Add some tags to this assignment.
|
||||
core_tag_tag::set_item_tags('core', 'course_modules', $module->id, $modcontext, array('Tag 1', 'Tag 2', 'Tag 3'));
|
||||
core_tag_tag::set_item_tags('mod_assign', 'assign', $module->id, $modcontext, array('Tag 1', 'Tag 2', 'Tag 3'));
|
||||
core_tag_tag::set_item_tags('core', 'course_modules', $module->cmid, $modcontext, array('Tag 3', 'Tag 4', 'Tag 5'));
|
||||
|
||||
// Confirm the tag instances were added.
|
||||
$criteria = array('component' => 'mod_assign', 'itemtype' => 'assign', 'contextid' => $modcontext->id);
|
||||
$this->assertEquals(3, $DB->count_records('tag_instance', $criteria));
|
||||
$criteria = array('component' => 'core', 'itemtype' => 'course_modules', 'contextid' => $modcontext->id);
|
||||
$this->assertEquals(3, $DB->count_records('tag_instance', $criteria));
|
||||
|
||||
@@ -1565,6 +1568,9 @@ class core_course_courselib_testcase extends advanced_testcase {
|
||||
// Verify the tag instances were deleted.
|
||||
$criteria = array('component' => 'mod_assign', 'contextid' => $modcontext->id);
|
||||
$this->assertEquals(0, $DB->count_records('tag_instance', $criteria));
|
||||
|
||||
$criteria = array('component' => 'core', 'itemtype' => 'course_modules', 'contextid' => $modcontext->id);
|
||||
$this->assertEquals(0, $DB->count_records('tag_instance', $criteria));
|
||||
break;
|
||||
case 'quiz':
|
||||
// Verify category deleted.
|
||||
|
||||
Reference in New Issue
Block a user