tiki-file_galleries_rankings.php 1.88 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 8 9

require_once ('tiki-setup.php');
include_once ('lib/rankings/ranklib.php');
10
$access->check_feature(array('feature_file_galleries','feature_file_galleries_rankings'));
lrargerich's avatar
lrargerich committed
11

12
if ((isset($tiki_p_list_file_galleries) && $tiki_p_list_file_galleries != 'y') || (!isset($tiki_p_list_file_galleries) && $tiki_p_view_file_gallery != 'y')) {
13
	$smarty->assign('errortype', 401);
14
	$smarty->assign('msg', tra("You do not have permission to view this section"));
15
	$smarty->display("error.tpl");
16
	die;
lrargerich's avatar
lrargerich committed
17 18
}

19 20 21 22 23 24 25 26 27 28 29 30 31
$allrankings = array(
	array(
	'name' => tra('Top visited file galleries'),
	'value' => 'filegal_ranking_top_galleries'
),
	array(
	'name' => tra('Most downloaded files'),
	'value' => 'filegal_ranking_top_files'
),
	array(
	'name' => tra('Last files'),
	'value' => 'filegal_ranking_last_files'
),
lrargerich's avatar
lrargerich committed
32 33
);

34 35 36 37
$smarty->assign('allrankings', $allrankings);

if (!isset($_REQUEST["which"])) {
	$which = 'filegal_ranking_top_files';
lrargerich's avatar
lrargerich committed
38
} else {
39
	$which = $_REQUEST["which"];
lrargerich's avatar
lrargerich committed
40 41
}

42
$smarty->assign('which', $which);
lrargerich's avatar
lrargerich committed
43 44

// Get the page from the request var or default it to HomePage
45 46
if (!isset($_REQUEST["limit"])) {
	$limit = 10;
lrargerich's avatar
lrargerich committed
47
} else {
48
	$limit = $_REQUEST["limit"];
lrargerich's avatar
lrargerich committed
49 50
}

51
$smarty->assign_by_ref('limit', $limit);
lrargerich's avatar
lrargerich committed
52 53 54 55 56

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

59
$rk = $ranklib->$which($limit);
lrargerich's avatar
lrargerich committed
60 61
$rank["data"] = $rk["data"];
$rank["title"] = $rk["title"];
62
$rank["y"] = $rk["y"];
63
$rank["type"] = $rk["type"];
lrargerich's avatar
lrargerich committed
64 65
$rankings[] = $rank;

66 67
$smarty->assign_by_ref('rankings', $rankings);
$smarty->assign('rpage', 'tiki-file_galleries_rankings.php');
68 69
ask_ticket('fgal-rankings');

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