2012-07-10 Miguel de Dios <miguel.dedios@artica.es>

* include/constants.php: added more constants into the constants
	block of time conversion to seconds.
	
	* godmode/alerts/alert_commands.php, godmode/setup/performance.php,
	include/help/en/help_date_format.php, include/functions_netflow.php,
	include/functions_tags.php, include/graphs/functions_pchart.php,
	include/functions_modules.php, extensions/agents_modules.php,
	extensions/update_manager.php, extensions/resource_exportation.php,
	extensions/module_groups.php,
	extensions/update_manager/lib/libupdate_manager_client.php,
	extensions/system_info.php, operation/events/events_rss.php,
	operation/events/export_csv.php, mobile/operation/events/events.php,
	mobile/include/system.class.php: used the new constants time instead
	the magic numbers, and cleaned source code style.




git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6762 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
mdtrooper 2012-07-10 13:31:34 +00:00
parent 9f3f620015
commit 8270ef2bb6
19 changed files with 440 additions and 413 deletions

View File

@ -1,3 +1,20 @@
2012-07-10 Miguel de Dios <miguel.dedios@artica.es>
* include/constants.php: added more constants into the constants
block of time conversion to seconds.
* godmode/alerts/alert_commands.php, godmode/setup/performance.php,
include/help/en/help_date_format.php, include/functions_netflow.php,
include/functions_tags.php, include/graphs/functions_pchart.php,
include/functions_modules.php, extensions/agents_modules.php,
extensions/update_manager.php, extensions/resource_exportation.php,
extensions/module_groups.php,
extensions/update_manager/lib/libupdate_manager_client.php,
extensions/system_info.php, operation/events/events_rss.php,
operation/events/export_csv.php, mobile/operation/events/events.php,
mobile/include/system.class.php: used the new constants time instead
the magic numbers, and cleaned source code style.
2012-07-10 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_ui.php: moved the constants for the status

View File

