diff --git a/tag/coursetags_more.php b/tag/coursetags_more.php index cbfeaefd6d902..711f58030c2f8 100644 --- a/tag/coursetags_more.php +++ b/tag/coursetags_more.php @@ -97,68 +97,43 @@ // Prepare data for tags $courselink = ''; -if ($courseid) { $courselink = '&courseid='.$courseid; } +if ($courseid) { + $courselink = '&courseid='.$courseid; +} $myurl = $CFG->wwwroot.'/tag/coursetags_more.php'; $myurl2 = $CFG->wwwroot.'/tag/coursetags_more.php?show='.$show; +// Set up sort order global +$oldsort = $CFG->tagsort; +if ($sort == 'popularity') { + $CFG->tagsort = 'count'; +} else if ($sort == 'date') { + $CFG->tagsort = 'timemodified'; +} else { + $CFG->tagsort = 'name'; +} + // Course tags if ($show == 'course' and $courseid) { - - if ($sort == 'popularity') { - $tags = tag_print_cloud(coursetag_get_tags($courseid, 0, '', 0, 'popularity'), 150, true); - } else if ($sort == 'date') { - $tags = tag_print_cloud(coursetag_get_tags($courseid, 0, '', 0, 'timemodified'), 150, true); - } else { - $tags = tag_print_cloud(coursetag_get_tags($courseid, 0, '', 0, 'name'), 150, true); - } - -// My tags + $tags = tag_print_cloud(coursetag_get_tags($courseid, 0, '', 0, 'popularity'), 150, true); + // My tags } else if ($show == 'my' and $loggedin) { - - if ($sort == 'popularity') { - $tags = tag_print_cloud(coursetag_get_tags(0, $USER->id, 'default', 0, 'popularity'), 150, true); - } else if ($sort == 'date') { - $tags = tag_print_cloud(coursetag_get_tags(0, $USER->id, 'default', 0, 'timemodified'), 150, true); - } else { - $tags = tag_print_cloud(coursetag_get_tags(0, $USER->id, 'default', 0, 'name'), 150, true); - } - -// Official course tags + $tags = tag_print_cloud(coursetag_get_tags(0, $USER->id, 'default', 0, 'popularity'), 150, true); + // Official course tags } else if ($show == 'official') { - - if ($sort == 'popularity') { - $tags = tag_print_cloud(coursetag_get_tags(0, 0, 'official', 0, 'popularity'), 150, true); - } else if ($sort == 'date') { - $tags = tag_print_cloud(coursetag_get_tags(0, 0, 'official', 0, 'timemodified'), 150, true); - } else { - $tags = tag_print_cloud(coursetag_get_tags(0, 0, 'official', 0, 'name'), 150, true); - } - -// Community (official and personal together) also called user tags + $tags = tag_print_cloud(coursetag_get_tags(0, 0, 'official', 0, 'popularity'), 150, true); + // Community (official and personal together) also called user tags } else if ($show == 'community') { - - if ($sort == 'popularity') { - $tags = tag_print_cloud(coursetag_get_tags(0, 0, 'default', 0, 'popularity'), 150, true); - } else if ($sort == 'date') { - $tags = tag_print_cloud(coursetag_get_tags(0, 0, 'default', 0, 'timemodified'), 150, true); - } else { - $tags = tag_print_cloud(coursetag_get_tags(0, 0, 'default', 0, 'name'), 150, true); - } - -// All tags for courses and blogs and any thing else tagged - the fallback default ($show == all) + $tags = tag_print_cloud(coursetag_get_tags(0, 0, 'default', 0, 'popularity'), 150, true); + // All tags for courses and blogs and any thing else tagged - the fallback default ($show == all) } else { - $subtitle = $showalltags; - if ($sort == 'popularity') { - $tags = tag_print_cloud(coursetag_get_all_tags('popularity'), 150, true); - } else if ($sort == 'date') { - $tags = tag_print_cloud(coursetag_get_all_tags('timemodified'), 150, true); - } else { - $tags = tag_print_cloud(coursetag_get_all_tags('name'), 150, true); - } - + $tags = tag_print_cloud(coursetag_get_all_tags('popularity'), 150, true); } +// Reinstate original sort order global +$CFG->tagsort = $oldsort; + // Prepare the links for the show and order lines if ($show == 'all') { $link1 .= ''.$showalltags.''; @@ -209,16 +184,18 @@ // Prepare output $fclass = ''; // make the tags larger when there are not so many -if (strlen($tags) < 10000) { $fclass = 'coursetag_more_large'; } +if (strlen($tags) < 10000) { + $fclass = 'coursetag_more_large'; +} $outstr = ' -
-
'.$welcome.'
- - -
-
'. - $tags.' -
'; +
+
'.$welcome.'
+ + +
+
'. +$tags.' +
'; echo $outstr; echo $OUTPUT->footer();