tiki-cms_rankings.php 1.59 KB
Newer Older
lrargerich's avatar
lrargerich committed
1
<?php
2
// (c) Copyright 2002-2011 by authors of the Tiki Wiki CMS Groupware Project
changi67's avatar
changi67 committed
3
// 
4 5
// 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
6
// $Id$
7

mose's avatar
mose committed
8
$section = 'cms';
9
require_once ('tiki-setup.php');
lrargerich's avatar
lrargerich committed
10

11 12
include_once ('lib/rankings/ranklib.php');

13 14
$smarty->assign('headtitle',tra('Rankings'));

15
$access->check_feature(array('feature_articles', 'feature_cms_rankings'));
sylvieg's avatar
typo  
sylvieg committed
16
$access->check_permission('tiki_p_read_article');
lrargerich's avatar
lrargerich committed
17

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

29 30 31 32
$smarty->assign('allrankings', $allrankings);

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

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

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

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

// Rankings:
// Top Pages
// Last pages
// Top Authors
52
$rankings = array();
lrargerich's avatar
lrargerich committed
53

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

61 62
$smarty->assign_by_ref('rankings', $rankings);
$smarty->assign('rpage', 'tiki-cms_rankings.php');
mose's avatar
mose committed
63

64
include_once ('tiki-section_options.php');
65 66 67

ask_ticket('cms_rankings');

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