mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-31 01:35:36 +02:00
fixed errors php and slicebars change version php7
This commit is contained in:
parent
d84427b014
commit
3c62388f0e
@ -112,22 +112,19 @@ if (file_exists ('languages/'.$user_language.'.mo')) {
|
|||||||
$aux_font_size = $config['font_size'];
|
$aux_font_size = $config['font_size'];
|
||||||
$config['font_size'] = $config['font_size'] + 3;
|
$config['font_size'] = $config['font_size'] + 3;
|
||||||
|
|
||||||
if($type_graph_pdf == 'combined'){
|
echo '<div>';
|
||||||
echo '<div>';
|
switch ($type_graph_pdf) {
|
||||||
|
case 'combined':
|
||||||
echo graphic_combined_module(
|
echo graphic_combined_module(
|
||||||
$module_list,
|
$module_list,
|
||||||
$params,
|
$params,
|
||||||
$params_combined
|
$params_combined
|
||||||
);
|
);
|
||||||
echo '</div>';
|
break;
|
||||||
}
|
case 'sparse':
|
||||||
elseif($type_graph_pdf == 'sparse'){
|
|
||||||
echo '<div>';
|
|
||||||
echo grafico_modulo_sparse($params);
|
echo grafico_modulo_sparse($params);
|
||||||
echo '</div>';
|
break;
|
||||||
}
|
case 'pie_chart':
|
||||||
elseif($type_graph_pdf == 'pie_chart'){
|
|
||||||
echo '<div>';
|
|
||||||
echo flot_pie_chart(
|
echo flot_pie_chart(
|
||||||
$params['values'],
|
$params['values'],
|
||||||
$params['keys'],
|
$params['keys'],
|
||||||
@ -140,8 +137,68 @@ if (file_exists ('languages/'.$user_language.'.mo')) {
|
|||||||
$params['colors'],
|
$params['colors'],
|
||||||
$params['hide_labels']
|
$params['hide_labels']
|
||||||
);
|
);
|
||||||
echo '</div>';
|
break;
|
||||||
|
case 'vbar':
|
||||||
|
echo flot_vcolumn_chart(
|
||||||
|
$params['chart_data'],
|
||||||
|
$params['width'],
|
||||||
|
$params['height'],
|
||||||
|
$params['color'],
|
||||||
|
$params['legend'],
|
||||||
|
$params['long_index'],
|
||||||
|
$params['homeurl'],
|
||||||
|
$params['unit'],
|
||||||
|
$params['water_mark_url'],
|
||||||
|
$params['homedir'],
|
||||||
|
$params['font'],
|
||||||
|
$params['font_size'],
|
||||||
|
$params['from_ux'],
|
||||||
|
$params['from_wux'],
|
||||||
|
$params['backgroundColor'],
|
||||||
|
$params['tick_color']
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
case 'hbar':
|
||||||
|
echo flot_hcolumn_chart(
|
||||||
|
$params['chart_data'],
|
||||||
|
$params['width'],
|
||||||
|
$params['height'],
|
||||||
|
$params['water_mark_url'],
|
||||||
|
$params['font'],
|
||||||
|
$params['font_size'],
|
||||||
|
$params['backgroundColor'],
|
||||||
|
$params['tick_color'],
|
||||||
|
$params['val_min'],
|
||||||
|
$params['val_max']
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
case 'ring_graph':
|
||||||
|
echo flot_custom_pie_chart (
|
||||||
|
$params['chart_data'],
|
||||||
|
$params['width'],
|
||||||
|
$params['height'],
|
||||||
|
$params['colors'],
|
||||||
|
$params['module_name_list'],
|
||||||
|
$params['long_index'],
|
||||||
|
$params['no_data'],
|
||||||
|
false,
|
||||||
|
'',
|
||||||
|
$params['water_mark'],
|
||||||
|
$params['font'],
|
||||||
|
$params['font_size'],
|
||||||
|
$params['unit'],
|
||||||
|
$params['ttl'],
|
||||||
|
$params['homeurl'],
|
||||||
|
$params['background_color'],
|
||||||
|
$params['legend_position'],
|
||||||
|
$params['background_color']
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
# code...
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
echo '</div>';
|
||||||
|
|
||||||
$config['font_size'] = $aux_font_size;
|
$config['font_size'] = $aux_font_size;
|
||||||
?>
|
?>
|
||||||
|
@ -544,28 +544,30 @@ function db_get_module_ranges_unknown($id_agente_modulo, $tstart = false, $tend
|
|||||||
|
|
||||||
$return = array();
|
$return = array();
|
||||||
$i=0;
|
$i=0;
|
||||||
foreach ($events as $event) {
|
if(is_array($events)){
|
||||||
switch ($event["event_type"]) {
|
foreach ($events as $event) {
|
||||||
case "going_up_critical":
|
switch ($event["event_type"]) {
|
||||||
case "going_up_warning":
|
case "going_up_critical":
|
||||||
case "going_up_normal":
|
case "going_up_warning":
|
||||||
case "going_down_critical":
|
case "going_up_normal":
|
||||||
case "going_down_warning":
|
case "going_down_critical":
|
||||||
case "going_down_normal": {
|
case "going_down_warning":
|
||||||
if ($last_status == 1) {
|
case "going_down_normal": {
|
||||||
$return[$i]["time_to"] = $event["utimestamp"];
|
if ($last_status == 1) {
|
||||||
$i++;
|
$return[$i]["time_to"] = $event["utimestamp"];
|
||||||
$last_status = 0;
|
$i++;
|
||||||
|
$last_status = 0;
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
break;
|
case "going_unknown":{
|
||||||
}
|
if ($last_status == 0){
|
||||||
case "going_unknown":{
|
$return[$i] = array();
|
||||||
if ($last_status == 0){
|
$return[$i]["time_from"] = $event["utimestamp"];
|
||||||
$return[$i] = array();
|
$last_status = 1;
|
||||||
$return[$i]["time_from"] = $event["utimestamp"];
|
}
|
||||||
$last_status = 1;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -893,7 +895,7 @@ function db_uncompress_module_data($id_agente_modulo, $tstart = false, $tend = f
|
|||||||
}
|
}
|
||||||
|
|
||||||
//sort current slice
|
//sort current slice
|
||||||
if(count($return[$pool_id]['data'] > 1)) {
|
if(count($return[$pool_id]['data']) > 1) {
|
||||||
usort(
|
usort(
|
||||||
$return[$pool_id]['data'],
|
$return[$pool_id]['data'],
|
||||||
function ($a, $b) {
|
function ($a, $b) {
|
||||||
|
@ -1820,11 +1820,8 @@ function graphic_combined_module (
|
|||||||
$height = 500;
|
$height = 500;
|
||||||
}
|
}
|
||||||
|
|
||||||
$flash_charts = true;
|
|
||||||
|
|
||||||
if($params_combined['stacked'] == CUSTOM_GRAPH_HBARS){
|
if($params_combined['stacked'] == CUSTOM_GRAPH_HBARS){
|
||||||
$output = hbar_graph(
|
$output = hbar_graph(
|
||||||
true,
|
|
||||||
$graph_values,
|
$graph_values,
|
||||||
$width,
|
$width,
|
||||||
$height,
|
$height,
|
||||||
@ -1847,7 +1844,6 @@ function graphic_combined_module (
|
|||||||
|
|
||||||
if($params_combined['stacked'] == CUSTOM_GRAPH_VBARS){
|
if($params_combined['stacked'] == CUSTOM_GRAPH_VBARS){
|
||||||
$output = vbar_graph(
|
$output = vbar_graph(
|
||||||
true,
|
|
||||||
$graph_values,
|
$graph_values,
|
||||||
$width,
|
$width,
|
||||||
$height,
|
$height,
|
||||||
@ -1941,7 +1937,6 @@ function graphic_combined_module (
|
|||||||
$color = color_graph_array();
|
$color = color_graph_array();
|
||||||
|
|
||||||
$output = ring_graph(
|
$output = ring_graph(
|
||||||
true,
|
|
||||||
$graph_values,
|
$graph_values,
|
||||||
$width,
|
$width,
|
||||||
$height,
|
$height,
|
||||||
@ -3125,7 +3120,6 @@ function graph_custom_sql_graph ($id, $width, $height,
|
|||||||
switch ($type) {
|
switch ($type) {
|
||||||
case 'sql_graph_vbar': // vertical bar
|
case 'sql_graph_vbar': // vertical bar
|
||||||
return vbar_graph(
|
return vbar_graph(
|
||||||
$flash_charts,
|
|
||||||
$data,
|
$data,
|
||||||
$width,
|
$width,
|
||||||
$height,
|
$height,
|
||||||
@ -3149,7 +3143,6 @@ function graph_custom_sql_graph ($id, $width, $height,
|
|||||||
break;
|
break;
|
||||||
case 'sql_graph_hbar': // horizontal bar
|
case 'sql_graph_hbar': // horizontal bar
|
||||||
return hbar_graph(
|
return hbar_graph(
|
||||||
$flash_charts,
|
|
||||||
$data,
|
$data,
|
||||||
$width,
|
$width,
|
||||||
$height,
|
$height,
|
||||||
@ -3198,10 +3191,9 @@ function graph_custom_sql_graph ($id, $width, $height,
|
|||||||
function graph_graphic_agentevents ($id_agent, $width, $height, $period = 0, $homeurl, $return = false, $from_agent_view = false) {
|
function graph_graphic_agentevents ($id_agent, $width, $height, $period = 0, $homeurl, $return = false, $from_agent_view = false) {
|
||||||
global $config;
|
global $config;
|
||||||
global $graphic_type;
|
global $graphic_type;
|
||||||
|
|
||||||
|
|
||||||
$data = array ();
|
$data = array ();
|
||||||
|
|
||||||
//$resolution = $config['graph_res'] * ($period * 2 / $width); // Number of "slices" we want in graph
|
//$resolution = $config['graph_res'] * ($period * 2 / $width); // Number of "slices" we want in graph
|
||||||
$resolution = 5 * ($period * 2 / $width); // Number of "slices" we want in graph
|
$resolution = 5 * ($period * 2 / $width); // Number of "slices" we want in graph
|
||||||
|
|
||||||
@ -3269,7 +3261,7 @@ function graph_graphic_agentevents ($id_agent, $width, $height, $period = 0, $ho
|
|||||||
}
|
}
|
||||||
|
|
||||||
$colors = array(1 => COL_NORMAL, 2 => COL_WARNING, 3 => COL_CRITICAL, 4 => COL_UNKNOWN);
|
$colors = array(1 => COL_NORMAL, 2 => COL_WARNING, 3 => COL_CRITICAL, 4 => COL_UNKNOWN);
|
||||||
|
|
||||||
// Draw slicebar graph
|
// Draw slicebar graph
|
||||||
if ($config['flash_charts']) {
|
if ($config['flash_charts']) {
|
||||||
$out = flot_slicesbar_graph($data, $period, $width, $height, $full_legend, $colors, $config['fontpath'], $config['round_corner'], $homeurl, '', '', false, $id_agent, $full_legend_date);
|
$out = flot_slicesbar_graph($data, $period, $width, $height, $full_legend, $colors, $config['fontpath'], $config['round_corner'], $homeurl, '', '', false, $id_agent, $full_legend_date);
|
||||||
|
@ -1320,7 +1320,6 @@ function reporting_event_top_n($report, $content, $type = 'dinamic',
|
|||||||
|
|
||||||
//Display bars graph
|
//Display bars graph
|
||||||
$return['charts']['bars'] = hbar_graph(
|
$return['charts']['bars'] = hbar_graph(
|
||||||
false,
|
|
||||||
$data_hbar,
|
$data_hbar,
|
||||||
$width,
|
$width,
|
||||||
count($data_hbar) * 50,
|
count($data_hbar) * 50,
|
||||||
@ -2209,7 +2208,6 @@ function reporting_exception($report, $content, $type = 'dinamic',
|
|||||||
|
|
||||||
|
|
||||||
$params = array(
|
$params = array(
|
||||||
'flash_chart' => false,
|
|
||||||
'chart_data' => $data_hbar,
|
'chart_data' => $data_hbar,
|
||||||
'width' => 600,
|
'width' => 600,
|
||||||
'height' => 25 * count($data_hbar),
|
'height' => 25 * count($data_hbar),
|
||||||
|
@ -2860,24 +2860,6 @@ function reporting_html_sql(&$table, $item) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function reporting_get_stats_summary($data, $graph_width, $graph_height) {
|
function reporting_get_stats_summary($data, $graph_width, $graph_height) {
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
@ -2902,8 +2884,7 @@ function reporting_get_stats_summary($data, $graph_width, $graph_height) {
|
|||||||
|
|
||||||
if ($data["monitor_checks"] > 0) {
|
if ($data["monitor_checks"] > 0) {
|
||||||
// Fixed width non interactive charts
|
// Fixed width non interactive charts
|
||||||
$status_chart_width = $config["flash_charts"] == false
|
$status_chart_width = $graph_width;
|
||||||
? 100 : $graph_width;
|
|
||||||
|
|
||||||
$tdata[0] =
|
$tdata[0] =
|
||||||
'<div style="margin: auto; width: ' . $graph_width . 'px;">' .
|
'<div style="margin: auto; width: ' . $graph_width . 'px;">' .
|
||||||
@ -3681,6 +3662,7 @@ function reporting_get_last_activity() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function reporting_get_event_histogram ($events, $text_header_event = false) {
|
function reporting_get_event_histogram ($events, $text_header_event = false) {
|
||||||
|
|
||||||
global $config;
|
global $config;
|
||||||
if (!defined("METACONSOLE")) {
|
if (!defined("METACONSOLE")) {
|
||||||
include_once ($config['homedir'] .'/include/graphs/functions_gd.php');
|
include_once ($config['homedir'] .'/include/graphs/functions_gd.php');
|
||||||
@ -3840,9 +3822,9 @@ function reporting_get_event_histogram_meta ($width) {
|
|||||||
|
|
||||||
$ttl = 1;
|
$ttl = 1;
|
||||||
$urlImage = ui_get_full_url(false, true, false, false);
|
$urlImage = ui_get_full_url(false, true, false, false);
|
||||||
|
|
||||||
$data = array ();
|
$data = array ();
|
||||||
|
|
||||||
//$resolution = $config['graph_res'] * ($period * 2 / $width); // Number of "slices" we want in graph
|
//$resolution = $config['graph_res'] * ($period * 2 / $width); // Number of "slices" we want in graph
|
||||||
$resolution = 5 * ($period * 2 / $width); // Number of "slices" we want in graph
|
$resolution = 5 * ($period * 2 / $width); // Number of "slices" we want in graph
|
||||||
|
|
||||||
@ -3865,10 +3847,10 @@ function reporting_get_event_histogram_meta ($width) {
|
|||||||
EVENT_CRIT_MAJOR => COL_MAJOR,
|
EVENT_CRIT_MAJOR => COL_MAJOR,
|
||||||
EVENT_CRIT_CRITICAL => COL_CRITICAL
|
EVENT_CRIT_CRITICAL => COL_CRITICAL
|
||||||
);
|
);
|
||||||
|
|
||||||
$user_groups = users_get_groups($config['id_user'], 'ER');
|
$user_groups = users_get_groups($config['id_user'], 'ER');
|
||||||
$user_groups_ids = array_keys($user_groups);
|
$user_groups_ids = array_keys($user_groups);
|
||||||
|
|
||||||
if (empty($user_groups)) {
|
if (empty($user_groups)) {
|
||||||
$groups_condition = ' AND 1 = 0 ';
|
$groups_condition = ' AND 1 = 0 ';
|
||||||
}
|
}
|
||||||
@ -3880,51 +3862,46 @@ function reporting_get_event_histogram_meta ($width) {
|
|||||||
$groups_condition .= " AND id_grupo != 0";
|
$groups_condition .= " AND id_grupo != 0";
|
||||||
}
|
}
|
||||||
$status_condition = " AND estado = 0 ";
|
$status_condition = " AND estado = 0 ";
|
||||||
|
|
||||||
$cont = 0;
|
$cont = 0;
|
||||||
for ($i = 0; $i < $interval; $i++) {
|
for ($i = 0; $i < $interval; $i++) {
|
||||||
$bottom = $datelimit + ($periodtime * $i);
|
$bottom = $datelimit + ($periodtime * $i);
|
||||||
if (! $graphic_type) {
|
if (! $graphic_type) {
|
||||||
if ($config['flash_charts']) {
|
$name = date('H:i:s', $bottom);
|
||||||
$name = date('H:i:s', $bottom);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$name = date('H\h', $bottom);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$name = $bottom;
|
$name = $bottom;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Show less values in legend
|
// Show less values in legend
|
||||||
if ($cont == 0 or $cont % 2)
|
if ($cont == 0 or $cont % 2)
|
||||||
$legend[$cont] = $name;
|
$legend[$cont] = $name;
|
||||||
|
|
||||||
if ($from_agent_view) {
|
if ($from_agent_view) {
|
||||||
$full_date = date('Y/m/d', $bottom);
|
$full_date = date('Y/m/d', $bottom);
|
||||||
$full_legend_date[$cont] = $full_date;
|
$full_legend_date[$cont] = $full_date;
|
||||||
}
|
}
|
||||||
|
|
||||||
$full_legend[$cont] = $name;
|
$full_legend[$cont] = $name;
|
||||||
|
|
||||||
$top = $datelimit + ($periodtime * ($i + 1));
|
$top = $datelimit + ($periodtime * ($i + 1));
|
||||||
|
|
||||||
$time_condition = 'utimestamp > '.$bottom . ' AND utimestamp < '.$top;
|
$time_condition = 'utimestamp > '.$bottom . ' AND utimestamp < '.$top;
|
||||||
$sql = sprintf('SELECT criticity,utimestamp
|
$sql = sprintf('SELECT criticity,utimestamp
|
||||||
FROM tmetaconsole_event
|
FROM tmetaconsole_event
|
||||||
WHERE %s %s %s
|
WHERE %s %s %s
|
||||||
ORDER BY criticity DESC',
|
ORDER BY criticity DESC',
|
||||||
$time_condition, $groups_condition, $status_condition);
|
$time_condition, $groups_condition, $status_condition);
|
||||||
|
|
||||||
$events = db_get_all_rows_sql($sql);
|
$events = db_get_all_rows_sql($sql);
|
||||||
|
|
||||||
$events_criticity = array();
|
$events_criticity = array();
|
||||||
if(is_array($events)){
|
if(is_array($events)){
|
||||||
foreach ($events as $key => $value) {
|
foreach ($events as $key => $value) {
|
||||||
array_push($events_criticity,$value['criticity']);
|
array_push($events_criticity,$value['criticity']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($events)) {
|
if (!empty($events)) {
|
||||||
if(array_search('4',$events_criticity) !== false){
|
if(array_search('4',$events_criticity) !== false){
|
||||||
$data[$cont]['data'] = EVENT_CRIT_CRITICAL;
|
$data[$cont]['data'] = EVENT_CRIT_CRITICAL;
|
||||||
@ -3945,16 +3922,14 @@ function reporting_get_event_histogram_meta ($width) {
|
|||||||
}else {
|
}else {
|
||||||
$data[$cont]['data'] = EVENT_CRIT_INFORMATIONAL;
|
$data[$cont]['data'] = EVENT_CRIT_INFORMATIONAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
$data[$cont]['utimestamp'] = $periodtime;
|
$data[$cont]['utimestamp'] = $periodtime;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
$data[$cont]['utimestamp'] = $periodtime;
|
$data[$cont]['utimestamp'] = $periodtime;
|
||||||
$data[$cont]['data'] = 1;
|
$data[$cont]['data'] = 1;
|
||||||
}
|
}
|
||||||
$cont++;
|
$cont++;
|
||||||
}
|
}
|
||||||
|
|
||||||
$table = new stdClass();
|
$table = new stdClass();
|
||||||
|
|
||||||
$table->width = '100%';
|
$table->width = '100%';
|
||||||
@ -3964,16 +3939,15 @@ function reporting_get_event_histogram_meta ($width) {
|
|||||||
$table->head = array ();
|
$table->head = array ();
|
||||||
$table->title = '<span>' . $text_header_event . '</span>';
|
$table->title = '<span>' . $text_header_event . '</span>';
|
||||||
$table->data[0][0] = "" ;
|
$table->data[0][0] = "" ;
|
||||||
|
|
||||||
if (!empty($data)) {
|
if (!empty($data)) {
|
||||||
$slicebar = flot_slicesbar_graph($data, $period, "100%", 30, $full_legend, $colors, $config['fontpath'], $config['round_corner'], $url, '', '', false, 0, $full_legend_date);
|
$slicebar = flot_slicesbar_graph($data, $period, "100%", 30, $full_legend, $colors, $config['fontpath'], $config['round_corner'], $url, '', '', false, 0, $full_legend_date);
|
||||||
|
|
||||||
$table->data[0][0] = $slicebar;
|
$table->data[0][0] = $slicebar;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$table->data[0][0] = __('No events');
|
$table->data[0][0] = __('No events');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$text_header_event) {
|
if (!$text_header_event) {
|
||||||
$event_graph = '<fieldset class="databox tactical_set">
|
$event_graph = '<fieldset class="databox tactical_set">
|
||||||
<legend>' .
|
<legend>' .
|
||||||
@ -3985,7 +3959,6 @@ function reporting_get_event_histogram_meta ($width) {
|
|||||||
$table->class = 'noclass';
|
$table->class = 'noclass';
|
||||||
$event_graph = html_print_table($table, true);
|
$event_graph = html_print_table($table, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $event_graph;
|
return $event_graph;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1203,7 +1203,7 @@ function visual_map_print_item($mode = "read", $layoutData,
|
|||||||
if ($layoutData['label_position']=='left') {
|
if ($layoutData['label_position']=='left') {
|
||||||
if ($layoutData['type_graph'] == 'horizontal') {
|
if ($layoutData['type_graph'] == 'horizontal') {
|
||||||
$img = '<div style="float:right;height:'.$himg.'px;">'.
|
$img = '<div style="float:right;height:'.$himg.'px;">'.
|
||||||
hbar_graph(true, $module_data,
|
hbar_graph($module_data,
|
||||||
400, 400, $color, array(), array(),
|
400, 400, $color, array(), array(),
|
||||||
ui_get_full_url("images/image_problem.opaque.png", false, false, false),
|
ui_get_full_url("images/image_problem.opaque.png", false, false, false),
|
||||||
"", "", $water_mark, $config['fontpath'], 6,
|
"", "", $water_mark, $config['fontpath'], 6,
|
||||||
@ -1211,7 +1211,7 @@ function visual_map_print_item($mode = "read", $layoutData,
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$img = '<div style="float:right;height:'.$himg.'px;">'.
|
$img = '<div style="float:right;height:'.$himg.'px;">'.
|
||||||
vbar_graph(true, $module_data,
|
vbar_graph($module_data,
|
||||||
400, 400, $color, array(), array(),
|
400, 400, $color, array(), array(),
|
||||||
ui_get_full_url("images/image_problem.opaque.png", false, false, false),
|
ui_get_full_url("images/image_problem.opaque.png", false, false, false),
|
||||||
"", "", $water_mark, $config['fontpath'], 6,
|
"", "", $water_mark, $config['fontpath'], 6,
|
||||||
@ -1221,7 +1221,7 @@ function visual_map_print_item($mode = "read", $layoutData,
|
|||||||
elseif($layoutData['label_position']=='right') {
|
elseif($layoutData['label_position']=='right') {
|
||||||
if ($layoutData['type_graph'] == 'horizontal') {
|
if ($layoutData['type_graph'] == 'horizontal') {
|
||||||
$img = '<div style="float:left;height:'.$himg.'px;">'.
|
$img = '<div style="float:left;height:'.$himg.'px;">'.
|
||||||
hbar_graph(true, $module_data,
|
hbar_graph($module_data,
|
||||||
400, 400, $color, array(), array(),
|
400, 400, $color, array(), array(),
|
||||||
ui_get_full_url("images/image_problem.opaque.png", false, false, false),
|
ui_get_full_url("images/image_problem.opaque.png", false, false, false),
|
||||||
"", "", $water_mark, $config['fontpath'], 6,
|
"", "", $water_mark, $config['fontpath'], 6,
|
||||||
@ -1229,7 +1229,7 @@ function visual_map_print_item($mode = "read", $layoutData,
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$img = '<div style="float:left;height:'.$himg.'px;">'.
|
$img = '<div style="float:left;height:'.$himg.'px;">'.
|
||||||
vbar_graph(true, $module_data,
|
vbar_graph($module_data,
|
||||||
400, 400, $color, array(), array(),
|
400, 400, $color, array(), array(),
|
||||||
ui_get_full_url("images/image_problem.opaque.png", false, false, false),
|
ui_get_full_url("images/image_problem.opaque.png", false, false, false),
|
||||||
"", "", $water_mark, $config['fontpath'], 6,
|
"", "", $water_mark, $config['fontpath'], 6,
|
||||||
@ -1238,14 +1238,14 @@ function visual_map_print_item($mode = "read", $layoutData,
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if ($layoutData['type_graph'] == 'horizontal') {
|
if ($layoutData['type_graph'] == 'horizontal') {
|
||||||
$img = hbar_graph(true, $module_data,
|
$img = hbar_graph($module_data,
|
||||||
400, 400, $color, array(), array(),
|
400, 400, $color, array(), array(),
|
||||||
ui_get_full_url("images/image_problem.opaque.png", false, false, false),
|
ui_get_full_url("images/image_problem.opaque.png", false, false, false),
|
||||||
"", "", $water_mark, $config['fontpath'], 6,
|
"", "", $water_mark, $config['fontpath'], 6,
|
||||||
"", 0, $config['homeurl'], $layoutData['image'], $layoutData['border_color']);
|
"", 0, $config['homeurl'], $layoutData['image'], $layoutData['border_color']);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$img = vbar_graph(true, $module_data,
|
$img = vbar_graph($module_data,
|
||||||
400, 400, $color, array(), array(),
|
400, 400, $color, array(), array(),
|
||||||
ui_get_full_url("images/image_problem.opaque.png", false, false, false),
|
ui_get_full_url("images/image_problem.opaque.png", false, false, false),
|
||||||
"", "", $water_mark, $config['fontpath'], 6,
|
"", "", $water_mark, $config['fontpath'], 6,
|
||||||
@ -1257,7 +1257,7 @@ function visual_map_print_item($mode = "read", $layoutData,
|
|||||||
if ($layoutData['label_position']=='left') {
|
if ($layoutData['label_position']=='left') {
|
||||||
if ($layoutData['type_graph'] == 'horizontal') {
|
if ($layoutData['type_graph'] == 'horizontal') {
|
||||||
$img = '<div style="float:right;height:'.$himg.'px;">'.
|
$img = '<div style="float:right;height:'.$himg.'px;">'.
|
||||||
hbar_graph(true, $module_data,
|
hbar_graph($module_data,
|
||||||
$width, $height, $color, array(), array(),
|
$width, $height, $color, array(), array(),
|
||||||
ui_get_full_url("images/image_problem.opaque.png", false, false, false),
|
ui_get_full_url("images/image_problem.opaque.png", false, false, false),
|
||||||
"", "", $water_mark, $config['fontpath'], 6,
|
"", "", $water_mark, $config['fontpath'], 6,
|
||||||
@ -1265,7 +1265,7 @@ function visual_map_print_item($mode = "read", $layoutData,
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$img = '<div style="float:right;height:'.$himg.'px;">'.
|
$img = '<div style="float:right;height:'.$himg.'px;">'.
|
||||||
vbar_graph(true, $module_data,
|
vbar_graph($module_data,
|
||||||
$width, $height, $color, array(), array(),
|
$width, $height, $color, array(), array(),
|
||||||
ui_get_full_url("images/image_problem.opaque.png", false, false, false),
|
ui_get_full_url("images/image_problem.opaque.png", false, false, false),
|
||||||
"", "", $water_mark, $config['fontpath'], 6,
|
"", "", $water_mark, $config['fontpath'], 6,
|
||||||
@ -1275,7 +1275,7 @@ function visual_map_print_item($mode = "read", $layoutData,
|
|||||||
elseif($layoutData['label_position']=='right') {
|
elseif($layoutData['label_position']=='right') {
|
||||||
if ($layoutData['type_graph'] == 'horizontal') {
|
if ($layoutData['type_graph'] == 'horizontal') {
|
||||||
$img = '<div style="float:left;height:'.$himg.'px;">'.
|
$img = '<div style="float:left;height:'.$himg.'px;">'.
|
||||||
hbar_graph(true, $module_data,
|
hbar_graph($module_data,
|
||||||
$width, $height, $color, array(), array(),
|
$width, $height, $color, array(), array(),
|
||||||
ui_get_full_url("images/image_problem.opaque.png", false, false, false),
|
ui_get_full_url("images/image_problem.opaque.png", false, false, false),
|
||||||
"", "", $water_mark, $config['fontpath'], 6,
|
"", "", $water_mark, $config['fontpath'], 6,
|
||||||
@ -1283,7 +1283,7 @@ function visual_map_print_item($mode = "read", $layoutData,
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$img = '<div style="float:left;height:'.$himg.'px;">'.
|
$img = '<div style="float:left;height:'.$himg.'px;">'.
|
||||||
vbar_graph(true, $module_data,
|
vbar_graph($module_data,
|
||||||
$width, $height, $color, array(), array(),
|
$width, $height, $color, array(), array(),
|
||||||
ui_get_full_url("images/image_problem.opaque.png", false, false, false),
|
ui_get_full_url("images/image_problem.opaque.png", false, false, false),
|
||||||
"", "", $water_mark, $config['fontpath'], 6,
|
"", "", $water_mark, $config['fontpath'], 6,
|
||||||
@ -1292,14 +1292,14 @@ function visual_map_print_item($mode = "read", $layoutData,
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if ($layoutData['type_graph'] == 'horizontal') {
|
if ($layoutData['type_graph'] == 'horizontal') {
|
||||||
$img = hbar_graph(true, $module_data,
|
$img = hbar_graph($module_data,
|
||||||
$width, $height, $color, array(), array(),
|
$width, $height, $color, array(), array(),
|
||||||
ui_get_full_url("images/image_problem.opaque.png", false, false, false),
|
ui_get_full_url("images/image_problem.opaque.png", false, false, false),
|
||||||
"", "", $water_mark, $config['fontpath'], 6,
|
"", "", $water_mark, $config['fontpath'], 6,
|
||||||
"", 0, $config['homeurl'], $layoutData['image'], $layoutData['border_color']);
|
"", 0, $config['homeurl'], $layoutData['image'], $layoutData['border_color']);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$img = vbar_graph(true, $module_data,
|
$img = vbar_graph($module_data,
|
||||||
$width, $height, $color, array(), array(),
|
$width, $height, $color, array(), array(),
|
||||||
ui_get_full_url("images/image_problem.opaque.png", false, false, false),
|
ui_get_full_url("images/image_problem.opaque.png", false, false, false),
|
||||||
"", "", $water_mark, $config['fontpath'], 6,
|
"", "", $water_mark, $config['fontpath'], 6,
|
||||||
|
@ -9,107 +9,6 @@
|
|||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
// GNU General Public License for more details.
|
// GNU General Public License for more details.
|
||||||
|
|
||||||
// Turn on output buffering.
|
|
||||||
// The entire buffer will be discarded later so that any accidental output
|
|
||||||
// does not corrupt images generated by fgraph.
|
|
||||||
ob_start();
|
|
||||||
|
|
||||||
global $config;
|
|
||||||
|
|
||||||
if (empty($config['homedir'])) {
|
|
||||||
require_once ('../../include/config.php');
|
|
||||||
global $config;
|
|
||||||
}
|
|
||||||
|
|
||||||
include_once($config['homedir'] . '/include/functions.php');
|
|
||||||
|
|
||||||
$ttl = get_parameter('ttl', 1);
|
|
||||||
$graph_type = get_parameter('graph_type', '');
|
|
||||||
|
|
||||||
if (!empty($graph_type)) {
|
|
||||||
include_once($config['homedir'] . '/include/functions_html.php');
|
|
||||||
include_once($config['homedir'] . '/include/graphs/functions_gd.php');
|
|
||||||
include_once($config['homedir'] . '/include/graphs/functions_utils.php');
|
|
||||||
include_once($config['homedir'] . '/include/graphs/functions_d3.php');
|
|
||||||
include_once($config['homedir'] . '/include/graphs/functions_flot.php');
|
|
||||||
}
|
|
||||||
|
|
||||||
// Clean the output buffer and turn off output buffering
|
|
||||||
ob_end_clean ();
|
|
||||||
|
|
||||||
switch($graph_type) {
|
|
||||||
case 'histogram':
|
|
||||||
$width = get_parameter('width');
|
|
||||||
$height = get_parameter('height');
|
|
||||||
$data = json_decode(io_safe_output(get_parameter('data')), true);
|
|
||||||
|
|
||||||
$max = get_parameter('max');
|
|
||||||
$title = get_parameter('title');
|
|
||||||
$mode = get_parameter ('mode', 1);
|
|
||||||
gd_histogram ($width, $height, $mode, $data, $max, $config['fontpath'], $title);
|
|
||||||
break;
|
|
||||||
case 'progressbar':
|
|
||||||
$width = get_parameter('width');
|
|
||||||
$height = get_parameter('height');
|
|
||||||
$progress = get_parameter('progress');
|
|
||||||
|
|
||||||
$out_of_lim_str = io_safe_output(get_parameter('out_of_lim_str', false));
|
|
||||||
$out_of_lim_image = get_parameter('out_of_lim_image', false);
|
|
||||||
|
|
||||||
$title = get_parameter('title');
|
|
||||||
|
|
||||||
$mode = get_parameter('mode', 1);
|
|
||||||
|
|
||||||
$fontsize = get_parameter('fontsize', 10);
|
|
||||||
|
|
||||||
$value_text = get_parameter('value_text', '');
|
|
||||||
$colorRGB = get_parameter('colorRGB', '');
|
|
||||||
|
|
||||||
gd_progress_bar ($width, $height, $progress, $title, $config['fontpath'],
|
|
||||||
$out_of_lim_str, $out_of_lim_image, $mode, $fontsize,
|
|
||||||
$value_text, $colorRGB);
|
|
||||||
break;
|
|
||||||
case 'progressbubble':
|
|
||||||
$width = get_parameter('width');
|
|
||||||
$height = get_parameter('height');
|
|
||||||
$progress = get_parameter('progress');
|
|
||||||
|
|
||||||
$out_of_lim_str = io_safe_output(get_parameter('out_of_lim_str', false));
|
|
||||||
$out_of_lim_image = get_parameter('out_of_lim_image', false);
|
|
||||||
|
|
||||||
$title = get_parameter('title');
|
|
||||||
|
|
||||||
$mode = get_parameter('mode', 1);
|
|
||||||
|
|
||||||
$fontsize = get_parameter('fontsize', 7);
|
|
||||||
|
|
||||||
$value_text = get_parameter('value_text', '');
|
|
||||||
$colorRGB = get_parameter('colorRGB', '');
|
|
||||||
|
|
||||||
gd_progress_bubble ($width, $height, $progress, $title, $config['fontpath'],
|
|
||||||
$out_of_lim_str, $out_of_lim_image, $mode, $fontsize,
|
|
||||||
$value_text, $colorRGB);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
function histogram($chart_data, $width, $height, $font, $max, $title,
|
|
||||||
$mode, $ttl = 1) {
|
|
||||||
|
|
||||||
$graph = array();
|
|
||||||
$graph['data'] = $chart_data;
|
|
||||||
$graph['width'] = $width;
|
|
||||||
$graph['height'] = $height;
|
|
||||||
$graph['font'] = $font;
|
|
||||||
$graph['max'] = $max;
|
|
||||||
$graph['title'] = $title;
|
|
||||||
$graph['mode'] = $mode;
|
|
||||||
|
|
||||||
$id_graph = serialize_in_temp($graph, null, $ttl);
|
|
||||||
|
|
||||||
return "<img src='include/graphs/functions_gd.php?static_graph=1&graph_type=histogram&ttl=".$ttl."&id_graph=".$id_graph."'>";
|
|
||||||
}
|
|
||||||
|
|
||||||
function progressbar($progress, $width, $height, $title, $font,
|
function progressbar($progress, $width, $height, $title, $font,
|
||||||
$mode = 1, $out_of_lim_str = false, $out_of_lim_image = false,
|
$mode = 1, $out_of_lim_str = false, $out_of_lim_image = false,
|
||||||
$ttl = 1) {
|
$ttl = 1) {
|
||||||
@ -134,7 +33,6 @@ function progressbar($progress, $width, $height, $title, $font,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function slicesbar_graph($chart_data, $period, $width, $height, $colors,
|
function slicesbar_graph($chart_data, $period, $width, $height, $colors,
|
||||||
$font, $round_corner, $home_url = '', $ttl = 1) {
|
$font, $round_corner, $home_url = '', $ttl = 1) {
|
||||||
|
|
||||||
@ -153,7 +51,6 @@ function slicesbar_graph($chart_data, $period, $width, $height, $colors,
|
|||||||
}
|
}
|
||||||
|
|
||||||
function vbar_graph(
|
function vbar_graph(
|
||||||
$flash_chart,
|
|
||||||
$chart_data,
|
$chart_data,
|
||||||
$width,
|
$width,
|
||||||
$height,
|
$height,
|
||||||
@ -180,44 +77,46 @@ function vbar_graph(
|
|||||||
return '<img src="' . $no_data_image . '" />';
|
return '<img src="' . $no_data_image . '" />';
|
||||||
}
|
}
|
||||||
|
|
||||||
//if ($flash_chart) {
|
if($ttl == 2){
|
||||||
return flot_vcolumn_chart ($chart_data, $width, $height, $color,
|
$params = array(
|
||||||
$legend, $long_index, $homeurl, $unit, $water_mark_url,
|
'chart_data' => $chart_data,
|
||||||
$homedir,$font,$font_size, $from_ux, $from_wux, $backgroundColor,
|
'width' => $width,
|
||||||
$tick_color);
|
'height' => $height,
|
||||||
/*
|
'color' => $color,
|
||||||
}
|
'legend' => $legend,
|
||||||
else {
|
'long_index' => $long_index,
|
||||||
$new_chart_data = array();
|
'homeurl' => $homeurl,
|
||||||
foreach ($chart_data as $key => $value) {
|
'unit' => $unit,
|
||||||
if(strlen($key) > 20 && strpos($key, ' - ') !== false){
|
'water_mark_url' => $water_mark_url,
|
||||||
$key_temp = explode(" - ",$key);
|
'homedir' => $homedir,
|
||||||
$key_temp[0] = $key_temp[0]." \n";
|
'font' => $font,
|
||||||
$key_temp[1]= '...'.substr($key_temp[1],-15);
|
'font_size' => $font_size,
|
||||||
$key2 = $key_temp[0].$key_temp[1];
|
'from_ux' => $from_ux,
|
||||||
io_safe_output($key2);
|
'from_wux' => $from_wux,
|
||||||
$new_chart_data[$key2]['g'] = $chart_data[$key]['g'];
|
'backgroundColor' => $backgroundColor,
|
||||||
} else {
|
'tick_color' => $tick_color
|
||||||
$new_chart_data[$key] = $value;
|
);
|
||||||
}
|
return generator_chart_to_pdf('vbar', $params);
|
||||||
}
|
}
|
||||||
|
|
||||||
$graph = array();
|
return flot_vcolumn_chart (
|
||||||
$graph['data'] = $new_chart_data;
|
$chart_data,
|
||||||
$graph['width'] = $width;
|
$width,
|
||||||
$graph['height'] = $height;
|
$height,
|
||||||
$graph['color'] = $color;
|
$color,
|
||||||
$graph['legend'] = $legend;
|
$legend,
|
||||||
$graph['xaxisname'] = $xaxisname;
|
$long_index,
|
||||||
$graph['yaxisname'] = $yaxisname;
|
$homeurl,
|
||||||
$graph['water_mark'] = $water_mark_file;
|
$unit,
|
||||||
$graph['font'] = $font;
|
$water_mark_url,
|
||||||
$graph['font_size'] = $font_size;
|
$homedir,
|
||||||
|
$font,
|
||||||
$id_graph = serialize_in_temp($graph, null, $ttl);
|
$font_size,
|
||||||
|
$from_ux,
|
||||||
return "<img src='" . $homeurl . "include/graphs/functions_pchart.php?static_graph=1&graph_type=vbar&ttl=".$ttl."&id_graph=".$id_graph."'>";
|
$from_wux,
|
||||||
}*/
|
$backgroundColor,
|
||||||
|
$tick_color
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function area_graph(
|
function area_graph(
|
||||||
@ -296,7 +195,7 @@ function stacked_gauge($chart_data, $width, $height,
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function hbar_graph($flash_chart, $chart_data, $width, $height,
|
function hbar_graph($chart_data, $width, $height,
|
||||||
$color, $legend, $long_index, $no_data_image, $xaxisname = "",
|
$color, $legend, $long_index, $no_data_image, $xaxisname = "",
|
||||||
$yaxisname = "", $water_mark = "", $font = '', $font_size = '',
|
$yaxisname = "", $water_mark = "", $font = '', $font_size = '',
|
||||||
$unit = '', $ttl = 1, $homeurl = '', $backgroundColor = 'white',
|
$unit = '', $ttl = 1, $homeurl = '', $backgroundColor = 'white',
|
||||||
@ -308,44 +207,34 @@ function hbar_graph($flash_chart, $chart_data, $width, $height,
|
|||||||
return '<img src="' . $no_data_image . '" />';
|
return '<img src="' . $no_data_image . '" />';
|
||||||
}
|
}
|
||||||
|
|
||||||
//if ($flash_chart) {
|
if($ttl == 2){
|
||||||
return flot_hcolumn_chart($chart_data, $width, $height, $water_mark_url, $font, $font_size, $backgroundColor, $tick_color, $val_min, $val_max);
|
$params = array(
|
||||||
/*
|
'chart_data' => $chart_data,
|
||||||
|
'width' => $width,
|
||||||
|
'height' => $height,
|
||||||
|
'water_mark_url' => $water_mark_url,
|
||||||
|
'font' => $font,
|
||||||
|
'font_size' => $font_size,
|
||||||
|
'backgroundColor' => $backgroundColor,
|
||||||
|
'tick_color' => $tick_color,
|
||||||
|
'val_min' => $val_min,
|
||||||
|
'val_max' => $val_max
|
||||||
|
);
|
||||||
|
return generator_chart_to_pdf('hbar', $params);
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
foreach ($chart_data as $key => $value) {
|
|
||||||
$str_key = io_safe_output($key);
|
|
||||||
if(strlen($str_key) > 40){
|
|
||||||
if(strpos($str_key, ' - ') != -1){
|
|
||||||
$key_temp = explode(" - ",$str_key);
|
|
||||||
$key_temp[0] = $key_temp[0]." <br>";
|
|
||||||
$key_temp[1]= '...'.substr($key_temp[1],-20);
|
|
||||||
$key2 = $key_temp[0].$key_temp[1];
|
|
||||||
}
|
|
||||||
$chart_data[$key2]['g'] = $chart_data[$key]['g'];
|
|
||||||
unset($chart_data[$key]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$graph = array();
|
return flot_hcolumn_chart(
|
||||||
$graph['data'] = $chart_data;
|
$chart_data,
|
||||||
$graph['width'] = $width;
|
$width,
|
||||||
$graph['height'] = $height;
|
$height,
|
||||||
$graph['color'] = $color;
|
$water_mark_url,
|
||||||
$graph['legend'] = $legend;
|
$font,
|
||||||
$graph['xaxisname'] = $xaxisname;
|
$font_size,
|
||||||
$graph['yaxisname'] = $yaxisname;
|
$backgroundColor,
|
||||||
$graph['force_height'] = $force_height;
|
$tick_color,
|
||||||
$graph['water_mark'] = $water_mark_file;
|
$val_min,
|
||||||
$graph['font'] = $font;
|
$val_max
|
||||||
$graph['font_size'] = $font_size;
|
);
|
||||||
$graph['force_steps'] = $force_steps;
|
|
||||||
|
|
||||||
$id_graph = serialize_in_temp($graph, null, $ttl);
|
|
||||||
|
|
||||||
return "<img src='" . $homeurl . "include/graphs/functions_pchart.php?static_graph=1&graph_type=hbar&ttl=".$ttl."&id_graph=".$id_graph."'>";
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function pie_graph($chart_data, $width,
|
function pie_graph($chart_data, $width,
|
||||||
@ -387,20 +276,20 @@ function pie_graph($chart_data, $width,
|
|||||||
$chart_data = $chart_data_trunc;
|
$chart_data = $chart_data_trunc;
|
||||||
}
|
}
|
||||||
|
|
||||||
$params = array(
|
|
||||||
'values' => array_values($chart_data),
|
|
||||||
'keys' => array_keys($chart_data),
|
|
||||||
'width' => $width,
|
|
||||||
'height' => $height,
|
|
||||||
'water_mark_url' => $water_mark_url,
|
|
||||||
'font' => $font,
|
|
||||||
'font_size' => $font_size,
|
|
||||||
'legend_position' => $legend_position,
|
|
||||||
'colors' => $colors,
|
|
||||||
'hide_labels' => $hide_labels
|
|
||||||
);
|
|
||||||
|
|
||||||
if($ttl == 2){
|
if($ttl == 2){
|
||||||
|
$params = array(
|
||||||
|
'values' => array_values($chart_data),
|
||||||
|
'keys' => array_keys($chart_data),
|
||||||
|
'width' => $width,
|
||||||
|
'height' => $height,
|
||||||
|
'water_mark_url' => $water_mark_url,
|
||||||
|
'font' => $font,
|
||||||
|
'font_size' => $font_size,
|
||||||
|
'legend_position' => $legend_position,
|
||||||
|
'colors' => $colors,
|
||||||
|
'hide_labels' => $hide_labels
|
||||||
|
);
|
||||||
|
|
||||||
return generator_chart_to_pdf('pie_chart', $params);
|
return generator_chart_to_pdf('pie_chart', $params);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -418,7 +307,7 @@ function pie_graph($chart_data, $width,
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function ring_graph($flash_chart, $chart_data, $width,
|
function ring_graph($chart_data, $width,
|
||||||
$height, $others_str = "other", $homedir="", $water_mark = "",
|
$height, $others_str = "other", $homedir="", $water_mark = "",
|
||||||
$font = '', $font_size = '', $ttl = 1, $legend_position = false,
|
$font = '', $font_size = '', $ttl = 1, $legend_position = false,
|
||||||
$colors = '', $hide_labels = false,$background_color = 'white') {
|
$colors = '', $hide_labels = false,$background_color = 'white') {
|
||||||
@ -432,64 +321,49 @@ function ring_graph($flash_chart, $chart_data, $width,
|
|||||||
// This library allows only 8 colors
|
// This library allows only 8 colors
|
||||||
$max_values = 18;
|
$max_values = 18;
|
||||||
|
|
||||||
if ($flash_chart) {
|
if($ttl == 2){
|
||||||
return flot_custom_pie_chart ($flash_chart, $chart_data,
|
$params = array(
|
||||||
$width, $height, $colors, $module_name_list, $long_index,
|
'chart_data' => $chart_data,
|
||||||
$no_data, false, '', $water_mark, $font, $font_size,
|
'width' => $width,
|
||||||
$unit, $ttl, $homeurl, $background_color, $legend_position,$background_color);
|
'height' => $height,
|
||||||
|
'colors' => $colors,
|
||||||
|
'module_name_list' => $module_name_list,
|
||||||
|
'long_index' => $long_index,
|
||||||
|
'no_data' => $no_data,
|
||||||
|
'water_mark' => $water_mark,
|
||||||
|
'font' => $font,
|
||||||
|
'font_size' => $font_size,
|
||||||
|
'unit' => $unit,
|
||||||
|
'ttl' => $ttl,
|
||||||
|
'homeurl' => $homeurl,
|
||||||
|
'background_color' => $background_color,
|
||||||
|
'legend_position' => $legend_position,
|
||||||
|
'background_color' => $background_color
|
||||||
|
);
|
||||||
|
|
||||||
|
return generator_chart_to_pdf('ring_graph', $params);
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
$total_modules = $chart_data['total_modules'];
|
|
||||||
unset($chart_data['total_modules']);
|
|
||||||
|
|
||||||
$max_values = 9;
|
return flot_custom_pie_chart (
|
||||||
//Remove the html_entities
|
$chart_data,
|
||||||
$n = 0;
|
$width,
|
||||||
$temp = array();
|
$height,
|
||||||
$coloretes = array();
|
$colors,
|
||||||
foreach ($chart_data as $key => $value) {
|
$module_name_list,
|
||||||
if ($n < $max_values) {
|
$long_index,
|
||||||
$temp[io_safe_output($key)] = $value['value'];
|
$no_data,
|
||||||
$legend[] = io_safe_output($key) .": " . $value['value'] . " " .$value['unit'];
|
false,
|
||||||
}
|
'',
|
||||||
$n++;
|
$water_mark,
|
||||||
}
|
$font,
|
||||||
$chart_data = $temp;
|
$font_size,
|
||||||
|
$unit,
|
||||||
$chart_data_trunc = array();
|
$ttl,
|
||||||
$coloretes = array();
|
$homeurl,
|
||||||
$n = 1;
|
$background_color,
|
||||||
//~ foreach ($chart_data as $key => $value) {
|
$legend_position,
|
||||||
//~ if ($n < $max_values) {
|
$background_color
|
||||||
|
);
|
||||||
//~ $chart_data_trunc[$key] = $value;
|
|
||||||
//~ }
|
|
||||||
//~ else {
|
|
||||||
//~ if (!isset($chart_data_trunc[$others_str])) {
|
|
||||||
//~ $chart_data_trunc[$others_str] = 0;
|
|
||||||
//~ }
|
|
||||||
//~ $chart_data_trunc[$others_str] += $value;
|
|
||||||
//~ }
|
|
||||||
//~ $n++;
|
|
||||||
//~ }
|
|
||||||
//~ $chart_data = $chart_data_trunc;
|
|
||||||
|
|
||||||
//TODO SET THE LEGEND POSITION
|
|
||||||
$graph = array();
|
|
||||||
$graph['data'] = $chart_data;
|
|
||||||
$graph['width'] = $width;
|
|
||||||
$graph['height'] = $height;
|
|
||||||
$graph['water_mark'] = $water_mark_file;
|
|
||||||
$graph['font'] = $font;
|
|
||||||
$graph['font_size'] = $font_size;
|
|
||||||
$graph['legend_position'] = $legend_position;
|
|
||||||
$graph['legend'] = $legend;
|
|
||||||
|
|
||||||
$id_graph = serialize_in_temp($graph, null, $ttl);
|
|
||||||
|
|
||||||
return "<img src='" . $homedir . "include/graphs/functions_pchart.php?static_graph=1&graph_type=ring3d&ttl=".$ttl."&id_graph=".$id_graph."'>";
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
@ -669,16 +669,21 @@ function pandoraFlotVBars(graph_id, values, labels, labels_long, legend, colors,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function pandoraFlotSlicebar(graph_id, values, datacolor, labels, legend, acumulate_data, intervaltick, water_mark, maxvalue, separator, separator2, graph_javascript, id_agent, full_legend) {
|
function pandoraFlotSlicebar(graph_id, values, datacolor, labels, legend, acumulate_data, intervaltick,
|
||||||
|
font, font_size, separator, separator2, graph_javascript, id_agent, full_legend, not_interactive) {
|
||||||
|
|
||||||
values = values.split(separator2);
|
values = values.split(separator2);
|
||||||
labels = labels.split(separator);
|
labels = labels.split(separator);
|
||||||
legend = legend.split(separator);
|
legend = legend.split(separator);
|
||||||
acumulate_data = acumulate_data.split(separator);
|
acumulate_data = acumulate_data.split(separator);
|
||||||
datacolor = datacolor.split(separator);
|
datacolor = datacolor.split(separator);
|
||||||
|
|
||||||
if (full_legend != false) {
|
if (full_legend != false) {
|
||||||
full_legend = full_legend.split(separator);
|
full_legend = full_legend.split(separator);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var font_size = parseInt(font_size);
|
||||||
|
var font = font.split("/").pop().split(".").shift();
|
||||||
// Check possible adapt_keys on classes
|
// Check possible adapt_keys on classes
|
||||||
check_adaptions(graph_id);
|
check_adaptions(graph_id);
|
||||||
|
|
||||||
@ -686,6 +691,7 @@ function pandoraFlotSlicebar(graph_id, values, datacolor, labels, legend, acumul
|
|||||||
|
|
||||||
for (i=0;i<values.length;i++) {
|
for (i=0;i<values.length;i++) {
|
||||||
var serie = values[i].split(separator);
|
var serie = values[i].split(separator);
|
||||||
|
|
||||||
var aux = new Array();
|
var aux = new Array();
|
||||||
$.each(serie,function(i,v) {
|
$.each(serie,function(i,v) {
|
||||||
aux.push([v, i]);
|
aux.push([v, i]);
|
||||||
@ -693,75 +699,63 @@ function pandoraFlotSlicebar(graph_id, values, datacolor, labels, legend, acumul
|
|||||||
|
|
||||||
datas.push({
|
datas.push({
|
||||||
data: aux,
|
data: aux,
|
||||||
bars: { show: true, fill: true ,fillColor: datacolor[i] , horizontal: true, lineWidth:0, steps:false }
|
bars: {
|
||||||
|
show: true,
|
||||||
|
fill: 1,
|
||||||
|
fillColor: { colors: [ { opacity: 1 }, { opacity: 1 } ] },
|
||||||
|
lineWidth:0,
|
||||||
|
horizontal: true,
|
||||||
|
steps:false,
|
||||||
|
barWidth: 24 * 60 * 60 * 600
|
||||||
|
},
|
||||||
|
color:datacolor[i]
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
var stack = 0, bars = true, lines = false, steps = false;
|
|
||||||
|
|
||||||
var regex = /visual_console/;
|
var regex = /visual_console/;
|
||||||
var match = regex.exec(window.location.href);
|
var match = regex.exec(window.location.href);
|
||||||
|
|
||||||
if (match == null) {
|
var options = {
|
||||||
var options = {
|
series: {
|
||||||
series: {
|
stack: true,
|
||||||
stack: stack,
|
bars:{
|
||||||
shadowSize: 0.1,
|
align: 'center'
|
||||||
color: '#ddd'
|
}
|
||||||
|
},
|
||||||
|
grid: {
|
||||||
|
borderWidth:1,
|
||||||
|
borderColor: '#C1C1C1',
|
||||||
|
tickColor: '#fff'
|
||||||
},
|
},
|
||||||
grid: {
|
xaxes: [ {
|
||||||
hoverable: true,
|
tickFormatter: xFormatter,
|
||||||
clickable: true,
|
color: '',
|
||||||
borderWidth:1,
|
tickSize: intervaltick,
|
||||||
borderColor: '',
|
tickLength: 0,
|
||||||
tickColor: '#fff'
|
font: {
|
||||||
},
|
size: font_size + 2,
|
||||||
xaxes: [ {
|
family: font+'Font'
|
||||||
tickFormatter: xFormatter,
|
|
||||||
color: '',
|
|
||||||
tickSize: intervaltick,
|
|
||||||
tickLength: 0
|
|
||||||
} ],
|
|
||||||
yaxes: [ {
|
|
||||||
show: false,
|
|
||||||
tickLength: 0
|
|
||||||
}],
|
|
||||||
legend: {
|
|
||||||
show: false
|
|
||||||
}
|
}
|
||||||
};
|
} ],
|
||||||
|
yaxes: [ {
|
||||||
|
show: false,
|
||||||
|
tickLength: 0
|
||||||
|
}],
|
||||||
|
legend: {
|
||||||
|
show: false
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
if (match == null && not_interactive == 0) {
|
||||||
|
options.grid['hoverable'] = true;
|
||||||
|
options.grid['clickable'] = true;
|
||||||
}
|
}
|
||||||
else {
|
else{
|
||||||
var options = {
|
options.grid['hoverable'] = false;
|
||||||
series: {
|
options.grid['clickable'] = false;
|
||||||
stack: stack,
|
|
||||||
shadowSize: 0.1,
|
|
||||||
color: '#ddd'
|
|
||||||
},
|
|
||||||
grid: {
|
|
||||||
hoverable: false,
|
|
||||||
clickable: false,
|
|
||||||
borderWidth:1,
|
|
||||||
borderColor: '',
|
|
||||||
tickColor: '#fff'
|
|
||||||
},
|
|
||||||
xaxes: [ {
|
|
||||||
tickFormatter: xFormatter,
|
|
||||||
color: '',
|
|
||||||
tickSize: intervaltick,
|
|
||||||
tickLength: 0
|
|
||||||
} ],
|
|
||||||
yaxes: [ {
|
|
||||||
show: false,
|
|
||||||
tickLength: 0
|
|
||||||
}],
|
|
||||||
legend: {
|
|
||||||
show: false
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var plot = $.plot($('#'+graph_id), datas, options );
|
$.plot($('#'+graph_id), datas, options );
|
||||||
|
|
||||||
if (match == null) {
|
if (match == null) {
|
||||||
// Events
|
// Events
|
||||||
@ -831,12 +825,10 @@ function pandoraFlotSlicebar(graph_id, values, datacolor, labels, legend, acumul
|
|||||||
|
|
||||||
// Format functions
|
// Format functions
|
||||||
function xFormatter(v, axis) {
|
function xFormatter(v, axis) {
|
||||||
for (i = 0; i < acumulate_data.length; i++) {
|
v = new Date(1000*v);
|
||||||
if (acumulate_data[i] == v) {
|
date_format = (v.getHours()<10?'0':'') + v.getHours() + ":" +
|
||||||
return '<span style=\'font-size: 6pt\'>' + legend[i] + '</span>';
|
(v.getMinutes()<10?'0':'') + v.getMinutes();
|
||||||
}
|
return date_format;
|
||||||
}
|
|
||||||
return '';
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2490,7 +2482,6 @@ function update_left_width_canvas(graph_id) {
|
|||||||
|
|
||||||
function check_adaptions(graph_id) {
|
function check_adaptions(graph_id) {
|
||||||
var classes = $('#'+graph_id).attr('class').split(' ');
|
var classes = $('#'+graph_id).attr('class').split(' ');
|
||||||
|
|
||||||
$.each(classes, function(i,v) {
|
$.each(classes, function(i,v) {
|
||||||
// If has a class starting with adapted, we adapt it
|
// If has a class starting with adapted, we adapt it
|
||||||
if (v.split('_')[0] == 'adapted') {
|
if (v.split('_')[0] == 'adapted') {
|
||||||
|
@ -421,7 +421,7 @@ function flot_pie_chart ($values, $labels, $width, $height, $water_mark,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Prints a FLOT pie chart
|
// Prints a FLOT pie chart
|
||||||
function flot_custom_pie_chart ($flash_charts, $graph_values,
|
function flot_custom_pie_chart ($graph_values,
|
||||||
$width, $height, $colors, $module_name_list, $long_index,
|
$width, $height, $colors, $module_name_list, $long_index,
|
||||||
$no_data,$xaxisname, $yaxisname, $water_mark, $fontpath, $font_size,
|
$no_data,$xaxisname, $yaxisname, $water_mark, $fontpath, $font_size,
|
||||||
$unit, $ttl, $homeurl, $background_color, $legend_position) {
|
$unit, $ttl, $homeurl, $background_color, $legend_position) {
|
||||||
@ -684,16 +684,12 @@ function flot_vcolumn_chart ($graph_data, $width, $height, $color, $legend, $lon
|
|||||||
return $return;
|
return $return;
|
||||||
}
|
}
|
||||||
|
|
||||||
function flot_slicesbar_graph ($graph_data, $period, $width, $height, $legend, $colors, $fontpath, $round_corner, $homeurl, $watermark = '', $adapt_key = '', $stat_win = false, $id_agent = 0, $full_legend_date = array()) {
|
function flot_slicesbar_graph ($graph_data, $period, $width, $height, $legend, $colors, $fontpath, $round_corner, $homeurl, $watermark = '', $adapt_key = '', $stat_win = false, $id_agent = 0, $full_legend_date = array(), $not_interactive = 0) {
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
// include_javascript_dependencies_flot_graph();
|
|
||||||
|
|
||||||
$stacked_str = 'stack: stack,';
|
|
||||||
|
|
||||||
// Get a unique identifier to graph
|
// Get a unique identifier to graph
|
||||||
$graph_id = uniqid('graph_');
|
$graph_id = uniqid('graph_');
|
||||||
|
|
||||||
// Set some containers to legend, graph, timestamp tooltip, etc.
|
// Set some containers to legend, graph, timestamp tooltip, etc.
|
||||||
if ($stat_win) {
|
if ($stat_win) {
|
||||||
$return = "<div id='$graph_id' class='noresizevc graph $adapt_key' style='width: ".$width."%; height: ".$height."px; display: inline-block;'></div>";
|
$return = "<div id='$graph_id' class='noresizevc graph $adapt_key' style='width: ".$width."%; height: ".$height."px; display: inline-block;'></div>";
|
||||||
@ -701,54 +697,51 @@ function flot_slicesbar_graph ($graph_data, $period, $width, $height, $legend, $
|
|||||||
else {
|
else {
|
||||||
$return = "<div id='$graph_id' class='noresizevc graph $adapt_key' style='width: ".$width."%; height: ".$height."px;'></div>";
|
$return = "<div id='$graph_id' class='noresizevc graph $adapt_key' style='width: ".$width."%; height: ".$height."px;'></div>";
|
||||||
}
|
}
|
||||||
|
|
||||||
$return .= "<div id='value_$graph_id' style='display:none; position:absolute; background:#fff; border: solid 1px #aaa; padding: 2px'></div>";
|
$return .= "<div id='value_$graph_id' style='display:none; position:absolute; background:#fff; border: solid 1px #aaa; padding: 2px'></div>";
|
||||||
|
|
||||||
// Set a weird separator to serialize and unserialize passing data from php to javascript
|
// Set a weird separator to serialize and unserialize passing data from php to javascript
|
||||||
$separator = ';;::;;';
|
$separator = ';;::;;';
|
||||||
$separator2 = ':,:,,,:,:';
|
$separator2 = ':,:,,,:,:';
|
||||||
|
|
||||||
// Transform data from our format to library format
|
// Transform data from our format to library format
|
||||||
$labels = array();
|
$labels = array();
|
||||||
$a = array();
|
$a = array();
|
||||||
$vars = array();
|
$vars = array();
|
||||||
|
|
||||||
$datacolor = array();
|
$datacolor = array();
|
||||||
|
|
||||||
$max = 0;
|
$max = 0;
|
||||||
|
|
||||||
$i = count($graph_data);
|
$i = count($graph_data);
|
||||||
|
|
||||||
$intervaltick = $period / $i;
|
$intervaltick = $period / $i;
|
||||||
|
|
||||||
$leg_max_length = 0;
|
$fontsize = $config['font_size'];
|
||||||
foreach ($legend as $l) {
|
$fontpath = $config['fontpath'];
|
||||||
if (strlen($l) > $leg_max_length) {
|
|
||||||
$leg_max_length = strlen($l);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$fontsize = 7;
|
|
||||||
|
|
||||||
$extra_height = 15;
|
$extra_height = 15;
|
||||||
if (defined("METACONSOLE"))
|
if (defined("METACONSOLE"))
|
||||||
$extra_height = 20;
|
$extra_height = 20;
|
||||||
|
|
||||||
$return .= "<div id='extra_$graph_id' style='font-size: ".$fontsize."pt; display:none; position:absolute; overflow: auto; height: ".$extra_height."px; background:#fff; padding: 2px 2px 2px 2px; border: solid #000 1px;'></div>";
|
$return .= "<div id='extra_$graph_id' style='font-size: ".$fontsize."pt; display:none; position:absolute; overflow: auto; height: ".$extra_height."px; background:#fff; padding: 2px 2px 2px 2px; border: solid #000 1px;'></div>";
|
||||||
|
|
||||||
$maxticks = (int) ($width / ($fontsize * $leg_max_length));
|
$maxticks = (int) 20;
|
||||||
|
|
||||||
$i_aux = $i;
|
$i_aux = $i;
|
||||||
|
|
||||||
while(1) {
|
while(1) {
|
||||||
if ($i_aux <= $maxticks ) {
|
if ($i_aux <= $maxticks ) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
$intervaltick*= 2;
|
$intervaltick*= 2;
|
||||||
|
|
||||||
$i_aux /= 2;
|
$i_aux /= 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
$intervaltick = (int) $intervaltick;
|
$intervaltick = (int) $intervaltick;
|
||||||
|
|
||||||
$acumulate = 0;
|
$acumulate = 0;
|
||||||
$c = 0;
|
$c = 0;
|
||||||
$acumulate_data = array();
|
$acumulate_data = array();
|
||||||
@ -773,12 +766,15 @@ function flot_slicesbar_graph ($graph_data, $period, $width, $height, $legend, $
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Store serialized data to use it from javascript
|
// Store serialized data to use it from javascript
|
||||||
$labels = implode($separator,$labels);
|
$labels = implode($separator,$labels);
|
||||||
$datacolor = implode($separator,$datacolor);
|
$datacolor = implode($separator,$datacolor);
|
||||||
$legend = io_safe_output(implode($separator,$legend));
|
if(is_array($legend)){
|
||||||
if (!empty($full_legend_date)) {
|
$legend = io_safe_output(implode($separator,$legend));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($full_legend_date) && count($full_legend_date) > 0 ) {
|
||||||
$full_legend_date = io_safe_output(implode($separator,$full_legend_date));
|
$full_legend_date = io_safe_output(implode($separator,$full_legend_date));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -807,7 +803,7 @@ function flot_slicesbar_graph ($graph_data, $period, $width, $height, $legend, $
|
|||||||
// Javascript code
|
// Javascript code
|
||||||
$return .= "<script type='text/javascript'>";
|
$return .= "<script type='text/javascript'>";
|
||||||
$return .= "//<![CDATA[\n";
|
$return .= "//<![CDATA[\n";
|
||||||
$return .= "pandoraFlotSlicebar('$graph_id', '$values', '$datacolor', '$labels', '$legend', '$acumulate_data', $intervaltick, false, $max, '$separator', '$separator2', '', $id_agent, '$full_legend_date')";
|
$return .= "pandoraFlotSlicebar('$graph_id', '$values', '$datacolor', '$labels', '$legend', '$acumulate_data', $intervaltick, '$fontpath', $fontsize, '$separator', '$separator2', '', $id_agent, '$full_legend_date', $not_interactive)";
|
||||||
$return .= "\n//]]>";
|
$return .= "\n//]]>";
|
||||||
$return .= "</script>";
|
$return .= "</script>";
|
||||||
|
|
||||||
|
@ -741,8 +741,7 @@ if (! isset ($config['id_user'])) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
if (isset($_GET["loginhash_data"])) {
|
||||||
if ( ($_GET["loginhash_data"]) && ($_GET["loginhash_data"])) {
|
|
||||||
|
|
||||||
$loginhash_data = get_parameter("loginhash_data", "");
|
$loginhash_data = get_parameter("loginhash_data", "");
|
||||||
$loginhash_user = str_rot13(get_parameter("loginhash_user", ""));
|
$loginhash_user = str_rot13(get_parameter("loginhash_user", ""));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user