Commit f1affe15 authored by changi67's avatar changi67

[FIX] tsort_mode did never work

parent 63e4cca1
......@@ -981,7 +981,7 @@ class FreetagLib extends ObjectLib
* - 'count' => The number of objects tagged with this tag.
*/
function get_most_popular_tags($user = '', $offset = 0, $maxRecords = 25, $type=null, $objectId=null)
function get_most_popular_tags($user = '', $offset = 0, $maxRecords = 25, $type=null, $objectId=null, $tsort_mode='tag_asc')
{
$join = '';
......@@ -990,7 +990,7 @@ class FreetagLib extends ObjectLib
if (!empty($type) || !empty($objectId)) {
$join .= ' LEFT JOIN `tiki_objects` tob on (tob.`objectId`= tfo.`objectId`)';
$mid .= ' AND `type` = ?';
$mid2 = 'WHERE `type`=?';
$mid2 = 'WHERE `type`=?';
$bindvals[] = $type;
if (!empty($objectId)) {
$join .= ' LEFT JOIN `tiki_blog_posts` tbp on (tob.`itemId` = tbp.`postId`)';
......@@ -1038,9 +1038,15 @@ class FreetagLib extends ObjectLib
$ret[] = $row;
}
array_multisort($tag, SORT_ASC, $count, SORT_DESC, $ret);
switch ($tsort_mode) {
case 'count_desc':
array_multisort($count, SORT_DESC,$tag, SORT_ASC, $ret);
break;
case 'tag_asc':
default:
array_multisort($tag, SORT_ASC, $count, SORT_DESC, $ret);
break;
}
return $ret;
}
......
......@@ -111,7 +111,7 @@ if ($prefs['feature_blogs'] == 'y' && $type == 'blog post') {
$smarty->assign('blogs', $blogs['data']);
}
$most_popular_tags = $freetaglib->get_most_popular_tags('', 0, $maxPopular, $type, $objectId);
$most_popular_tags = $freetaglib->get_most_popular_tags('', 0, $maxPopular, $type, $objectId, $tsort_mode);
if (!empty($prefs['freetags_cloud_colors'])) {
$colors = explode(',', $prefs['freetags_cloud_colors']);
$prev = '';
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment