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'];
|
||||
$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(
|
||||
$module_list,
|
||||
$params,
|
||||
$params_combined
|
||||
);
|
||||
echo '</div>';
|
||||
}
|
||||
elseif($type_graph_pdf == 'sparse'){
|
||||
echo '<div>';
|
||||
break;
|
||||
case 'sparse':
|
||||
echo grafico_modulo_sparse($params);
|
||||
echo '</div>';
|
||||
}
|
||||
elseif($type_graph_pdf == 'pie_chart'){
|
||||
echo '<div>';
|
||||
break;
|
||||
case 'pie_chart':
|
||||
echo flot_pie_chart(
|
||||
$params['values'],
|
||||
$params['keys'],
|
||||
@ -140,8 +137,68 @@ if (file_exists ('languages/'.$user_language.'.mo')) {
|
||||
$params['colors'],
|
||||
$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;
|
||||
?>
|
||||
|
@ -544,28 +544,30 @@ function db_get_module_ranges_unknown($id_agente_modulo, $tstart = false, $tend
|
||||
|
||||
$return = array();
|
||||
$i=0;
|
||||
foreach ($events as $event) {
|
||||
switch ($event["event_type"]) {
|
||||
case "going_up_critical":
|
||||
case "going_up_warning":
|
||||
case "going_up_normal":
|
||||
case "going_down_critical":
|
||||
case "going_down_warning":
|
||||
case "going_down_normal": {
|
||||
if ($last_status == 1) {
|
||||
$return[$i]["time_to"] = $event["utimestamp"];
|
||||
$i++;
|
||||
$last_status = 0;
|
||||
if(is_array($events)){
|
||||
foreach ($events as $event) {
|
||||
switch ($event["event_type"]) {
|
||||
case "going_up_critical":
|
||||
case "going_up_warning":
|
||||
case "going_up_normal":
|
||||
case "going_down_critical":
|
||||
case "going_down_warning":
|
||||
case "going_down_normal": {
|
||||
if ($last_status == 1) {
|
||||
$return[$i]["time_to"] = $event["utimestamp"];
|
||||
$i++;
|
||||
$last_status = 0;
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "going_unknown":{
|
||||
if ($last_status == 0){
|
||||
$return[$i] = array();
|
||||
$return[$i]["time_from"] = $event["utimestamp"];
|
||||
$last_status = 1;
|
||||
case "going_unknown":{
|
||||
if ($last_status == 0){
|
||||
$return[$i] = array();
|
||||
$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
|
||||
if(count($return[$pool_id]['data'] > 1)) {
|
||||
if(count($return[$pool_id]['data']) > 1) {
|
||||
usort(
|
||||
$return[$pool_id]['data'],
|
||||
function ($a, $b) {
|
||||
|
@ -1820,11 +1820,8 @@ function graphic_combined_module (
|
||||
$height = 500;
|
||||
}
|
||||
|
||||
$flash_charts = true;
|
||||
|
||||
if($params_combined['stacked'] == CUSTOM_GRAPH_HBARS){
|
||||
$output = hbar_graph(
|
||||
true,
|
||||
$graph_values,
|
||||
$width,
|
||||
$height,
|
||||
@ -1847,7 +1844,6 @@ function graphic_combined_module (
|
||||
|
||||
if($params_combined['stacked'] == CUSTOM_GRAPH_VBARS){
|
||||
$output = vbar_graph(
|
||||
true,
|
||||
$graph_values,
|
||||
$width,
|
||||
$height,
|
||||
@ -1941,7 +1937,6 @@ function graphic_combined_module (
|
||||
$color = color_graph_array();
|
||||
|
||||
$output = ring_graph(
|
||||
true,
|
||||
$graph_values,
|
||||
$width,
|
||||
$height,
|
||||
@ -3125,7 +3120,6 @@ function graph_custom_sql_graph ($id, $width, $height,
|
||||
switch ($type) {
|
||||
case 'sql_graph_vbar': // vertical bar
|
||||
return vbar_graph(
|
||||
$flash_charts,
|
||||
$data,
|
||||
$width,
|
||||
$height,
|
||||
@ -3149,7 +3143,6 @@ function graph_custom_sql_graph ($id, $width, $height,
|
||||
break;
|
||||
case 'sql_graph_hbar': // horizontal bar
|
||||
return hbar_graph(
|
||||
$flash_charts,
|
||||
$data,
|
||||
$width,
|
||||
$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) {
|
||||
global $config;
|
||||
global $graphic_type;
|
||||
|
||||
|
||||
|
||||
$data = array ();
|
||||
|
||||
|
||||
//$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
|
||||
|
||||
@ -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);
|
||||
|
||||
|
||||
// Draw slicebar graph
|
||||
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);
|
||||
|
@ -1320,7 +1320,6 @@ function reporting_event_top_n($report, $content, $type = 'dinamic',
|
||||
|
||||
//Display bars graph
|
||||
$return['charts']['bars'] = hbar_graph(
|
||||
false,
|
||||
$data_hbar,
|
||||
$width,
|
||||
count($data_hbar) * 50,
|
||||
@ -2209,7 +2208,6 @@ function reporting_exception($report, $content, $type = 'dinamic',
|
||||
|
||||
|
||||
$params = array(
|
||||
'flash_chart' => false,
|
||||
'chart_data' => $data_hbar,
|
||||
'width' => 600,
|
||||
'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) {
|
||||
global $config;
|
||||
|
||||
@ -2902,8 +2884,7 @@ function reporting_get_stats_summary($data, $graph_width, $graph_height) {
|
||||
|
||||
if ($data["monitor_checks"] > 0) {
|
||||
// Fixed width non interactive charts
|
||||
$status_chart_width = $config["flash_charts"] == false
|
||||
? 100 : $graph_width;
|
||||
$status_chart_width = $graph_width;
|
||||
|
||||
$tdata[0] =
|
||||
'<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) {
|
||||
|
||||
global $config;
|
||||
if (!defined("METACONSOLE")) {
|
||||
include_once ($config['homedir'] .'/include/graphs/functions_gd.php');
|
||||
@ -3840,9 +3822,9 @@ function reporting_get_event_histogram_meta ($width) {
|
||||
|
||||
$ttl = 1;
|
||||
$urlImage = ui_get_full_url(false, true, false, false);
|
||||
|
||||
|
||||
$data = array ();
|
||||
|
||||
|
||||
//$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
|
||||
|
||||
@ -3865,10 +3847,10 @@ function reporting_get_event_histogram_meta ($width) {
|
||||
EVENT_CRIT_MAJOR => COL_MAJOR,
|
||||
EVENT_CRIT_CRITICAL => COL_CRITICAL
|
||||
);
|
||||
|
||||
|
||||
$user_groups = users_get_groups($config['id_user'], 'ER');
|
||||
$user_groups_ids = array_keys($user_groups);
|
||||
|
||||
|
||||
if (empty($user_groups)) {
|
||||
$groups_condition = ' AND 1 = 0 ';
|
||||
}
|
||||
@ -3880,51 +3862,46 @@ function reporting_get_event_histogram_meta ($width) {
|
||||
$groups_condition .= " AND id_grupo != 0";
|
||||
}
|
||||
$status_condition = " AND estado = 0 ";
|
||||
|
||||
|
||||
$cont = 0;
|
||||
for ($i = 0; $i < $interval; $i++) {
|
||||
$bottom = $datelimit + ($periodtime * $i);
|
||||
if (! $graphic_type) {
|
||||
if ($config['flash_charts']) {
|
||||
$name = date('H:i:s', $bottom);
|
||||
}
|
||||
else {
|
||||
$name = date('H\h', $bottom);
|
||||
}
|
||||
$name = date('H:i:s', $bottom);
|
||||
}
|
||||
else {
|
||||
$name = $bottom;
|
||||
}
|
||||
|
||||
|
||||
// Show less values in legend
|
||||
if ($cont == 0 or $cont % 2)
|
||||
$legend[$cont] = $name;
|
||||
|
||||
|
||||
if ($from_agent_view) {
|
||||
$full_date = date('Y/m/d', $bottom);
|
||||
$full_legend_date[$cont] = $full_date;
|
||||
}
|
||||
|
||||
$full_legend[$cont] = $name;
|
||||
|
||||
|
||||
$top = $datelimit + ($periodtime * ($i + 1));
|
||||
|
||||
|
||||
$time_condition = 'utimestamp > '.$bottom . ' AND utimestamp < '.$top;
|
||||
$sql = sprintf('SELECT criticity,utimestamp
|
||||
FROM tmetaconsole_event
|
||||
WHERE %s %s %s
|
||||
ORDER BY criticity DESC',
|
||||
$time_condition, $groups_condition, $status_condition);
|
||||
|
||||
|
||||
$events = db_get_all_rows_sql($sql);
|
||||
|
||||
|
||||
$events_criticity = array();
|
||||
if(is_array($events)){
|
||||
foreach ($events as $key => $value) {
|
||||
array_push($events_criticity,$value['criticity']);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!empty($events)) {
|
||||
if(array_search('4',$events_criticity) !== false){
|
||||
$data[$cont]['data'] = EVENT_CRIT_CRITICAL;
|
||||
@ -3945,16 +3922,14 @@ function reporting_get_event_histogram_meta ($width) {
|
||||
}else {
|
||||
$data[$cont]['data'] = EVENT_CRIT_INFORMATIONAL;
|
||||
}
|
||||
|
||||
$data[$cont]['utimestamp'] = $periodtime;
|
||||
|
||||
} else {
|
||||
$data[$cont]['utimestamp'] = $periodtime;
|
||||
$data[$cont]['data'] = 1;
|
||||
}
|
||||
$cont++;
|
||||
}
|
||||
|
||||
|
||||
$table = new stdClass();
|
||||
|
||||
$table->width = '100%';
|
||||
@ -3964,16 +3939,15 @@ function reporting_get_event_histogram_meta ($width) {
|
||||
$table->head = array ();
|
||||
$table->title = '<span>' . $text_header_event . '</span>';
|
||||
$table->data[0][0] = "" ;
|
||||
|
||||
|
||||
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);
|
||||
|
||||
$table->data[0][0] = $slicebar;
|
||||
}
|
||||
else {
|
||||
$table->data[0][0] = __('No events');
|
||||
}
|
||||
|
||||
|
||||
if (!$text_header_event) {
|
||||
$event_graph = '<fieldset class="databox tactical_set">
|
||||
<legend>' .
|
||||
@ -3985,7 +3959,6 @@ function reporting_get_event_histogram_meta ($width) {
|
||||
$table->class = 'noclass';
|
||||
$event_graph = html_print_table($table, true);
|
||||
}
|
||||
|
||||
return $event_graph;
|
||||
}
|
||||
|
||||
|
@ -1203,7 +1203,7 @@ function visual_map_print_item($mode = "read", $layoutData,
|
||||
if ($layoutData['label_position']=='left') {
|
||||
if ($layoutData['type_graph'] == 'horizontal') {
|
||||
$img = '<div style="float:right;height:'.$himg.'px;">'.
|
||||
hbar_graph(true, $module_data,
|
||||
hbar_graph($module_data,
|
||||
400, 400, $color, array(), array(),
|
||||
ui_get_full_url("images/image_problem.opaque.png", false, false, false),
|
||||
"", "", $water_mark, $config['fontpath'], 6,
|
||||
@ -1211,7 +1211,7 @@ function visual_map_print_item($mode = "read", $layoutData,
|
||||
}
|
||||
else {
|
||||
$img = '<div style="float:right;height:'.$himg.'px;">'.
|
||||
vbar_graph(true, $module_data,
|
||||
vbar_graph($module_data,
|
||||
400, 400, $color, array(), array(),
|
||||
ui_get_full_url("images/image_problem.opaque.png", false, false, false),
|
||||
"", "", $water_mark, $config['fontpath'], 6,
|
||||
@ -1221,7 +1221,7 @@ function visual_map_print_item($mode = "read", $layoutData,
|
||||
elseif($layoutData['label_position']=='right') {
|
||||
if ($layoutData['type_graph'] == 'horizontal') {
|
||||
$img = '<div style="float:left;height:'.$himg.'px;">'.
|
||||
hbar_graph(true, $module_data,
|
||||
hbar_graph($module_data,
|
||||
400, 400, $color, array(), array(),
|
||||
ui_get_full_url("images/image_problem.opaque.png", false, false, false),
|
||||
"", "", $water_mark, $config['fontpath'], 6,
|
||||
@ -1229,7 +1229,7 @@ function visual_map_print_item($mode = "read", $layoutData,
|
||||
}
|
||||
else {
|
||||
$img = '<div style="float:left;height:'.$himg.'px;">'.
|
||||
vbar_graph(true, $module_data,
|
||||
vbar_graph($module_data,
|
||||
400, 400, $color, array(), array(),
|
||||
ui_get_full_url("images/image_problem.opaque.png", false, false, false),
|
||||
"", "", $water_mark, $config['fontpath'], 6,
|
||||
@ -1238,14 +1238,14 @@ function visual_map_print_item($mode = "read", $layoutData,
|
||||
}
|
||||
else {
|
||||
if ($layoutData['type_graph'] == 'horizontal') {
|
||||
$img = hbar_graph(true, $module_data,
|
||||
$img = hbar_graph($module_data,
|
||||
400, 400, $color, array(), array(),
|
||||
ui_get_full_url("images/image_problem.opaque.png", false, false, false),
|
||||
"", "", $water_mark, $config['fontpath'], 6,
|
||||
"", 0, $config['homeurl'], $layoutData['image'], $layoutData['border_color']);
|
||||
}
|
||||
else {
|
||||
$img = vbar_graph(true, $module_data,
|
||||
$img = vbar_graph($module_data,
|
||||
400, 400, $color, array(), array(),
|
||||
ui_get_full_url("images/image_problem.opaque.png", false, false, false),
|
||||
"", "", $water_mark, $config['fontpath'], 6,
|
||||
@ -1257,7 +1257,7 @@ function visual_map_print_item($mode = "read", $layoutData,
|
||||
if ($layoutData['label_position']=='left') {
|
||||
if ($layoutData['type_graph'] == 'horizontal') {
|
||||
$img = '<div style="float:right;height:'.$himg.'px;">'.
|
||||
hbar_graph(true, $module_data,
|
||||
hbar_graph($module_data,
|
||||
$width, $height, $color, array(), array(),
|
||||
ui_get_full_url("images/image_problem.opaque.png", false, false, false),
|
||||
"", "", $water_mark, $config['fontpath'], 6,
|
||||
@ -1265,7 +1265,7 @@ function visual_map_print_item($mode = "read", $layoutData,
|
||||
}
|
||||
else {
|
||||
$img = '<div style="float:right;height:'.$himg.'px;">'.
|
||||
vbar_graph(true, $module_data,
|
||||
vbar_graph($module_data,
|
||||
$width, $height, $color, array(), array(),
|
||||
ui_get_full_url("images/image_problem.opaque.png", false, false, false),
|
||||
"", "", $water_mark, $config['fontpath'], 6,
|
||||
@ -1275,7 +1275,7 @@ function visual_map_print_item($mode = "read", $layoutData,
|
||||
elseif($layoutData['label_position']=='right') {
|
||||
if ($layoutData['type_graph'] == 'horizontal') {
|
||||
$img = '<div style="float:left;height:'.$himg.'px;">'.
|
||||
hbar_graph(true, $module_data,
|
||||
hbar_graph($module_data,
|
||||
$width, $height, $color, array(), array(),
|
||||
ui_get_full_url("images/image_problem.opaque.png", false, false, false),
|
||||
"", "", $water_mark, $config['fontpath'], 6,
|
||||
@ -1283,7 +1283,7 @@ function visual_map_print_item($mode = "read", $layoutData,
|
||||
}
|
||||
else {
|
||||
$img = '<div style="float:left;height:'.$himg.'px;">'.
|
||||
vbar_graph(true, $module_data,
|
||||
vbar_graph($module_data,
|
||||
$width, $height, $color, array(), array(),
|
||||
ui_get_full_url("images/image_problem.opaque.png", false, false, false),
|
||||
"", "", $water_mark, $config['fontpath'], 6,
|
||||
@ -1292,14 +1292,14 @@ function visual_map_print_item($mode = "read", $layoutData,
|
||||
}
|
||||
else {
|
||||
if ($layoutData['type_graph'] == 'horizontal') {
|
||||
$img = hbar_graph(true, $module_data,
|
||||
$img = hbar_graph($module_data,
|
||||
$width, $height, $color, array(), array(),
|
||||
ui_get_full_url("images/image_problem.opaque.png", false, false, false),
|
||||
"", "", $water_mark, $config['fontpath'], 6,
|
||||
"", 0, $config['homeurl'], $layoutData['image'], $layoutData['border_color']);
|
||||
}
|
||||
else {
|
||||
$img = vbar_graph(true, $module_data,
|
||||
$img = vbar_graph($module_data,
|
||||
$width, $height, $color, array(), array(),
|
||||
ui_get_full_url("images/image_problem.opaque.png", false, false, false),
|
||||
"", "", $water_mark, $config['fontpath'], 6,
|
||||
|
@ -9,107 +9,6 @@
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// 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,
|
||||
$mode = 1, $out_of_lim_str = false, $out_of_lim_image = false,
|
||||
$ttl = 1) {
|
||||
@ -134,7 +33,6 @@ function progressbar($progress, $width, $height, $title, $font,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function slicesbar_graph($chart_data, $period, $width, $height, $colors,
|
||||
$font, $round_corner, $home_url = '', $ttl = 1) {
|
||||
|
||||
@ -153,7 +51,6 @@ function slicesbar_graph($chart_data, $period, $width, $height, $colors,
|
||||
}
|
||||
|
||||
function vbar_graph(
|
||||
$flash_chart,
|
||||
$chart_data,
|
||||
$width,
|
||||
$height,
|
||||
@ -180,44 +77,46 @@ function vbar_graph(
|
||||
return '<img src="' . $no_data_image . '" />';
|
||||
}
|
||||
|
||||
//if ($flash_chart) {
|
||||
return flot_vcolumn_chart ($chart_data, $width, $height, $color,
|
||||
$legend, $long_index, $homeurl, $unit, $water_mark_url,
|
||||
$homedir,$font,$font_size, $from_ux, $from_wux, $backgroundColor,
|
||||
$tick_color);
|
||||
/*
|
||||
}
|
||||
else {
|
||||
$new_chart_data = array();
|
||||
foreach ($chart_data as $key => $value) {
|
||||
if(strlen($key) > 20 && strpos($key, ' - ') !== false){
|
||||
$key_temp = explode(" - ",$key);
|
||||
$key_temp[0] = $key_temp[0]." \n";
|
||||
$key_temp[1]= '...'.substr($key_temp[1],-15);
|
||||
$key2 = $key_temp[0].$key_temp[1];
|
||||
io_safe_output($key2);
|
||||
$new_chart_data[$key2]['g'] = $chart_data[$key]['g'];
|
||||
} else {
|
||||
$new_chart_data[$key] = $value;
|
||||
}
|
||||
}
|
||||
if($ttl == 2){
|
||||
$params = array(
|
||||
'chart_data' => $chart_data,
|
||||
'width' => $width,
|
||||
'height' => $height,
|
||||
'color' => $color,
|
||||
'legend' => $legend,
|
||||
'long_index' => $long_index,
|
||||
'homeurl' => $homeurl,
|
||||
'unit' => $unit,
|
||||
'water_mark_url' => $water_mark_url,
|
||||
'homedir' => $homedir,
|
||||
'font' => $font,
|
||||
'font_size' => $font_size,
|
||||
'from_ux' => $from_ux,
|
||||
'from_wux' => $from_wux,
|
||||
'backgroundColor' => $backgroundColor,
|
||||
'tick_color' => $tick_color
|
||||
);
|
||||
return generator_chart_to_pdf('vbar', $params);
|
||||
}
|
||||
|
||||
$graph = array();
|
||||
$graph['data'] = $new_chart_data;
|
||||
$graph['width'] = $width;
|
||||
$graph['height'] = $height;
|
||||
$graph['color'] = $color;
|
||||
$graph['legend'] = $legend;
|
||||
$graph['xaxisname'] = $xaxisname;
|
||||
$graph['yaxisname'] = $yaxisname;
|
||||
$graph['water_mark'] = $water_mark_file;
|
||||
$graph['font'] = $font;
|
||||
$graph['font_size'] = $font_size;
|
||||
|
||||
$id_graph = serialize_in_temp($graph, null, $ttl);
|
||||
|
||||
return "<img src='" . $homeurl . "include/graphs/functions_pchart.php?static_graph=1&graph_type=vbar&ttl=".$ttl."&id_graph=".$id_graph."'>";
|
||||
}*/
|
||||
return flot_vcolumn_chart (
|
||||
$chart_data,
|
||||
$width,
|
||||
$height,
|
||||
$color,
|
||||
$legend,
|
||||
$long_index,
|
||||
$homeurl,
|
||||
$unit,
|
||||
$water_mark_url,
|
||||
$homedir,
|
||||
$font,
|
||||
$font_size,
|
||||
$from_ux,
|
||||
$from_wux,
|
||||
$backgroundColor,
|
||||
$tick_color
|
||||
);
|
||||
}
|
||||
|
||||
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 = "",
|
||||
$yaxisname = "", $water_mark = "", $font = '', $font_size = '',
|
||||
$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 . '" />';
|
||||
}
|
||||
|
||||
//if ($flash_chart) {
|
||||
return flot_hcolumn_chart($chart_data, $width, $height, $water_mark_url, $font, $font_size, $backgroundColor, $tick_color, $val_min, $val_max);
|
||||
/*
|
||||
if($ttl == 2){
|
||||
$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();
|
||||
$graph['data'] = $chart_data;
|
||||
$graph['width'] = $width;
|
||||
$graph['height'] = $height;
|
||||
$graph['color'] = $color;
|
||||
$graph['legend'] = $legend;
|
||||
$graph['xaxisname'] = $xaxisname;
|
||||
$graph['yaxisname'] = $yaxisname;
|
||||
$graph['force_height'] = $force_height;
|
||||
$graph['water_mark'] = $water_mark_file;
|
||||
$graph['font'] = $font;
|
||||
$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."'>";
|
||||
}
|
||||
*/
|
||||
return flot_hcolumn_chart(
|
||||
$chart_data,
|
||||
$width,
|
||||
$height,
|
||||
$water_mark_url,
|
||||
$font,
|
||||
$font_size,
|
||||
$backgroundColor,
|
||||
$tick_color,
|
||||
$val_min,
|
||||
$val_max
|
||||
);
|
||||
}
|
||||
|
||||
function pie_graph($chart_data, $width,
|
||||
@ -387,20 +276,20 @@ function pie_graph($chart_data, $width,
|
||||
$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){
|
||||
$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);
|
||||
}
|
||||
|
||||
@ -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 = "",
|
||||
$font = '', $font_size = '', $ttl = 1, $legend_position = false,
|
||||
$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
|
||||
$max_values = 18;
|
||||
|
||||
if ($flash_chart) {
|
||||
return flot_custom_pie_chart ($flash_chart, $chart_data,
|
||||
$width, $height, $colors, $module_name_list, $long_index,
|
||||
$no_data, false, '', $water_mark, $font, $font_size,
|
||||
$unit, $ttl, $homeurl, $background_color, $legend_position,$background_color);
|
||||
if($ttl == 2){
|
||||
$params = array(
|
||||
'chart_data' => $chart_data,
|
||||
'width' => $width,
|
||||
'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;
|
||||
//Remove the html_entities
|
||||
$n = 0;
|
||||
$temp = array();
|
||||
$coloretes = array();
|
||||
foreach ($chart_data as $key => $value) {
|
||||
if ($n < $max_values) {
|
||||
$temp[io_safe_output($key)] = $value['value'];
|
||||
$legend[] = io_safe_output($key) .": " . $value['value'] . " " .$value['unit'];
|
||||
}
|
||||
$n++;
|
||||
}
|
||||
$chart_data = $temp;
|
||||
|
||||
$chart_data_trunc = array();
|
||||
$coloretes = array();
|
||||
$n = 1;
|
||||
//~ foreach ($chart_data as $key => $value) {
|
||||
//~ if ($n < $max_values) {
|
||||
|
||||
//~ $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."'>";
|
||||
|
||||
}
|
||||
return flot_custom_pie_chart (
|
||||
$chart_data,
|
||||
$width,
|
||||
$height,
|
||||
$colors,
|
||||
$module_name_list,
|
||||
$long_index,
|
||||
$no_data,
|
||||
false,
|
||||
'',
|
||||
$water_mark,
|
||||
$font,
|
||||
$font_size,
|
||||
$unit,
|
||||
$ttl,
|
||||
$homeurl,
|
||||
$background_color,
|
||||
$legend_position,
|
||||
$background_color
|
||||
);
|
||||
}
|
||||
|
||||
?>
|
||||
|
@ -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);
|
||||
labels = labels.split(separator);
|
||||
legend = legend.split(separator);
|
||||
acumulate_data = acumulate_data.split(separator);
|
||||
datacolor = datacolor.split(separator);
|
||||
|
||||
if (full_legend != false) {
|
||||
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_adaptions(graph_id);
|
||||
|
||||
@ -686,6 +691,7 @@ function pandoraFlotSlicebar(graph_id, values, datacolor, labels, legend, acumul
|
||||
|
||||
for (i=0;i<values.length;i++) {
|
||||
var serie = values[i].split(separator);
|
||||
|
||||
var aux = new Array();
|
||||
$.each(serie,function(i,v) {
|
||||
aux.push([v, i]);
|
||||
@ -693,75 +699,63 @@ function pandoraFlotSlicebar(graph_id, values, datacolor, labels, legend, acumul
|
||||
|
||||
datas.push({
|
||||
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 match = regex.exec(window.location.href);
|
||||
|
||||
if (match == null) {
|
||||
var options = {
|
||||
series: {
|
||||
stack: stack,
|
||||
shadowSize: 0.1,
|
||||
color: '#ddd'
|
||||
var options = {
|
||||
series: {
|
||||
stack: true,
|
||||
bars:{
|
||||
align: 'center'
|
||||
}
|
||||
},
|
||||
grid: {
|
||||
borderWidth:1,
|
||||
borderColor: '#C1C1C1',
|
||||
tickColor: '#fff'
|
||||
},
|
||||
grid: {
|
||||
hoverable: true,
|
||||
clickable: true,
|
||||
borderWidth:1,
|
||||
borderColor: '',
|
||||
tickColor: '#fff'
|
||||
},
|
||||
xaxes: [ {
|
||||
tickFormatter: xFormatter,
|
||||
color: '',
|
||||
tickSize: intervaltick,
|
||||
tickLength: 0
|
||||
} ],
|
||||
yaxes: [ {
|
||||
show: false,
|
||||
tickLength: 0
|
||||
}],
|
||||
legend: {
|
||||
show: false
|
||||
xaxes: [ {
|
||||
tickFormatter: xFormatter,
|
||||
color: '',
|
||||
tickSize: intervaltick,
|
||||
tickLength: 0,
|
||||
font: {
|
||||
size: font_size + 2,
|
||||
family: font+'Font'
|
||||
}
|
||||
};
|
||||
} ],
|
||||
yaxes: [ {
|
||||
show: false,
|
||||
tickLength: 0
|
||||
}],
|
||||
legend: {
|
||||
show: false
|
||||
}
|
||||
};
|
||||
|
||||
if (match == null && not_interactive == 0) {
|
||||
options.grid['hoverable'] = true;
|
||||
options.grid['clickable'] = true;
|
||||
}
|
||||
else {
|
||||
var options = {
|
||||
series: {
|
||||
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
|
||||
}
|
||||
};
|
||||
else{
|
||||
options.grid['hoverable'] = false;
|
||||
options.grid['clickable'] = false;
|
||||
}
|
||||
|
||||
var plot = $.plot($('#'+graph_id), datas, options );
|
||||
$.plot($('#'+graph_id), datas, options );
|
||||
|
||||
if (match == null) {
|
||||
// Events
|
||||
@ -831,12 +825,10 @@ function pandoraFlotSlicebar(graph_id, values, datacolor, labels, legend, acumul
|
||||
|
||||
// Format functions
|
||||
function xFormatter(v, axis) {
|
||||
for (i = 0; i < acumulate_data.length; i++) {
|
||||
if (acumulate_data[i] == v) {
|
||||
return '<span style=\'font-size: 6pt\'>' + legend[i] + '</span>';
|
||||
}
|
||||
}
|
||||
return '';
|
||||
v = new Date(1000*v);
|
||||
date_format = (v.getHours()<10?'0':'') + v.getHours() + ":" +
|
||||
(v.getMinutes()<10?'0':'') + v.getMinutes();
|
||||
return date_format;
|
||||
}
|
||||
}
|
||||
|
||||
@ -2490,7 +2482,6 @@ function update_left_width_canvas(graph_id) {
|
||||
|
||||
function check_adaptions(graph_id) {
|
||||
var classes = $('#'+graph_id).attr('class').split(' ');
|
||||
|
||||
$.each(classes, function(i,v) {
|
||||
// If has a class starting with adapted, we adapt it
|
||||
if (v.split('_')[0] == 'adapted') {
|
||||
|
@ -421,7 +421,7 @@ function flot_pie_chart ($values, $labels, $width, $height, $water_mark,
|
||||
}
|
||||
|
||||
// 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,
|
||||
$no_data,$xaxisname, $yaxisname, $water_mark, $fontpath, $font_size,
|
||||
$unit, $ttl, $homeurl, $background_color, $legend_position) {
|
||||
@ -684,16 +684,12 @@ function flot_vcolumn_chart ($graph_data, $width, $height, $color, $legend, $lon
|
||||
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;
|
||||
|
||||
// include_javascript_dependencies_flot_graph();
|
||||
|
||||
$stacked_str = 'stack: stack,';
|
||||
|
||||
|
||||
// Get a unique identifier to graph
|
||||
$graph_id = uniqid('graph_');
|
||||
|
||||
|
||||
// Set some containers to legend, graph, timestamp tooltip, etc.
|
||||
if ($stat_win) {
|
||||
$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 {
|
||||
$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>";
|
||||
|
||||
|
||||
// Set a weird separator to serialize and unserialize passing data from php to javascript
|
||||
$separator = ';;::;;';
|
||||
$separator2 = ':,:,,,:,:';
|
||||
|
||||
|
||||
// Transform data from our format to library format
|
||||
$labels = array();
|
||||
$a = array();
|
||||
$vars = array();
|
||||
|
||||
|
||||
$datacolor = array();
|
||||
|
||||
|
||||
$max = 0;
|
||||
|
||||
|
||||
$i = count($graph_data);
|
||||
|
||||
|
||||
$intervaltick = $period / $i;
|
||||
|
||||
$leg_max_length = 0;
|
||||
foreach ($legend as $l) {
|
||||
if (strlen($l) > $leg_max_length) {
|
||||
$leg_max_length = strlen($l);
|
||||
}
|
||||
}
|
||||
|
||||
$fontsize = 7;
|
||||
|
||||
|
||||
$fontsize = $config['font_size'];
|
||||
$fontpath = $config['fontpath'];
|
||||
|
||||
$extra_height = 15;
|
||||
if (defined("METACONSOLE"))
|
||||
$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>";
|
||||
|
||||
$maxticks = (int) ($width / ($fontsize * $leg_max_length));
|
||||
|
||||
|
||||
$maxticks = (int) 20;
|
||||
|
||||
$i_aux = $i;
|
||||
|
||||
while(1) {
|
||||
if ($i_aux <= $maxticks ) {
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
$intervaltick*= 2;
|
||||
|
||||
|
||||
$i_aux /= 2;
|
||||
}
|
||||
|
||||
|
||||
$intervaltick = (int) $intervaltick;
|
||||
|
||||
$acumulate = 0;
|
||||
$c = 0;
|
||||
$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
|
||||
$labels = implode($separator,$labels);
|
||||
$datacolor = implode($separator,$datacolor);
|
||||
$legend = io_safe_output(implode($separator,$legend));
|
||||
if (!empty($full_legend_date)) {
|
||||
if(is_array($legend)){
|
||||
$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));
|
||||
}
|
||||
else {
|
||||
@ -807,7 +803,7 @@ function flot_slicesbar_graph ($graph_data, $period, $width, $height, $legend, $
|
||||
// Javascript code
|
||||
$return .= "<script type='text/javascript'>";
|
||||
$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 .= "</script>";
|
||||
|
||||
|
@ -741,8 +741,7 @@ if (! isset ($config['id_user'])) {
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
||||
if ( ($_GET["loginhash_data"]) && ($_GET["loginhash_data"])) {
|
||||
if (isset($_GET["loginhash_data"])) {
|
||||
|
||||
$loginhash_data = get_parameter("loginhash_data", "");
|
||||
$loginhash_user = str_rot13(get_parameter("loginhash_user", ""));
|
||||
|
Loading…
x
Reference in New Issue
Block a user