1<?php
2/**
3 * @package tikiwiki
4 */
5// (c) Copyright by authors of the Tiki Wiki CMS Groupware Project
6//
7// All Rights Reserved. See copyright.txt for details and a complete list of authors.
8// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
9// $Id$
10
11require_once('tiki-setup.php');
12
13$access->check_feature('feature_stats', '', 'general');
14$access->check_permission('tiki_p_view_stats');
15
16require_once('lib/graph-engine/gd.php');
17require_once('lib/graph-engine/graph.bar.php');
18$statslib = TikiLib::lib('stats');
19
20//Define the object
21if (isset($_REQUEST["type"])) {
22	if ($_REQUEST["type"] == "daily") {
23		$renderer = new GD_GRenderer(450, 400);
24		$graph = new MultibarGraphic;
25		$data = $statslib->get_daily_usage_chart_data();
26		$graph->setTitle(tra('Daily Usage'));
27		$graph->setData(['x' => $data['xdata'], 'y0' => $data['ydata']]);
28		$graph->setParam('grid-independant-location', 'vertical');
29		$graph->setParam('grid-independant-major-font', 'Normal-Text');
30		$graph->setParam('grid-independant-major-guide', false);
31	}
32} else {
33	$renderer = new GD_GRenderer(450, 300);
34	$graph = new MultibarGraphic;
35	$data = $tikilib->get_usage_chart_data();
36	$graph->setTitle(tra('Usage'));
37	$graph->setData(['x' => $data['xdata'], 'y0' => $data['ydata']]);
38	$graph->setParam('grid-independant-location', 'vertical');
39	$graph->setParam('grid-independant-major-font', 'Normal-Text');
40	$graph->setParam('grid-independant-major-guide', false);
41}
42$graph->draw($renderer);
43$renderer->httpOutput('stats.png');
44