Skip to content

Commit

Permalink
MDL-39800 tags: Applied weight and ordering fix on all more page options
Browse files Browse the repository at this point in the history
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
Jenny Gray authored and Damyon Wiese committed Aug 20, 2013
1 parent df428ba commit 5ea6ac9
Showing 1 changed file with 36 additions and 59 deletions.
95 changes: 36 additions & 59 deletions tag/coursetags_more.php
Original file line number Diff line number Diff line change
Expand Up @@ -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>';
Expand Down Expand Up @@ -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();

0 comments on commit 5ea6ac9

Please sign in to comment.