tiki-stats.php 3.52 KB
Newer Older
lrargerich's avatar
lrargerich committed
1
<?php
changi67's avatar
changi67 committed
2 3 4
/**
 * @package tikiwiki
 */
5
// (c) Copyright 2002-2016 by authors of the Tiki Wiki CMS Groupware Project
changi67's avatar
changi67 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 10
// $Id$

11
require_once ('tiki-setup.php');
12
$statslib = TikiLib::lib('stats');
13 14 15

$access->check_feature('feature_stats');
$access->check_permission('tiki_p_view_stats');
16

changi67's avatar
changi67 committed
17
if (!isset($_REQUEST["days"])) $_REQUEST["days"] = 7;
18 19 20
$smarty->assign('pv_chart', 'n');
if (isset($_REQUEST["pv_chart"])) {
	$smarty->assign('pv_chart', 'y');
lrargerich's avatar
lrargerich committed
21
}
22 23 24 25
$smarty->assign('days', $_REQUEST["days"]);
$smarty->assign('usage_chart', 'n');
if (isset($_REQUEST["chart"])) {
	$smarty->assign($_REQUEST["chart"] . "_chart", 'y');
26
}
27
if ($prefs['feature_wiki'] == "y") {
28 29 30 31
	$wiki_stats = $statslib->wiki_stats();
} else {
	$wiki_stats = false;
}
32
$smarty->assign_by_ref('wiki_stats', $wiki_stats);
33
if ($prefs['feature_galleries'] == 'y') {
34 35 36 37
	$igal_stats = $statslib->image_gal_stats();
} else {
	$igal_stats = false;
}
38
$smarty->assign_by_ref('igal_stats', $igal_stats);
39
if ($prefs['feature_file_galleries'] == 'y') {
40 41
	$fgal_stats = $statslib->file_gal_stats();
} else {
changi67's avatar
changi67 committed
42
	$fgal_stats = false;
43
}
44
$smarty->assign_by_ref('fgal_stats', $fgal_stats);
45
if ($prefs['feature_articles'] == 'y') {
46 47
	$cms_stats = $statslib->cms_stats();
} else {
changi67's avatar
changi67 committed
48
	$cms_stats = false;
49
}
50
$smarty->assign_by_ref('cms_stats', $cms_stats);
51
if ($prefs['feature_forums'] == 'y') {
52 53 54 55
	$forum_stats = $statslib->forum_stats();
} else {
	$forum_stats = false;
}
56
$smarty->assign_by_ref('forum_stats', $forum_stats);
57
if ($prefs['feature_blogs'] == 'y') {
58 59
	$blog_stats = $statslib->blog_stats();
} else {
changi67's avatar
changi67 committed
60
	$blog_stats = false;
61
}
62
$smarty->assign_by_ref('blog_stats', $blog_stats);
63
if ($prefs['feature_polls'] == 'y') {
64 65 66 67
	$poll_stats = $statslib->poll_stats();
} else {
	$poll_stats = false;
}
68
$smarty->assign_by_ref('poll_stats', $poll_stats);
69
if ($prefs['feature_faqs'] == 'y') {
70 71 72 73
	$faq_stats = $statslib->faq_stats();
} else {
	$faq_stats = false;
}
74
$smarty->assign_by_ref('faq_stats', $faq_stats);
75
if ($prefs['feature_quizzes'] == 'y') {
76 77 78 79 80
	$quiz_stats = $statslib->quiz_stats();
} else {
	$quiz_stats = false;
}
$smarty->assign_by_ref('quiz_stats', $quiz_stats);
lrargerich's avatar
lrargerich committed
81
$user_stats = $statslib->user_stats();
82
$smarty->assign_by_ref('user_stats', $user_stats);
lrargerich's avatar
lrargerich committed
83
$site_stats = $statslib->site_stats();
84
$smarty->assign_by_ref('site_stats', $site_stats);
85 86 87
if (isset($_REQUEST['startDate_Year']) || isset($_REQUEST['endDate_Year'])) {
	$start_date = $tikilib->make_time(23, 59, 59, $_REQUEST['startDate_Month'], $_REQUEST['startDate_Day'], $_REQUEST['startDate_Year']);
	$end_date = $tikilib->make_time(23, 59, 59, $_REQUEST['endDate_Month'], $_REQUEST['endDate_Day'], $_REQUEST['endDate_Year']);
88 89
	$smarty->assign('startDate', $start_date);
	$smarty->assign('endDate', $end_date);
90 91 92
} else {
	$start_date = $site_stats['started'];
	$end_date = $tikilib->make_time(23, 59, 59, date("m"), date("d"), date("Y"));
93
	$smarty->assign('startDate', $start_date);
94 95 96
}
$smarty->assign('start_year', date('Y', $site_stats['started']));
$smarty->assign('end_year', date('Y', $tikilib->now));
changi67's avatar
changi67 committed
97
$best_objects_stats_lastweek = $statslib->best_overall_object_stats(20, 7);
98
$smarty->assign_by_ref('best_objects_stats_lastweek', $best_objects_stats_lastweek);
99 100
$best_objects_stats_between = $statslib->best_overall_object_stats(20, 0, $start_date, $end_date);
$smarty->assign_by_ref('best_objects_stats_between', $best_objects_stats_between);
101

102
ask_ticket('stats');
103
$smarty->assign('mid', 'tiki-stats.tpl');
104
$smarty->display("tiki.tpl");