From 62c33abaf0235fc5af2d03931a731d59c745aee3 Mon Sep 17 00:00:00 2001
From: zarzuelo <noreply@pandorafms.org>
Date: Wed, 10 Nov 2010 11:17:29 +0000
Subject: [PATCH] 2010-11-10  Sergio Martin <sergio.martin@artica.es>

	* include/functions_reporting.php
	include/functions.php
	operation/reporting/reporting_xml.php
	godmode/reporting/reporting_builder.item_editor.php: Added the
	simple baseline graph to the html and xml report exports



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@3563 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
---
 pandora_console/ChangeLog                     |  8 +++++++
 .../reporting_builder.item_editor.php         |  2 ++
 pandora_console/include/functions.php         |  1 +
 .../include/functions_reporting.php           | 23 +++++++++++++++++++
 .../operation/reporting/reporting_xml.php     |  4 ++++
 5 files changed, 38 insertions(+)

diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog
index e54488b53c..2a805de27d 100644
--- a/pandora_console/ChangeLog
+++ b/pandora_console/ChangeLog
@@ -1,3 +1,11 @@
+2010-11-10  Sergio Martin <sergio.martin@artica.es>
+
+	* include/functions_reporting.php
+	include/functions.php
+	operation/reporting/reporting_xml.php
+	godmode/reporting/reporting_builder.item_editor.php: Added the
+	simple baseline graph to the html and xml report exports
+
 2010-11-08  Sancho Lerena <slerena@artica.es>
 
 	* pandora_console.spec: Updated version/build.
diff --git a/pandora_console/godmode/reporting/reporting_builder.item_editor.php b/pandora_console/godmode/reporting/reporting_builder.item_editor.php
index 7e4a355ca5..54a03ca837 100644
--- a/pandora_console/godmode/reporting/reporting_builder.item_editor.php
+++ b/pandora_console/godmode/reporting/reporting_builder.item_editor.php
@@ -62,6 +62,7 @@ switch ($action) {
 				$idAgentModule = $item['id_agent_module'];
 				$idAgent = get_db_value_filter('id_agente', 'tagente_modulo', array('id_agente_modulo' => $idAgentModule));
 				break;
+			case 'simple_baseline_graph':
 			case 'simple_graph':
 				$description = $item['description'];
 				$idAgentModule = $item['id_agent_module'];
@@ -600,6 +601,7 @@ function chooseType() {
 			$("#row_group").css('display', '');
 			break;
 		case 'simple_graph':
+		case 'simple_baseline_graph':
 			$("#row_description").css('display', '');
 			$("#row_agent").css('display', '');
 			$("#row_module").css('display', '');
diff --git a/pandora_console/include/functions.php b/pandora_console/include/functions.php
index 8d8e763961..964e69b96b 100644
--- a/pandora_console/include/functions.php
+++ b/pandora_console/include/functions.php
@@ -620,6 +620,7 @@ function get_alert_times ($row2) {
 function get_report_types () {
 	$types = array ();
 	$types['simple_graph'] = __('Simple graph');
+	$types['simple_baseline_graph'] = __('Simple baseline graph');
 	$types['custom_graph'] = __('Custom graph');
 	$types['SLA'] = __('S.L.A.');
 	$types['monitor_report'] = __('Monitor report');
diff --git a/pandora_console/include/functions_reporting.php b/pandora_console/include/functions_reporting.php
index f97f28c4e7..0e041ee266 100644
--- a/pandora_console/include/functions_reporting.php
+++ b/pandora_console/include/functions_reporting.php
@@ -1661,6 +1661,29 @@ function render_report_html_item ($content, $table, $report, $mini = false) {
 			array_push ($table->data, $data);
 			
 			break;
+			
+		case 'simple_baseline_graph':
+			//RUNNING
+			$table->colspan[1][0] = 4;
+			$data = array ();
+			$data[0] = $sizh.__('Simple baseline graph').$sizhfin;
+			$data[1] = $sizh.$agent_name.' - '.$module_name.$sizhfin;
+			$data[2] = $sizh.human_time_description ($content['period']).$sizhfin;
+			array_push ($table->data, $data);
+			
+			// Put description at the end of the module (if exists)
+			if ($content["description"] != ""){
+				$table->colspan[2][0] = 4;
+				$data_desc = array();
+				$data_desc[0] = $content["description"];
+				array_push ($table->data, $data_desc);
+			}
+			
+			$data = array ();
+			$data[0] = '<img src="include/fgraph.php?tipo=sparse&id='.$content['id_agent_module'].'&height='.$sizgraph_h.'&width='.$sizgraph_w.'&period='.$content['period'].'&date='.$report["datetime"].'&avg_only=1&baseline=1&pure=1" border="0" alt="">';
+			array_push ($table->data, $data);
+			
+			break;
 
 		case 2:
 		case 'custom_graph':
diff --git a/pandora_console/operation/reporting/reporting_xml.php b/pandora_console/operation/reporting/reporting_xml.php
index b3be6c32dc..430d65b92a 100644
--- a/pandora_console/operation/reporting/reporting_xml.php
+++ b/pandora_console/operation/reporting/reporting_xml.php
@@ -180,6 +180,10 @@ foreach ($contents as $content) {
 			$data["title"] = __('Simple graph');
 			$data["objdata"]["img"] = 'include/fgraph.php?PHPSESSID='.$session_id.'&amp;tipo=sparse&amp;id='.$content['id_agent_module'].'&amp;height=230&amp;width=720&amp;period='.$content['period'].'&amp;date='.$datetime.'&amp;avg_only=1&amp;pure=1';
 			break;
+		case 'simple_baseline_graph':	
+			$data["title"] = __('Simple baseline graph');
+			$data["objdata"]["img"] = 'include/fgraph.php?PHPSESSID='.$session_id.'&amp;tipo=sparse&amp;id='.$content['id_agent_module'].'&amp;height=230&amp;width=720&amp;period='.$content['period'].'&amp;date='.$datetime.'&amp;avg_only=1&amp;baseline=1&amp;pure=1';
+			break;
 		case 2:
 		case 'custom_graph':
 			$graph = get_db_row ("tgraph", "id_graph", $content['id_gs']);