Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

MDL-39800 tags: Applied weight and ordering fix on all more page options

Also:
Fixed weight and ordering on more page show=all
Fixed weight and ordering on more page show=my
rationalised tag_print_cloud lines now identical
  • Loading branch information...
commit a01bd418656087460dcc4eed8b875c01900190d8 1 parent 555ad19
@jennymgray jennymgray authored damyon committed
Showing with 36 additions and 59 deletions.
  1. +36 −59 tag/coursetags_more.php
View
95 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 .= '<b>'.$showalltags.'</b>';
@@ -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 = '
- <div class="coursetag_more_title">
- <div style="padding-bottom:5px">'.$welcome.'</div>
- <div class="coursetag_more_link">'.$link1.'</div>
- <div class="coursetag_more_link">'.$link2.'</div>
- </div>
- <div class="coursetag_more_tags '.$fclass.'">'.
- $tags.'
- </div>';
+<div class="coursetag_more_title">
+<div style="padding-bottom:5px">'.$welcome.'</div>
+<div class="coursetag_more_link">'.$link1.'</div>
+<div class="coursetag_more_link">'.$link2.'</div>
+</div>
+<div class="coursetag_more_tags '.$fclass.'">'.
+$tags.'
+</div>';
echo $outstr;
echo $OUTPUT->footer();
Please sign in to comment.
Something went wrong with that request. Please try again.