tiki-usage_chart.php 1.52 KB
Newer Older
1
<?php
changi67's avatar
changi67 committed
2 3 4
/**
 * @package tikiwiki
 */
5
// (c) Copyright 2002-2015 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

13 14
$access->check_feature('feature_stats', '', 'general');
$access->check_permission('tiki_p_view_stats');
15 16 17

require_once ('lib/graph-engine/gd.php');
require_once ('lib/graph-engine/graph.bar.php');
18
$statslib = TikiLib::lib('stats');
19

20
//Define the object
21
if (isset($_REQUEST["type"])) {
changi67's avatar
changi67 committed
22
	if ($_REQUEST["type"] == "daily") {
23 24
		$renderer = new GD_GRenderer(450, 400);
		$graph = new MultibarGraphic;
25
		$data = $statslib->get_daily_usage_chart_data();
changi67's avatar
changi67 committed
26 27 28 29 30
		$graph->setTitle(tra('Daily Usage'));
		$graph->setData(array('x' => $data['xdata'], 'y0' => $data['ydata']));
		$graph->setParam('grid-independant-location', 'vertical');
		$graph->setParam('grid-independant-major-font', 'Normal-Text');
		$graph->setParam('grid-independant-major-guide', false);
31 32
	}
} else {
33 34
	$renderer = new GD_GRenderer(450, 300);
	$graph = new MultibarGraphic;
35
	$data = $tikilib->get_usage_chart_data();
changi67's avatar
changi67 committed
36 37 38 39 40
	$graph->setTitle(tra('Usage'));
	$graph->setData(array('x' => $data['xdata'], 'y0' => $data['ydata']));
	$graph->setParam('grid-independant-location', 'vertical');
	$graph->setParam('grid-independant-major-font', 'Normal-Text');
	$graph->setParam('grid-independant-major-guide', false);
41
}
changi67's avatar
changi67 committed
42 43
$graph->draw($renderer);
$renderer->httpOutput('stats.png');