mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-28 08:14:38 +02:00
2011-12-15 Juan Manuel Ramon <juanmanuel.ramon@artica.es>
* include/functions_forecast.php include/functions_reporting.php: Added CSV functionality for projection and prediction reports. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@5267 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
caf68f8827
commit
5fd9e4c9f8
@ -1,3 +1,9 @@
|
|||||||
|
2011-12-15 Juan Manuel Ramon <juanmanuel.ramon@artica.es>
|
||||||
|
|
||||||
|
* include/functions_forecast.php
|
||||||
|
include/functions_reporting.php: Added CSV functionality for
|
||||||
|
projection and prediction reports.
|
||||||
|
|
||||||
2011-12-15 Tomas Palacios <tomas.palacios@artica.es>
|
2011-12-15 Tomas Palacios <tomas.palacios@artica.es>
|
||||||
|
|
||||||
* include/languages: Updated template, .po and .mo files.
|
* include/languages: Updated template, .po and .mo files.
|
||||||
|
@ -27,10 +27,11 @@
|
|||||||
* @param int Period of the prediction or false to use it in prediction_date function (see below).
|
* @param int Period of the prediction or false to use it in prediction_date function (see below).
|
||||||
* @param int Maximun value using this function for prediction_date.
|
* @param int Maximun value using this function for prediction_date.
|
||||||
* @param int Minimun value using this function for prediction_date.
|
* @param int Minimun value using this function for prediction_date.
|
||||||
|
* @param bool Result data for CSV file exportation.
|
||||||
*
|
*
|
||||||
* @return array Void array or prediction of the module data.
|
* @return array Void array or prediction of the module data.
|
||||||
*/
|
*/
|
||||||
function forecast_projection_graph($module_id, $period = 5184000, $prediction_period, $max_value = false, $min_value = false){
|
function forecast_projection_graph($module_id, $period = 5184000, $prediction_period, $max_value = false, $min_value = false, $csv = false){
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
$module_data=grafico_modulo_sparse ($module_id, $period, 0,
|
$module_data=grafico_modulo_sparse ($module_id, $period, 0,
|
||||||
@ -169,10 +170,17 @@ function forecast_projection_graph($module_id, $period = 5184000, $prediction_pe
|
|||||||
|
|
||||||
// Aplying linear regression to module data in order to do the prediction
|
// Aplying linear regression to module data in order to do the prediction
|
||||||
$output_data = array();
|
$output_data = array();
|
||||||
|
$idx = 0;
|
||||||
// Create data in graph format like
|
// Create data in graph format like
|
||||||
while ($in_range){
|
while ($in_range){
|
||||||
$timestamp_f = date($time_format, $current_ts);
|
$timestamp_f = date($time_format, $current_ts);
|
||||||
$output_data[$timestamp_f] = ($a + ($b * $current_ts));
|
if ($csv){
|
||||||
|
$output_data[$idx]['date'] = $current_ts;
|
||||||
|
$output_data[$idx]['data'] = ($a + ($b * $current_ts));
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$output_data[$timestamp_f] = ($a + ($b * $current_ts));
|
||||||
|
}
|
||||||
// Using this function for prediction_date
|
// Using this function for prediction_date
|
||||||
if ($prediction_period == false){
|
if ($prediction_period == false){
|
||||||
// This statements stop the prediction when interval is greater than 4 years
|
// This statements stop the prediction when interval is greater than 4 years
|
||||||
@ -188,6 +196,7 @@ function forecast_projection_graph($module_id, $period = 5184000, $prediction_pe
|
|||||||
$in_range = false;
|
$in_range = false;
|
||||||
}
|
}
|
||||||
$current_ts = $current_ts + $agent_interval;
|
$current_ts = $current_ts + $agent_interval;
|
||||||
|
$idx++;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $output_data;
|
return $output_data;
|
||||||
|
@ -2166,7 +2166,7 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
|
|||||||
$intervals_text = $content['text'];
|
$intervals_text = $content['text'];
|
||||||
$max_interval = substr($intervals_text, 0, strpos($intervals_text, ';'));
|
$max_interval = substr($intervals_text, 0, strpos($intervals_text, ';'));
|
||||||
$min_interval = substr($intervals_text, strpos($intervals_text, ';') + 1);
|
$min_interval = substr($intervals_text, strpos($intervals_text, ';') + 1);
|
||||||
$value = forecast_prediction_date ($content['id_agent_module'], $content['period'], $max_interval, $min_interval);
|
$value = forecast_prediction_date ($content['id_agent_module'], $content['period'], $max_interval, $min_interval);
|
||||||
|
|
||||||
if ($value === false) {
|
if ($value === false) {
|
||||||
$value = __('Unknown');
|
$value = __('Unknown');
|
||||||
|
Loading…
x
Reference in New Issue
Block a user