From f9caf56869dda76f8d8d9f736547fb46ba296bd0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andreas=20=C3=85kre=20Solberg?= <andreas.solberg@uninett.no>
Date: Mon, 1 Dec 2008 12:50:47 +0000
Subject: [PATCH] Adding configuration option for dimensions in pixels on
 statistics graphical frontend

git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@1037 44740490-163a-0410-bde0-09ae8108e29a
---
 modules/statistics/config-templates/statistics.php | 4 ++++
 modules/statistics/extlibs/loganalyzer.php         | 4 ++++
 modules/statistics/www/showstats.php               | 5 +++--
 3 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/modules/statistics/config-templates/statistics.php b/modules/statistics/config-templates/statistics.php
index 57d7ca637..61e74c7fa 100644
--- a/modules/statistics/config-templates/statistics.php
+++ b/modules/statistics/config-templates/statistics.php
@@ -13,6 +13,10 @@ $config = array (
 	'datelength' => 15,
 	'offsetspan' => 21,
 	
+	// Dimensions on graph from Google Charts in pixels...
+	'dimension.x' => 800,
+	'dimension.y' => 350,
+	
 	/*
 	 * Do you want to generate statistics using the cron module? If so, specify which cron tag to use.
 	 * Examples: daily, weekly
diff --git a/modules/statistics/extlibs/loganalyzer.php b/modules/statistics/extlibs/loganalyzer.php
index dfcb8e61d..a67a802c0 100755
--- a/modules/statistics/extlibs/loganalyzer.php
+++ b/modules/statistics/extlibs/loganalyzer.php
@@ -29,8 +29,12 @@ foreach ($logfile AS $logline) {
 	$content = $logparser->parseContent($logline);
 	$action = $content[4];
 	
+	
 	// Iterate all the statrules from config.
 	foreach ($statrules AS $rulename => $rule) {
+	
+		// echo 'Comparing action: [' . $rule['action'] . '] with [' . $action . ']';
+	
 		$timeslot = $datehandler->toSlot($epoch, $rule['slot']);
 		$fileslot = $datehandler->toSlot($epoch, $rule['fileslot']); //print_r($content);
 		if (isset($rule['action']) && ($action !== $rule['action'])) continue;
diff --git a/modules/statistics/www/showstats.php b/modules/statistics/www/showstats.php
index af907cac3..1f6d94c64 100644
--- a/modules/statistics/www/showstats.php
+++ b/modules/statistics/www/showstats.php
@@ -151,8 +151,9 @@ foreach($results AS $slot => $res) {
 $axis[] =  $datehandler->prettyDateSlot($lastslot+1, $slotsize, $dateformat_intra); 
 #print_r($axis);
 
-
-$grapher = new sspmod_statistics_Graph_GoogleCharts(800, 350);
+$dimx = $statconfig->getValue('dimension.x', 800);
+$dimy = $statconfig->getValue('dimension.y', 350);
+$grapher = new sspmod_statistics_Graph_GoogleCharts($dimx, $dimy);
 
 $t = new SimpleSAML_XHTML_Template($config, 'statistics:statistics-tpl.php');
 $t->data['header'] = 'stat';
-- 
GitLab