1<?php 2// (c) Copyright by authors of the Tiki Wiki CMS Groupware Project 3// 4// All Rights Reserved. See copyright.txt for details and a complete list of authors. 5// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details. 6// $Id$ 7 8//this script may only be included - so its better to die if called directly. 9if (strpos($_SERVER["SCRIPT_NAME"], basename(__FILE__)) !== false) { 10 header("location: index.php"); 11 exit; 12} 13 14/** 15 * @return array 16 */ 17function module_forums_most_read_topics_info() 18{ 19 return [ 20 'name' => tra('Top Visited Forum Topics'), 21 'description' => tra('Display the specified number of the forum topics with the most reads.'), 22 'prefs' => ['feature_forums'], 23 'params' => [], 24 'common_params' => ['nonums', 'rows'] 25 ]; 26} 27 28/** 29 * @param $mod_reference 30 * @param $module_params 31 */ 32function module_forums_most_read_topics($mod_reference, $module_params) 33{ 34 $smarty = TikiLib::lib('smarty'); 35 global $ranklib; 36 include_once('lib/rankings/ranklib.php'); 37 38 if (isset($module_params['forumId'])) { 39 if (strstr($module_params['forumId'], ':')) { 40 $forumId = explode(':', $module_params['forumId']); 41 } else { 42 $forumId = $module_params['forumId']; 43 } 44 } else { 45 $forumId = ''; 46 } 47 48 $ranking = $ranklib->forums_ranking_most_read_topics($mod_reference["rows"], $forumId); 49 $smarty->assign('modForumsMostReadTopics', $ranking["data"]); 50} 51