tiki-cms_rankings.php 1.54 KB
Newer Older
lrargerich's avatar
lrargerich committed
1
<?php
changi67's avatar
changi67 committed
2 3 4
/**
 * @package tikiwiki
 */
5
// (c) Copyright by authors of the Tiki Wiki CMS Groupware Project
rjsmelo's avatar
rjsmelo committed
6
//
7 8
// All Rights Reserved. See copyright.txt for details and a complete list of authors.
// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
changi67's avatar
changi67 committed
9
// $Id$
10

11
$section = 'cms';
rjsmelo's avatar
rjsmelo committed
12 13 14
require_once('tiki-setup.php');
include_once('lib/rankings/ranklib.php');
$access->check_feature(['feature_articles', 'feature_cms_rankings']);
sylvieg's avatar
sylvieg committed
15
$access->check_permission('tiki_p_read_article');
lrargerich's avatar
lrargerich committed
16

rjsmelo's avatar
rjsmelo committed
17 18
$allrankings = [
	[
19
	'name' => tra('Top Articles'),
20
	'value' => 'cms_ranking_top_articles'
rjsmelo's avatar
rjsmelo committed
21 22
	],
	[
23 24
	'name' => tra('Top authors'),
	'value' => 'cms_ranking_top_authors'
rjsmelo's avatar
rjsmelo committed
25 26
	]
];
lrargerich's avatar
lrargerich committed
27

28 29
$smarty->assign('allrankings', $allrankings);

rjsmelo's avatar
rjsmelo committed
30
if (! isset($_REQUEST["which"])) {
31
	$which = 'cms_ranking_top_articles';
lrargerich's avatar
lrargerich committed
32
} else {
33
	$which = $_REQUEST["which"];
lrargerich's avatar
lrargerich committed
34 35
}

36
$smarty->assign('which', $which);
lrargerich's avatar
lrargerich committed
37 38

// Get the page from the request var or default it to HomePage
rjsmelo's avatar
rjsmelo committed
39
if (! isset($_REQUEST["limit"])) {
40
	$limit = 10;
lrargerich's avatar
lrargerich committed
41
} else {
42
	$limit = $_REQUEST["limit"];
lrargerich's avatar
lrargerich committed
43 44
}

45
$smarty->assign_by_ref('limit', $limit);
lrargerich's avatar
lrargerich committed
46 47 48 49 50

// Rankings:
// Top Pages
// Last pages
// Top Authors
rjsmelo's avatar
rjsmelo committed
51
$rankings = [];
lrargerich's avatar
lrargerich committed
52

53
$rk = $ranklib->$which($limit);
lrargerich's avatar
lrargerich committed
54 55
$rank["data"] = $rk["data"];
$rank["title"] = $rk["title"];
56
$rank["y"] = $rk["y"];
57
$rank["type"] = $rk["type"];
lrargerich's avatar
lrargerich committed
58 59
$rankings[] = $rank;

60 61
$smarty->assign_by_ref('rankings', $rankings);
$smarty->assign('rpage', 'tiki-cms_rankings.php');
62

rjsmelo's avatar
rjsmelo committed
63
include_once('tiki-section_options.php');
64 65 66

ask_ticket('cms_rankings');

lrargerich's avatar
lrargerich committed
67
// Display the template
68
$smarty->assign('mid', 'tiki-ranking.tpl');
69
$smarty->display("tiki.tpl");