mirror of
https://github.com/moodle/moodle.git
synced 2025-04-14 13:02:07 +02:00
Merge branch 'MDL-51131-master' of git://github.com/marinaglancy/moodle
This commit is contained in:
commit
d0efe9a080
@ -315,14 +315,16 @@ function coursetag_get_tagged_courses($tagid) {
|
||||
function coursetag_delete_course_tags($courseid, $showfeedback=false) {
|
||||
global $DB, $OUTPUT;
|
||||
|
||||
if ($taginstances = $DB->get_fieldset_select('tag_instance', 'tagid', "itemtype = 'course' AND itemid = :courseid",
|
||||
array('courseid' => $courseid))) {
|
||||
if ($taginstances = $DB->get_recordset_select('tag_instance', "itemtype = 'course' AND itemid = :courseid",
|
||||
array('courseid' => $courseid), '', 'tagid, tiuserid')) {
|
||||
|
||||
tag_delete(array_values($taginstances));
|
||||
foreach ($taginstances as $record) {
|
||||
tag_delete_instance('course', $courseid, $record->tagid, $record->tiuserid);
|
||||
}
|
||||
$taginstances->close();
|
||||
}
|
||||
|
||||
if ($showfeedback) {
|
||||
echo $OUTPUT->notification(get_string('deletedcoursetags', 'tag'), 'notifysuccess');
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -452,7 +452,7 @@ class core_tag_events_testcase extends advanced_testcase {
|
||||
$sink = $this->redirectEvents();
|
||||
coursetag_delete_course_tags($course->id);
|
||||
$events = $sink->get_events();
|
||||
$events = array($events[2], $events[3]);
|
||||
$events = array($events[1], $events[3]);
|
||||
|
||||
// Check that the tags were deleted and the events data is valid.
|
||||
$this->assertEquals(0, $DB->count_records('tag'));
|
||||
|
Loading…
x
Reference in New Issue
Block a user