@ -163,9 +163,9 @@ function mainAgentsModules() {
}
echo '<table cellpadding="4" cellspacing="4" border="0" width=98%>';
echo "<th width='140px' height='25px'>".__("Agents")." / ".__("Modules")."</th>";
echo "<th width='140px' height='25px'>".__("Agents")." / ".__("Modules")."</th>";
if($hor_offset > 0) {
$new_hor_offset = $hor_offset-$block;
echo "<th width='20px' style='vertical-align:top; padding-top: 35px;' rowspan='".($nagents+1)."'><a href='index.php?sec=extensions&sec2=extensions/agents_modules&refr=0&hor_offset=".$new_hor_offset."&offset=".$offset."&group_id=".$group_id."&modulegroup=".$modulegroup."'>".html_print_image("images/darrowleft.png",true, array('title' => __('Previous modules')))."</a> </th>";
@ -185,7 +185,7 @@ function mainAgentsModules() {
$new_hor_offset = $hor_offset+$block;
echo "<th width='20px' style='vertical-align:top; padding-top: 35px;' rowspan='".($nagents+1)."'><a href='index.php?sec=extensions&sec2=extensions/agents_modules&hor_offset=".$new_hor_offset."&offset=".$offset."&group_id=".$group_id."&modulegroup=".$modulegroup."'>".html_print_image("images/darrowright.png",true, array('title' => __('More modules')))."</a> </th>";
}
$filter_agents = false;
if($group_id > 0) {
$filter_agents = array('id_grupo' => $group_id);
@ -193,11 +193,11 @@ function mainAgentsModules() {
// Prepare pagination
ui_pagination ((int)count(agents_get_agents ($filter_agents)));
echo "<br>";
foreach ($agents as $agent) {
// Get stats for this group
$agent_status = agents_get_status($agent['id_agente']);
switch($agent_status) {
case 4: // Alert fired status
$rowcolor = 'group_view_alrm';

View File

@ -49,7 +49,7 @@ if (is_ajax ()) {
FROM talert_template_module_actions AS t1
INNER JOIN talert_actions AS t2 ON t1.id_alert_action = t2.id
WHERE t1.id_alert_template_module = ' . $template['id'] . '
OR t2.id = ' . $template['id_alert_action'] . ';';
OR t2.id = ' . $template['id_alert_action'] . ';';
$actions = db_get_all_rows_sql($sql);
if ($actions === false) {
$actions = array();

View File

@ -103,7 +103,7 @@ function output_xml_report($id) {
echo "<description>" . io_safe_output($item['description']) . "</description>\n";
echo "<period>" . io_safe_output($item['period']) . "</period>\n";
if ($item['id_agent'] != 0) {
$agent = agents_get_name($item['id_agent']);
$agent = agents_get_name($item['id_agent']);
}
if ($item['id_agent_module'] != 0) {
$module = db_get_value('nombre', 'tagente_modulo', 'id_agente_modulo', $item['id_agent_module']);
@ -118,7 +118,7 @@ function output_xml_report($id) {
switch (io_safe_output($item['type'])) {
case 1:
case 'simple_graph':
break;
break;
case 'simple_baseline_graph':
break;
case 2:

View File

@ -190,7 +190,7 @@ function getLastLog($numLines = 2000) {
show_logfile("/etc/mysql/my.cnf", $numLines);
show_logfile($config["homedir"]."/include/config.php", $numLines);
show_logfile("/etc/pandora/pandora_server.conf", $numLines);
show_logfile("/var/log/syslog", $numLines);
show_logfile("/var/log/syslog", $numLines);
}
function show_array($title, $anchor, $array = array()) {
@ -238,7 +238,7 @@ function show_array($title, $anchor, $array = array()) {
function mainSystemInfo() {
global $config;
if (! check_acl ($config['id_user'], 0, "PM") && ! is_user_admin ($config['id_user'])) {
db_pandora_audit("ACL Violation", "Trying to access Setup Management");
require ("general/noaccess.php");
@ -324,9 +324,9 @@ function mainSystemInfo() {
@unlink($zipArchive);
$url_zip = ui_get_full_url(false);
$url = '<a href="' .$url_zip . 'attachment/last_info.zip">' . __('System info file zipped') . '</a>';
if($log_info || $system_info || $pandora_diag) {
echo '<b>' . __('File:') . '</b> ' . $url . '<br />';
echo '<b>' . __('Location:') . '</b> ' . $zipArchive;

View File

@ -31,31 +31,31 @@ if (is_ajax ()) {
$checking_online_enterprise_package =
(bool)get_parameter('checking_online_enterprise_package', false);
$get_license_info = get_parameter('get_license_info', 0);
$get_license_info = get_parameter('get_license_info', 0);
if ($checking_online_enterprise_package) {
checking_online_enterprise_package();
return;
}
if ($get_license_info) {
enterprise_include_once('include/functions_license.php');
// If Pandora enterprise check license
$is_enteprise = enterprise_hook('license_show_info');
// If Open show info
if ($is_enteprise === ENTERPRISE_NOT_HOOK){
$table->width = '98%';
$table->data = array ();
$table->style = array();
$table->style[0] = 'text-align: left';
echo '<div style="float: left; width: 20%; margin-top: 40px; margin-left: 20px;">';
html_print_image('images/lock_license.png', false);
echo '</div>';
$table->data[0][0] = '<strong>'.__('Expires').'</strong>';
$table->data[0][1] = __('Never');
$table->data[1][0] = '<strong>'.__('Platform Limit').'</strong>';
@ -65,12 +65,11 @@ if (is_ajax ()) {
$table->data[2][1] = $count_agents;
$table->data[3][0] = '<strong>'.__('License Mode').'</strong>';
$table->data[3][1] = __('Open Source Version');
echo '<div style="width: 70%; margin-top: 30px; margin-left: 20px; float: right;">';
html_print_table ($table);
echo '</div>';
echo '</div>';
}
}
return;

View File

@ -505,7 +505,7 @@ function um_client_upgrade_to_package ($package, $settings, $force = true, $upda
um_client_db_connect ($settings);
um_component_db_connect ();
foreach ($package->updates as $update) {
$success = um_client_apply_update ($update, $settings, $force);
$success = um_client_apply_update ($update, $settings, $force);
if (! $success) {
echo '<p /><strong>Failed</strong> on:<br />';
um_client_print_update ($update, $settings);

View File

@ -49,8 +49,8 @@ if ($create_command) {
$name = (string) get_parameter ('name');
$command = (string) get_parameter ('command');
$description = (string) get_parameter ('description');
$name_check = db_get_value ('name', 'talert_commands', 'name', $name);
$name_check = db_get_value ('name', 'talert_commands', 'name', $name);
if (!$name_check) {
$result = alerts_create_alert_command ($name, $command,
array ('description' => $description));
@ -60,7 +60,7 @@ if ($create_command) {
else {
$result = '';
}
if ($result) {
db_pandora_audit("Command management", "Create alert command #" . $result, false, false, $info);
}
@ -89,7 +89,7 @@ if ($update_command) {
$values['name'] = $name;
$values['command'] = $command;
$values['description'] = $description;
$name_check = db_get_value ('name', 'talert_commands', 'name', $name);
$name_check = db_get_value ('name', 'talert_commands', 'name', $name);
if (!$name || !$name_check) {
$result = '';
@ -98,7 +98,7 @@ if ($update_command) {
$result = alerts_update_alert_command ($id, $values);
$info = 'Name: ' . $name . ' Command: ' . $command . ' Description: ' . $description;
}
if ($result) {
db_pandora_audit("Command management", "Update alert command #" . $id, false, false, $info);
}

View File

@ -80,14 +80,14 @@ $table_other->data[1][0] = __('Compact interpolation in hours (1 Fine-20 bad)');
$table_other->data[1][1] = html_print_input_text ('step_compact', $config["step_compact"], '', 5, 5, true);
$intervals = array ();
$intervals[3600] = "1 ".__('hour');
$intervals[43200] = "12 ".__('hours');
$intervals[86400] = __('Last day');
$intervals[172800] = "2 ". __('days');
$intervals[864000] = "10 ". __('days');
$intervals[604800] = __('Last week');
$intervals[1209600] = "2 " . __('weeks');
$intervals[2592000] = __('Last month');
$intervals[SECONDS_1HOUR] = __('1 hour');
$intervals[SECONDS_12HOURS] = __('12 hours');
$intervals[SECONDS_1DAY] = __('Last day');
$intervals[SECONDS_2DAY] = __('2 days');
$intervals[SECONDS_10DAY] = __('10 days');
$intervals[SECONDS_1WEEK] = __('Last week');
$intervals[SECONDS_2WEEK] = __('2 weeks');
$intervals[SECONDS_1MONTH] = __('Last month');
$table_other->data[2][0] = __('SLA period (seconds)') . ui_print_help_tip(__('You can see this in SLA agent tab.'), true);
$table_other->data[2][1] = html_print_select ($intervals, 'sla_period', $config["sla_period"], '', '', '0', true);

View File

@ -52,21 +52,32 @@ define ('ERR_CONNECTION', -80000);
/* Seconds in a time unit constants */
define('SECONDS_1MINUTE',60);
define('SECONDS_5MINUTES',300);
define('SECONDS_30MINUTES',1800);
define('SECONDS_1HOUR',3600);
define('SECONDS_6HOURS',21600);
define('SECONDS_12HOURS',43200);
define('SECONDS_1DAY',86400);
define('SECONDS_1WEEK',604800);
define('SECONDS_15DAYS',1296000);
define('SECONDS_1MONTH',2592000);
define('SECONDS_3MONTHS',7776000);
define('SECONDS_6MONTHS',15552000);
define('SECONDS_1YEAR',31104000);
define('SECONDS_2YEARS',62208000);
define('SECONDS_3YEARS',93312000);
define('SECONDS_1MINUTE', 60);
define('SECONDS_5MINUTES', 300);
define('SECONDS_10MINUTES', 600);
define('SECONDS_15MINUTES', 900);
define('SECONDS_30MINUTES', 1800);
define('SECONDS_1HOUR', 3600);
define('SECONDS_2HOUR', 7200);
define('SECONDS_3HOUR', 10800);
define('SECONDS_5HOUR', 18000);
define('SECONDS_6HOURS', 21600);
define('SECONDS_12HOURS', 43200);
define('SECONDS_1DAY', 86400);
define('SECONDS_2DAY', 172800);
define('SECONDS_4DAY', 345600);
define('SECONDS_5DAY', 432000);
define('SECONDS_1WEEK', 604800);
define('SECONDS_10DAY', 864000);
define('SECONDS_2WEEK', 1209600);
define('SECONDS_15DAYS', 1296000);
define('SECONDS_1MONTH', 2592000);
define('SECONDS_2MONTHS', 5184000);
define('SECONDS_3MONTHS', 7776000);
define('SECONDS_6MONTHS', 15552000);
define('SECONDS_1YEAR', 31104000);
define('SECONDS_2YEARS', 62208000);
define('SECONDS_3YEARS', 93312000);

View File

@ -1057,22 +1057,21 @@ function modules_get_last_value ($id_agentmodule) {
function modules_get_previous_data ($id_agent_module, $utimestamp = 0, $string = 0) {
if (empty ($utimestamp))
$utimestamp = time ();
if ($string == 1) {
$table = 'tagente_datos_string';
}
else {
$table = 'tagente_datos';
}
// 172800 = 60×60×24*2 Search up to 2 days before utimestamp
$sql = sprintf ('SELECT *
FROM ' . $table . '
WHERE id_agente_modulo = %d
AND utimestamp <= %d
AND utimestamp >= %d
ORDER BY utimestamp DESC',
$id_agent_module, $utimestamp, $utimestamp - 172800);
$id_agent_module, $utimestamp, $utimestamp - SECONDS_2DAY);
return db_get_row_sql ($sql, true);
}

View File

@ -744,17 +744,17 @@ function netflow_save_cache ($data, $cache_file) {
*/
function netflow_load_cache (&$data, $cache_file, $start_date, $end_date, $aggregate) {
global $config;
// Open cache file
$cache_data = @file_get_contents ($cache_file);
$cache_data = @unserialize ($cache_data);
// Calculate the number of intervals
$num_intervals = $config['graph_res'] * 50;
$period = $end_date - $start_date;
$interval_length = (int) ($period / $num_intervals);
$last_timestamp = $start_date;
// Initializa chart data
if ($aggregate == 'none') {
if ($cache_data === FALSE) {
@ -772,29 +772,32 @@ function netflow_load_cache (&$data, $cache_file, $start_date, $end_date, $aggre
$last_timestamp = $cache_timestamp;
}
unset ($cache_data[$cache_timestamp]);
} else {
}
else {
break;
}
}
if ($interval_count > 0) {
$data[$timestamp]['data'] = (int) ($interval_total / $interval_count);
} else {
}
else {
$data[$timestamp]['data'] = 0;
}
}
} else {
for ($i = 0; $i < $num_intervals; $i++) {
$timestamp = $start_date + ($interval_length * $i);
$interval_count = array ();
$interval_total = array ();
foreach ($data['sources'] as $source => $null) {
$data['data'][$timestamp][$source] = 0;
}
}
}
else {
for ($i = 0; $i < $num_intervals; $i++) {
$timestamp = $start_date + ($interval_length * $i);
$interval_count = array ();
$interval_total = array ();
foreach ($data['sources'] as $source => $null) {
$data['data'][$timestamp][$source] = 0;
}
}
}
return $last_timestamp;
}
@ -805,43 +808,42 @@ function netflow_load_cache (&$data, $cache_file, $start_date, $end_date, $aggre
*
*/
function netflow_get_chart_types () {
return array(
__('Area graph'),
__('Pie graph'),
__('Data table'),
__('Statistics table')
);
__('Area graph'),
__('Pie graph'),
__('Data table'),
__('Statistics table'));
}
/**
* Gets valid intervals for a netflow chart in the format:
*
* interval_length => interval_description
* interval_length => interval_description
*
* @return Array of valid intervals.
*
*/
function netflow_get_valid_intervals () {
return array ('600' => __('10 mins'),
'900' => __('15 mins'),
'1800' => __('30 mins'),
'3600' => __('1 hour'),
'7200' => __('2 hours'),
'18000' => __('5 hours'),
'43200' => __('12 hours'),
'86400' => __('1 day'),
'172800' => __('2 days'),
'432000' => __('5 days'),
'1296000' => __('15 days'),
'604800' => __('Last week'),
'2592000' => __('Last month'),
'5184000' => __('2 months'),
'7776000' => __('3 months'),
'15552000' => __('6 months'),
'31104000' => __('Last year'),
'62208000' => __('2 years')
);
return array (
(string)SECONDS_10MINUTES => __('10 mins'),
(string)SECONDS_15MINUTES => __('15 mins'),
(string)SECONDS_30MINUTES => __('30 mins'),
(string)SECONDS_1HOUR => __('1 hour'),
(string)SECONDS_2HOUR => __('2 hours'),
(string)SECONDS_5HOUR => __('5 hours'),
(string)SECONDS_12HOURS => __('12 hours'),
(string)SECONDS_1DAY => __('1 day'),
(string)SECONDS_2DAY => __('2 days'),
(string)SECONDS_5DAY => __('5 days'),
(string)SECONDS_15DAYS => __('15 days'),
(string)SECONDS_1WEEK => __('Last week'),
(string)SECONDS_1MONTH => __('Last month'),
(string)SECONDS_2MONTHS => __('2 months'),
(string)SECONDS_3MONTHS => __('3 months'),
(string)SECONDS_6MONTHS => __('6 months'),
(string)SECONDS_1YEAR => __('Last year'),
(string)SECONDS_2YEARS => __('2 years'));
}
/**
@ -857,18 +859,19 @@ function netflow_get_valid_intervals () {
*
*/
function netflow_draw_item ($start_date, $end_date, $type, $filter, $command, $filter, $max_aggregates, $unique_id) {
$aggregate = $filter['aggregate'];
$unit = $filter['output'];
$interval = $end_date - $start_date;
// Process item
switch ($type){
switch ($type) {
case '0':
$data = netflow_get_data ($start_date, $end_date, $command, $unique_id, $aggregate, $max_aggregates, $unit);
if ($aggregate != 'none') {
echo graph_netflow_aggregate_area($data, $interval, 660, 320, 0);
} else {
}
else {
echo graph_netflow_total_area($data, $interval, 660, 320, 0);
}
break;

View File

@ -381,16 +381,16 @@ function tags_update_policy_module_tag ($id_policy_module, $tags, $autocommit =
$result_tag = db_process_sql_delete ('ttag_policy_module', array('id_policy_module' => $id_policy_module));
$values = array();
foreach ($tags as $tag){
foreach ($tags as $tag) {
//Protect against default insert
if (empty($tag))
continue;
continue;
$values['id_tag'] = $tag;
$values['id_policy_module'] = $id_policy_module;
$result_tag = db_process_sql_insert('ttag_policy_module', $values, false);
if ($result_tag === false)
$errn++;
$errn++;
}
}
@ -407,7 +407,7 @@ function tags_get_module_tags ($id_agent_module){
return false;
$tags = db_get_all_rows_filter('ttag_module', array('id_agente_modulo' => $id_agent_module), false);
if ($tags === false)
return false;
@ -431,7 +431,7 @@ function tags_get_policy_module_tags ($id_policy_module){
return false;
$tags = db_get_all_rows_filter('ttag_policy_module', array('id_policy_module' => $id_policy_module), false);
if ($tags === false)
return false;
@ -449,9 +449,8 @@ function tags_get_policy_module_tags ($id_policy_module){
* @return mixed Array with tags.
*/
function tags_get_all_tags (){
$tags = db_get_all_fields_in_table('ttag', 'name');
$tags = db_get_all_fields_in_table('ttag', 'name');
if ($tags === false)
return false;
@ -462,5 +461,4 @@ function tags_get_all_tags (){
return $return;
}
?>
?>

View File

@ -303,7 +303,7 @@ switch($graph_type) {
}
function pch_slicebar_graph ($graph_type, $data, $period, $width, $height, $colors, $font, $round_corner, $font_size) {
/* CAT:Slicebar charts */
/* CAT:Slicebar charts */
set_time_limit (0);
@ -312,7 +312,7 @@ function pch_slicebar_graph ($graph_type, $data, $period, $width, $height, $colo
/* Turn of Antialiasing */
$myPicture->Antialias = 0;
$myPicture->setFontProperties(array("FontName"=> $font, "FontSize"=>$font_size,"R"=>80,"G"=>80,"B"=>80));
// Round corners defined in global setup
@ -364,108 +364,108 @@ function pch_slicebar_graph ($graph_type, $data, $period, $width, $height, $colo
function pch_pie_graph ($graph_type, $data_values, $legend_values, $width,
$height, $font, $water_mark, $font_size) {
/* CAT:Pie charts */
/* CAT:Pie charts */
/* Create and populate the pData object */
$MyData = new pData();
$MyData->addPoints($data_values,"ScoreA");
$MyData->setSerieDescription("ScoreA","Application A");
/* Create and populate the pData object */
$MyData = new pData();
$MyData->addPoints($data_values,"ScoreA");
$MyData->setSerieDescription("ScoreA","Application A");
/* Define the absissa serie */
$MyData->addPoints($legend_values,"Labels");
$MyData->setAbscissa("Labels");
/* Create the pChart object */
$myPicture = new pImage($width,$height,$MyData,TRUE);
/* Set the default font properties */
$myPicture->setFontProperties(array("FontName"=>$font,"FontSize"=>$font_size,"R"=>80,"G"=>80,"B"=>80));
/* Define the absissa serie */
$MyData->addPoints($legend_values,"Labels");
$MyData->setAbscissa("Labels");
/* Create the pChart object */
$myPicture = new pImage($width,$height,$MyData,TRUE);
/* Set the default font properties */
$myPicture->setFontProperties(array("FontName"=>$font,"FontSize"=>$font_size,"R"=>80,"G"=>80,"B"=>80));
$water_mark_height = 0;
$water_mark_width = 0;
if (!empty($water_mark)) {
$water_mark_height = 0;
$water_mark_width = 0;
if (!empty($water_mark)) {
$size_water_mark = getimagesize($water_mark);
$water_mark_height = $size_water_mark[1];
$water_mark_width = $size_water_mark[0];
$myPicture->drawFromPNG(($width - $water_mark_width),
($height - $water_mark_height) - 50, $water_mark);
}
/* Create the pPie object */
$PieChart = new pPie($myPicture,$MyData);
($height - $water_mark_height) - 50, $water_mark);
}
/* Create the pPie object */
$PieChart = new pPie($myPicture,$MyData);
/* Draw an AA pie chart */
switch($graph_type) {
case "pie2d":
$PieChart->draw2DPie($width/4,$height/2,array("DataGapAngle"=>0,"DataGapRadius"=>0, "Border"=>FALSE, "BorderR"=>200, "BorderG"=>200, "BorderB"=>200, "Radius"=>$width/4, "ValueR"=>0, "ValueG"=>0, "ValueB"=>0, "WriteValues"=>TRUE));
/* Draw an AA pie chart */
switch($graph_type) {
case "pie2d":
$PieChart->draw2DPie($width/4,$height/2,array("DataGapAngle"=>0,"DataGapRadius"=>0, "Border"=>FALSE, "BorderR"=>200, "BorderG"=>200, "BorderB"=>200, "Radius"=>$width/4, "ValueR"=>0, "ValueG"=>0, "ValueB"=>0, "WriteValues"=>TRUE));
break;
case "pie3d":
$PieChart->draw3DPie($width/4, $height/2,array("DataGapAngle"=>5,"DataGapRadius"=>6, "Border"=>TRUE, "Radius"=>$width/4, "ValueR"=>0, "ValueG"=>0, "ValueB"=>0, "WriteValues"=>TRUE));
case "pie3d":
$PieChart->draw3DPie($width/4, $height/2,array("DataGapAngle"=>5,"DataGapRadius"=>6, "Border"=>TRUE, "Radius"=>$width/4, "ValueR"=>0, "ValueG"=>0, "ValueB"=>0, "WriteValues"=>TRUE));
break;
}
}
/* Write down the legend next to the 2nd chart*/
/* Write down the legend next to the 2nd chart*/
//Calculate the bottom margin from the size of string in each index
$max_chars = graph_get_max_index($legend_values);
$legend_with_aprox = 32 + (7 * $max_chars);
$PieChart->drawPieLegend($width - $legend_with_aprox, 5, array("R"=>255,"G"=>255,"B"=>255, "BoxSize"=>10));
$PieChart->drawPieLegend($width - $legend_with_aprox, 5, array("R"=>255,"G"=>255,"B"=>255, "BoxSize"=>10));
/* Enable shadow computing */
$myPicture->setShadow(TRUE,array("X"=>3,"Y"=>3,"R"=>0,"G"=>0,"B"=>0,"Alpha"=>10));
/* Render the picture */
$myPicture->stroke();
/* Enable shadow computing */
$myPicture->setShadow(TRUE,array("X"=>3,"Y"=>3,"R"=>0,"G"=>0,"B"=>0,"Alpha"=>10));
/* Render the picture */
$myPicture->stroke();
}
function pch_kiviat_graph ($graph_type, $data_values, $legend_values, $width,
$height, $font, $font_size) {
/* CAT:Radar/Polar charts */
/* CAT:Radar/Polar charts */
/* Create and populate the pData object */
$MyData = new pData();
$MyData->addPoints($data_values,"ScoreA");
$MyData->setSerieDescription("ScoreA","Application A");
/* Create and populate the pData object */
$MyData = new pData();
$MyData->addPoints($data_values,"ScoreA");
$MyData->setSerieDescription("ScoreA","Application A");
/* Define the absissa serie */
$MyData->addPoints($legend_values,"Labels");
$MyData->setAbscissa("Labels");
/* Create the pChart object */
$myPicture = new pImage($width,$height,$MyData,TRUE);
/* Define the absissa serie */
$MyData->addPoints($legend_values,"Labels");
$MyData->setAbscissa("Labels");
/* Create the pChart object */
$myPicture = new pImage($width,$height,$MyData,TRUE);
/* Set the default font properties */
$myPicture->setFontProperties(array("FontName"=>$font,"FontSize"=>$font_size,"R"=>80,"G"=>80,"B"=>80));
/* Set the default font properties */
$myPicture->setFontProperties(array("FontName"=>$font,"FontSize"=>$font_size,"R"=>80,"G"=>80,"B"=>80));
/* Create the pRadar object */
$SplitChart = new pRadar();
/* Create the pRadar object */
$SplitChart = new pRadar();
/* Draw a radar chart */
$myPicture->setGraphArea(20,25,$width-10,$height-10);
/* Draw a radar chart */
$myPicture->setGraphArea(20,25,$width-10,$height-10);
/* Draw an AA pie chart */
switch($graph_type) {
case "radar":
/* Draw an AA pie chart */
switch($graph_type) {
case "radar":
$Options = array("SkipLabels"=>0,"LabelPos"=>RADAR_LABELS_HORIZONTAL,
"LabelMiddle"=>FALSE,"Layout"=>RADAR_LAYOUT_STAR,
"BackgroundGradient"=>array("StartR"=>255,"StartG"=>255,"StartB"=>255,
"StartAlpha"=>100,"EndR"=>207,"EndG"=>227,"EndB"=>125,"EndAlpha"=>50),
"FontName"=>$font,"FontSize"=>$font_size);
$SplitChart->drawRadar($myPicture,$MyData,$Options);
$SplitChart->drawRadar($myPicture,$MyData,$Options);
break;
case "polar":
case "polar":
$Options = array("Layout"=>RADAR_LAYOUT_CIRCLE,"BackgroundGradient"=>array("StartR"=>255,"StartG"=>255,"StartB"=>255,"StartAlpha"=>100,"EndR"=>207,"EndG"=>227,"EndB"=>125,"EndAlpha"=>50),
"FontName"=>$font,"FontSize"=>$font_size);
$SplitChart->drawRadar($myPicture,$MyData,$Options);
$SplitChart->drawRadar($myPicture,$MyData,$Options);
break;
}
/* Render the picture */
$myPicture->stroke();
}
/* Render the picture */
$myPicture->stroke();
}
function pch_bar_graph ($graph_type, $index, $data, $width, $height, $font,
@ -476,10 +476,10 @@ function pch_bar_graph ($graph_type, $index, $data, $width, $height, $font,
unset($legend);
}
/* Create and populate the pData object */
$MyData = new pData();
$overridePalette = array();
foreach($data as $i => $values) {
/* Create and populate the pData object */
$MyData = new pData();
$overridePalette = array();
foreach($data as $i => $values) {
$MyData->addPoints($values,$i);
if(!empty($rgb_color)) {
@ -507,37 +507,37 @@ function pch_bar_graph ($graph_type, $index, $data, $width, $height, $font,
else {
$overridePalette = false;
}
}
}
$MyData->setAxisName(0,$yaxisname);
$MyData->addPoints($index,"Xaxis");
$MyData->setSerieDescription("Xaxis", $xaxisname);
$MyData->setAbscissa("Xaxis");
$MyData->setAxisName(0,$yaxisname);
$MyData->addPoints($index,"Xaxis");
$MyData->setSerieDescription("Xaxis", $xaxisname);
$MyData->setAbscissa("Xaxis");
/* Create the pChart object */
$myPicture = new pImage($width,$height,$MyData);
/* Turn of Antialiasing */
$myPicture->Antialias = $antialiasing;
/* Add a border to the picture */
//$myPicture->drawRectangle(0,0,$width,$height,array("R"=>0,"G"=>0,"B"=>0));
/* Turn on shadow computing */
$myPicture->setShadow(TRUE,array("X"=>1,"Y"=>1,"R"=>0,"G"=>0,"B"=>0,"Alpha"=>10));
/* Set the default font */
$myPicture->setFontProperties(array("FontName"=>$font,"FontSize"=>$font_size));
/* Draw the scale */
// TODO: AvoidTickWhenEmpty = FALSE When the distance between two ticks will be less than 50 px
// TODO: AvoidTickWhenEmpty = TRUE When the distance between two ticks will be greater than 50 px
//Calculate the top margin from the size of string in each index
$max_chars = graph_get_max_index($index);
$margin_top = 10 * $max_chars;
/* Create the pChart object */
$myPicture = new pImage($width,$height,$MyData);
switch($graph_type) {
/* Turn of Antialiasing */
$myPicture->Antialias = $antialiasing;
/* Add a border to the picture */
//$myPicture->drawRectangle(0,0,$width,$height,array("R"=>0,"G"=>0,"B"=>0));
/* Turn on shadow computing */
$myPicture->setShadow(TRUE,array("X"=>1,"Y"=>1,"R"=>0,"G"=>0,"B"=>0,"Alpha"=>10));
/* Set the default font */
$myPicture->setFontProperties(array("FontName"=>$font,"FontSize"=>$font_size));
/* Draw the scale */
// TODO: AvoidTickWhenEmpty = FALSE When the distance between two ticks will be less than 50 px
// TODO: AvoidTickWhenEmpty = TRUE When the distance between two ticks will be greater than 50 px
//Calculate the top margin from the size of string in each index
$max_chars = graph_get_max_index($index);
$margin_top = 10 * $max_chars;
switch($graph_type) {
case "vbar":
$scaleSettings = array("AvoidTickWhenEmpty" => FALSE, "AvoidGridWhenEmpty" => FALSE,
"GridR"=>200,"GridG"=>200,"GridB"=>200,"DrawSubTicks"=>TRUE,"CycleBackground"=>TRUE,
@ -554,55 +554,55 @@ function pch_bar_graph ($graph_type, $index, $data, $width, $height, $font,
$margin_top = 40;
$margin_bottom = 10;
break;
}
$water_mark_height = 0;
$water_mark_width = 0;
if (!empty($water_mark)) {
}
$water_mark_height = 0;
$water_mark_width = 0;
if (!empty($water_mark)) {
$size_water_mark = getimagesize($water_mark);
$water_mark_height = $size_water_mark[1];
$water_mark_width = $size_water_mark[0];
$myPicture->drawFromPNG(($width - $water_mark_width),
($height - $water_mark_height) - $margin_bottom, $water_mark);
}
/* Define the chart area */
$myPicture->setGraphArea($margin_left,$margin_top,$width - $water_mark_width,$height-$margin_bottom);
($height - $water_mark_height) - $margin_bottom, $water_mark);
}
/* Define the chart area */
$myPicture->setGraphArea($margin_left,$margin_top,$width - $water_mark_width,$height-$margin_bottom);
$myPicture->drawScale($scaleSettings);
$myPicture->drawScale($scaleSettings);
if(isset($legend)) {
if(isset($legend)) {
/* Write the chart legend */
$size = $myPicture->getLegendSize(array("Style"=>LEGEND_NOBORDER,"Mode"=>LEGEND_HORIZONTAL));
$myPicture->drawLegend($width-$size['Width'],0,array("Style"=>LEGEND_NOBORDER,"Mode"=>LEGEND_HORIZONTAL, "BoxWidth"=>10, "BoxHeight"=>10));
}
/* Turn on shadow computing */
$myPicture->setShadow(TRUE,array("X"=>0,"Y"=>1,"R"=>0,"G"=>0,"B"=>0,"Alpha"=>10));
}
/* Turn on shadow computing */
$myPicture->setShadow(TRUE,array("X"=>0,"Y"=>1,"R"=>0,"G"=>0,"B"=>0,"Alpha"=>10));
/* Draw the chart */
$settings = array("ForceTransparency"=>"-1", "Gradient"=>TRUE,"GradientMode"=>GRADIENT_EFFECT_CAN,"DisplayValues"=>$show_values,"DisplayZeroValues"=>FALSE,"DisplayR"=>100,"DisplayG"=>100,"DisplayB"=>100,"DisplayShadow"=>TRUE,"Surrounding"=>5,"AroundZero"=>FALSE, "OverrideColors"=>$overridePalette);
$myPicture->drawBarChart($settings);
/* Draw the chart */
$settings = array("ForceTransparency"=>"-1", "Gradient"=>TRUE,"GradientMode"=>GRADIENT_EFFECT_CAN,"DisplayValues"=>$show_values,"DisplayZeroValues"=>FALSE,"DisplayR"=>100,"DisplayG"=>100,"DisplayB"=>100,"DisplayShadow"=>TRUE,"Surrounding"=>5,"AroundZero"=>FALSE, "OverrideColors"=>$overridePalette);
$myPicture->drawBarChart($settings);
/* Render the picture */
$myPicture->stroke();
/* Render the picture */
$myPicture->stroke();
}
function pch_vertical_graph ($graph_type, $index, $data, $width, $height,
$rgb_color = false, $xaxisname = "", $yaxisname = "", $show_values = false,
$legend = array(), $font, $antialiasing, $water_mark = '', $font_size) {
/* CAT:Vertical Charts */
if(!is_array($legend) || empty($legend)) {
if (!is_array($legend) || empty($legend)) {
unset($legend);
}
/*$legend=array('pep1' => 'pep1','pep2' => 'pep2','pep3' => 'pep3','pep4' => 'pep4');
$data=array(array('pep1' => 1, 'pep2' => 1, 'pep3' => 3, 'pep4' => 3), array('pep1' => 1, 'pep2' => 3, 'pep3' => 1,'pep4' => 4), array('pep1' => 3, 'pep2' => 1, 'pep3' => 1,'pep4' =>1), array('pep1' => 1, 'pep2' =>1, 'pep3' =>1,'pep4' =>0));
$index=array(1,2,3,4);
*/
if(is_array(reset($data))) {
$data2 = array();
/*$legend=array('pep1' => 'pep1','pep2' => 'pep2','pep3' => 'pep3','pep4' => 'pep4');
$data=array(array('pep1' => 1, 'pep2' => 1, 'pep3' => 3, 'pep4' => 3), array('pep1' => 1, 'pep2' => 3, 'pep3' => 1,'pep4' => 4), array('pep1' => 3, 'pep2' => 1, 'pep3' => 1,'pep4' =>1), array('pep1' => 1, 'pep2' =>1, 'pep3' =>1,'pep4' =>0));
$index=array(1,2,3,4);
*/
if (is_array(reset($data))) {
$data2 = array();
foreach($data as $i =>$values) {
$c = 0;
foreach($values as $i2 => $value) {
@ -611,22 +611,22 @@ function pch_vertical_graph ($graph_type, $index, $data, $width, $height,
}
}
$data = $data2;
}
else {
}
else {
$data = array($data);
}
/* Create and populate the pData object */
$MyData = new pData();
}
foreach($data as $i => $values) {
if(isset($legend)) {
/* Create and populate the pData object */
$MyData = new pData();
foreach ($data as $i => $values) {
if (isset($legend)) {
$point_id = $legend[$i];
}
else {
}
else {
$point_id = $i;
}
}
$MyData->addPoints($values,$point_id);
if (!empty($rgb_color)) {
$MyData->setPalette($point_id,
@ -644,7 +644,7 @@ function pch_vertical_graph ($graph_type, $index, $data, $width, $height,
$palette_color["G"] = $rgb_color[$i]['color']["G"];
$palette_color["B"] = $rgb_color[$i]['color']["B"];
}
if (isset($rgb_color[$i]['color'])) {
if (isset($rgb_color[$i]['color'])) {
$palette_color["BorderR"] = $rgb_color[$i]['border']["R"];
$palette_color["BorderG"] = $rgb_color[$i]['border']["G"];
$palette_color["BorderB"] = $rgb_color[$i]['border']["B"];
@ -652,30 +652,30 @@ function pch_vertical_graph ($graph_type, $index, $data, $width, $height,
if (isset($rgb_color[$i]['color'])) {
$palette_color["Alpha"] = $rgb_color[$i]['Alpha'];
}
$MyData->setPalette($point_id, $palette_color);*/
}
}
$MyData->setSerieWeight($point_id, 0);
}
}
//$MyData->addPoints($data,"Yaxis");
$MyData->setAxisName(0,$yaxisname);
$MyData->addPoints($index,"Xaxis");
$MyData->setSerieDescription("Xaxis", $xaxisname);
$MyData->setAbscissa("Xaxis");
//$MyData->addPoints($data,"Yaxis");
$MyData->setAxisName(0,$yaxisname);
$MyData->addPoints($index,"Xaxis");
$MyData->setSerieDescription("Xaxis", $xaxisname);
$MyData->setAbscissa("Xaxis");
/* Create the pChart object */
$myPicture = new pImage($width,$height,$MyData);
/* Create the pChart object */
$myPicture = new pImage($width,$height,$MyData);
/* Turn of Antialiasing */
$myPicture->Antialias = $antialiasing;
/* Turn of Antialiasing */
$myPicture->Antialias = $antialiasing;
/* Add a border to the picture */
//$myPicture->drawRectangle(0,0,$width,$height,array("R"=>0,"G"=>0,"B"=>0));
/* Add a border to the picture */
//$myPicture->drawRectangle(0,0,$width,$height,array("R"=>0,"G"=>0,"B"=>0));
/* Set the default font */
$myPicture->setFontProperties(array("FontName"=>$font, "FontSize"=>$font_size));
/* Set the default font */
$myPicture->setFontProperties(array("FontName"=>$font, "FontSize"=>$font_size));
if(isset($legend)) {
/* Set horizontal legend if is posible */
@ -688,167 +688,167 @@ function pch_vertical_graph ($graph_type, $index, $data, $width, $height,
/* Write the chart legend */
$myPicture->drawLegend($width-$size['Width'], 8,array("Style"=>LEGEND_NOBORDER,"Mode"=>$legend_mode));
}
//Calculate the bottom margin from the size of string in each index
$max_chars = graph_get_max_index($index);
$margin_bottom = $font_size * $max_chars;
$water_mark_height = 0;
$water_mark_width = 0;
if (!empty($water_mark)) {
}
//Calculate the bottom margin from the size of string in each index
$max_chars = graph_get_max_index($index);
$margin_bottom = $font_size * $max_chars;
$water_mark_height = 0;
$water_mark_width = 0;
if (!empty($water_mark)) {
$size_water_mark = getimagesize($water_mark);
$water_mark_height = $size_water_mark[1];
$water_mark_width = $size_water_mark[0];
$myPicture->drawFromPNG(($width - $water_mark_width),
($height - $water_mark_height) - $margin_bottom, $water_mark);
}
($height - $water_mark_height) - $margin_bottom, $water_mark);
}
// Get the max number of scale
$max_all = 0;
// Get the max number of scale
$max_all = 0;
$serie_ne_zero = false;
foreach($data as $serie) {
$max_this_serie = max($serie);
if($max_this_serie > $max_all) {
$serie_ne_zero = false;
foreach($data as $serie) {
$max_this_serie = max($serie);
if($max_this_serie > $max_all) {
$max_all = $max_this_serie;
}
// Detect if all serie is equal to zero or not
if ($serie != 0)
}
// Detect if all serie is equal to zero or not
if ($serie != 0)
$serie_ne_zero = true;
}
// Get the number of digits of the scale
$digits_left = 0;
while($max_all > 1) {
}
// Get the number of digits of the scale
$digits_left = 0;
while($max_all > 1) {
$digits_left ++;
$max_all /= 10;
}
// If the number is less than 1 we count the decimals
// Also check if the serie is not all equal to zero (!$serie_ne_zero)
if($digits_left == 0 and !$serie_ne_zero) {
}
// If the number is less than 1 we count the decimals
// Also check if the serie is not all equal to zero (!$serie_ne_zero)
if($digits_left == 0 and !$serie_ne_zero) {
while($max_all < 1) {
$digits_left ++;
$max_all *= 10;
}
}
$chart_size = ($digits_left * $font_size) + 20;
}
$chart_size = ($digits_left * $font_size) + 20;
/* Area depends on yaxisname */
if ($yaxisname != ''){
$chart_size += 40;
}
else{
$chart_size = 40;
}
if (isset($size['Height'])) {
/* Define the chart area */
//if ($yaxisname != ''){
//}
$myPicture->setGraphArea($chart_size,$size['Height'],$width - $water_mark_width,$height - $margin_bottom);
}
else {
/* Define the chart area */
$myPicture->setGraphArea($chart_size, 5,$width - $water_mark_width,$height - $margin_bottom);
}
}
/*Get minimun value to draw axis properly*/
$min_data = min(min($data));
$mode = SCALE_MODE_START0;
if ($min_data < 0) {
if (isset($size['Height'])) {
/* Define the chart area */
//if ($yaxisname != ''){
//}
$myPicture->setGraphArea($chart_size,$size['Height'],$width - $water_mark_width,$height - $margin_bottom);
}
else {
/* Define the chart area */
$myPicture->setGraphArea($chart_size, 5,$width - $water_mark_width,$height - $margin_bottom);
}
/*Get minimun value to draw axis properly*/
$min_data = min(min($data));
$mode = SCALE_MODE_START0;
if ($min_data < 0) {
$mode = SCALE_MODE_FLOATING;
}
/* Draw the scale */
$scaleSettings = array("GridR"=>200,
"GridG"=>200,
"GridB"=>200,
"DrawSubTicks"=>TRUE,
"CycleBackground"=>TRUE,
"Mode" => $mode,
"LabelRotation" => 40,
"XMargin" => 0,
"MinDivHeight" => 20,
"TicksFontSize" => $font_size - 1);
$myPicture->drawScale($scaleSettings);
/* Turn on shadow computing */
//$myPicture->setShadow(TRUE,array("X"=>0,"Y"=>1,"R"=>0,"G"=>0,"B"=>0,"Alpha"=>10));
switch ($graph_type) {
case 'stacked_area':
$ForceTransparency = "-1";
break;
default:
$ForceTransparency = "50";
break;
}
/* Draw the chart */
$settings = array("ForceTransparency"=> $ForceTransparency, //
"Gradient"=>TRUE,
"GradientMode"=>GRADIENT_EFFECT_CAN,
"DisplayValues"=>$show_values,
"DisplayZeroValues"=>FALSE,
"DisplayR"=>100,
"DisplayZeros"=> FALSE,
"DisplayG"=>100,"DisplayB"=>100,"DisplayShadow"=>TRUE,"Surrounding"=>5,"AroundZero"=>TRUE);
}
/* Draw the scale */
$scaleSettings = array("GridR"=>200,
"GridG"=>200,
"GridB"=>200,
"DrawSubTicks"=>TRUE,
"CycleBackground"=>TRUE,
"Mode" => $mode,
"LabelRotation" => 40,
"XMargin" => 0,
"MinDivHeight" => 20,
"TicksFontSize" => $font_size - 1);
$myPicture->drawScale($scaleSettings);
/* Turn on shadow computing */
//$myPicture->setShadow(TRUE,array("X"=>0,"Y"=>1,"R"=>0,"G"=>0,"B"=>0,"Alpha"=>10));
switch ($graph_type) {
case 'stacked_area':
$ForceTransparency = "-1";
break;
default:
$ForceTransparency = "50";
break;
}
/* Draw the chart */
$settings = array("ForceTransparency"=> $ForceTransparency, //
"Gradient"=>TRUE,
"GradientMode"=>GRADIENT_EFFECT_CAN,
"DisplayValues"=>$show_values,
"DisplayZeroValues"=>FALSE,
"DisplayR"=>100,
"DisplayZeros"=> FALSE,
"DisplayG"=>100,"DisplayB"=>100,"DisplayShadow"=>TRUE,"Surrounding"=>5,"AroundZero"=>TRUE);
switch($graph_type) {
case "stacked_area":
switch($graph_type) {
case "stacked_area":
case "area":
$myPicture->drawAreaChart($settings);
break;
$myPicture->drawAreaChart($settings);
break;
case "line":
$myPicture->drawLineChart($settings);
break;
}
/* Render the picture */
$myPicture->stroke();
$myPicture->drawLineChart($settings);
break;
}
/* Render the picture */
$myPicture->stroke();
}
function pch_threshold_graph ($graph_type, $index, $data, $width, $height, $font,
$antialiasing, $xaxisname = "", $yaxisname = "", $title = "",
$show_values = false, $show_legend = false, $font_size) {
/* CAT:Threshold Chart */
/* CAT:Threshold Chart */
/* Create and populate the pData object */
$MyData = new pData();
$MyData->addPoints($data,"DEFCA");
$MyData->setAxisName(0,$yaxisname);
$MyData->setAxisDisplay(0,AXIS_FORMAT_CURRENCY);
$MyData->addPoints($index,"Labels");
$MyData->setSerieDescription("Labels",$xaxisname);
$MyData->setAbscissa("Labels");
$MyData->setPalette("DEFCA",array("R"=>55,"G"=>91,"B"=>127));
/* Create the pChart object */
$myPicture = new pImage(700,230,$MyData);
$myPicture->drawGradientArea(0,0,700,230,DIRECTION_VERTICAL,array("StartR"=>220,"StartG"=>220,"StartB"=>220,"EndR"=>255,"EndG"=>255,"EndB"=>255,"Alpha"=>100));
$myPicture->drawRectangle(0,0,699,229,array("R"=>200,"G"=>200,"B"=>200));
/* Write the picture title */
$myPicture->setFontProperties(array("FontName"=>$font,"FontSize"=>$font_size));
$myPicture->drawText(60,35,$title,array("FontSize"=>$font_size,"Align"=>TEXT_ALIGN_BOTTOMLEFT));
/* Do some cosmetic and draw the chart */
$myPicture->setGraphArea(60,40,670,190);
$myPicture->drawFilledRectangle(60,40,670,190,array("R"=>255,"G"=>255,"B"=>255,"Surrounding"=>-200,"Alpha"=>10));
$myPicture->drawScale(array("GridR"=>180,"GridG"=>180,"GridB"=>180, "Mode" => SCALE_MODE_START0));
$myPicture->setShadow(TRUE,array("X"=>2,"Y"=>2,"R"=>0,"G"=>0,"B"=>0,"Alpha"=>10));
$myPicture->setFontProperties(array("FontName"=>$font,"FontSize"=>$font_size));
$settings = array("Gradient"=>TRUE,"GradientMode"=>GRADIENT_EFFECT_CAN,"DisplayValues"=>$show_values,"DisplayZeroValues"=>FALSE,"DisplayR"=>100,"DisplayG"=>100,"DisplayB"=>100,"DisplayShadow"=>TRUE,"Surrounding"=>5,"AroundZero"=>FALSE);
$myPicture->drawSplineChart($settings);
$myPicture->setShadow(FALSE);
if($show_legend) {
$MyData = new pData();
$MyData->addPoints($data,"DEFCA");
$MyData->setAxisName(0,$yaxisname);
$MyData->setAxisDisplay(0,AXIS_FORMAT_CURRENCY);
$MyData->addPoints($index,"Labels");
$MyData->setSerieDescription("Labels",$xaxisname);
$MyData->setAbscissa("Labels");
$MyData->setPalette("DEFCA",array("R"=>55,"G"=>91,"B"=>127));
/* Create the pChart object */
$myPicture = new pImage(700,230,$MyData);
$myPicture->drawGradientArea(0,0,700,230,DIRECTION_VERTICAL,array("StartR"=>220,"StartG"=>220,"StartB"=>220,"EndR"=>255,"EndG"=>255,"EndB"=>255,"Alpha"=>100));
$myPicture->drawRectangle(0,0,699,229,array("R"=>200,"G"=>200,"B"=>200));
/* Write the picture title */
$myPicture->setFontProperties(array("FontName"=>$font,"FontSize"=>$font_size));
$myPicture->drawText(60,35,$title,array("FontSize"=>$font_size,"Align"=>TEXT_ALIGN_BOTTOMLEFT));
/* Do some cosmetic and draw the chart */
$myPicture->setGraphArea(60,40,670,190);
$myPicture->drawFilledRectangle(60,40,670,190,array("R"=>255,"G"=>255,"B"=>255,"Surrounding"=>-200,"Alpha"=>10));
$myPicture->drawScale(array("GridR"=>180,"GridG"=>180,"GridB"=>180, "Mode" => SCALE_MODE_START0));
$myPicture->setShadow(TRUE,array("X"=>2,"Y"=>2,"R"=>0,"G"=>0,"B"=>0,"Alpha"=>10));
$myPicture->setFontProperties(array("FontName"=>$font,"FontSize"=>$font_size));
$settings = array("Gradient"=>TRUE,"GradientMode"=>GRADIENT_EFFECT_CAN,"DisplayValues"=>$show_values,"DisplayZeroValues"=>FALSE,"DisplayR"=>100,"DisplayG"=>100,"DisplayB"=>100,"DisplayShadow"=>TRUE,"Surrounding"=>5,"AroundZero"=>FALSE);
$myPicture->drawSplineChart($settings);
$myPicture->setShadow(FALSE);
if($show_legend) {
/* Write the chart legend */
$myPicture->drawLegend(643,210,array("Style"=>LEGEND_NOBORDER,"Mode"=>LEGEND_HORIZONTAL));
}

View File

@ -3,11 +3,11 @@
* @package Include/help/en
*/
?>
<p class="para">
The format of the outputted date string. See the formatting
options below.
</p>
<p class="para">
<p class="para">
The format of the outputted date string. See the formatting
options below.
</p>
<p class="para">
</p><table border="5">
<caption><b>The following characters are recognized in the

View File

@ -23,7 +23,7 @@ class System {
private $db;
function __construct() {
$this->loadConfig();
$this->loadConfig();
$this->db = new DB($this, $this->getConfig('db_engine', 'mysql'));
session_start();

View File

@ -108,7 +108,7 @@ class EventsView {
if ($search != "")
$sqlFreeSearch .= " AND evento LIKE '%".$search."%'";
$unixtime = get_system_time () - ($event_view_hr * 3600); //Put hours in seconds
$unixtime = get_system_time () - ($event_view_hr * SECONDS_1HOUR); //Put hours in seconds
$sqlTimestamp = " AND utimestamp > ".$unixtime;
$sql = 'SELECT *

View File

@ -77,7 +77,7 @@ $event_view_hr = (int) get_parameter ("event_view_hr", 0);
$sql_post = "";
if ($event_view_hr > 0) {
$unixtime = (int) (get_system_time () - ($event_view_hr * 3600)); //Put hours in seconds
$unixtime = (int) (get_system_time () - ($event_view_hr * SECONDS_1HOUR)); //Put hours in seconds
$sql_post .= " AND tevento.utimestamp > ".$unixtime;
}
if ($ev_group > 1)
@ -95,7 +95,7 @@ switch($status) {
break;
}
if ($search != "")
$sql_post .= " AND tevento.evento LIKE '%$search%'";
if ($event_type != "") {
@ -117,7 +117,7 @@ if ($severity != -1)
if ($id_agent == -2) {
$text_agent = (string) get_parameter("text_agent", __("All"));
switch ($text_agent)
{
case __('All'):

View File

@ -113,17 +113,17 @@ if ($id_event != -1)
$timestamp_filter = '';
if ($event_view_hr > 0) {
$unixtime = get_system_time () - ($event_view_hr * 3600); //Put hours in seconds
$unixtime = get_system_time () - ($event_view_hr * SECONDS_1HOUR); //Put hours in seconds
$timestamp_filter = " AND (utimestamp > $unixtime OR estado = 2)";
}
if ($id_user_ack != "0")
$filter['id_usuario'] = $id_user_ack;
//Search by tag
if ($tag != "") {
$filter['tags'] = "%".io_safe_input($tag)."%";
}
}
//$filter['order'] = 'timestamp DESC';
$now = date ("Y-m-d");
@ -150,7 +150,7 @@ $new = true;
while ($event = db_get_all_row_by_steps_sql($new, $result, $sql)) {
$new = false;
if (!check_acl($config["id_user"], $event["id_grupo"], "AR") ||
(!check_acl($config["id_user"], 0, "PM") && $event["event_type"] == 'system'))
(!check_acl($config["id_user"], 0, "PM") && $event["event_type"] == 'system'))
continue;
echo $event["timestamp"];