2012-09-04 Miguel de Dios <miguel.dedios@artica.es>

* godmode/reporting/graph_builder.php,
	include/functions_modules.php, operation/agentes/ver_agente.php:
	cleaned source code style.
	
	* include/functions_html.php: fixed the function "html_print_select"
	when pass the selected as array
	(for example in multiple select box).
	
	* godmode/reporting/reporting_builder.item_editor.php,
	include/functions_reports.php: into the function "get_report_name"
	added parameter $template to get type for content template. And the
	function "get_report_types" renamed for "reports_get_report_types"
	and added the same parameter $template.




git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6931 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
mdtrooper 2012-09-04 14:04:46 +00:00
parent 8d220286b9
commit 9bea1609e1
7 changed files with 95 additions and 44 deletions

View File

@ -1,3 +1,19 @@
2012-09-04 Miguel de Dios <miguel.dedios@artica.es>
* godmode/reporting/graph_builder.php,
include/functions_modules.php, operation/agentes/ver_agente.php:
cleaned source code style.
* include/functions_html.php: fixed the function "html_print_select"
when pass the selected as array
(for example in multiple select box).
* godmode/reporting/reporting_builder.item_editor.php,
include/functions_reports.php: into the function "get_report_name"
added parameter $template to get type for content template. And the
function "get_report_types" renamed for "reports_get_report_types"
and added the same parameter $template.
2012-08-31 Sergio Martin <sergio.martin@artica.es> 2012-08-31 Sergio Martin <sergio.martin@artica.es>
* include/functions_graph.php * include/functions_graph.php

View File

@ -74,9 +74,16 @@ if ($add_graph) {
$period = get_parameter_post ("period"); $period = get_parameter_post ("period");
// Create graph // Create graph
$values = array( 'id_user' => $config['id_user'], 'name' => $name, 'description' => $description, $values = array(
'period' => $period, 'width' => $width, 'height' => $height, 'id_user' => $config['id_user'],
'private' => 0, 'id_group' => $idGroup, 'events' => $events, 'name' => $name,
'description' => $description,
'period' => $period,
'width' => $width,
'height' => $height,
'private' => 0,
'id_group' => $idGroup,
'events' => $events,
'stacked' => $stacked); 'stacked' => $stacked);
if (trim($name) != "") { if (trim($name) != "") {

View File

@ -361,10 +361,10 @@ html_print_input_hidden('id_item', $idItem);
<td style=""> <td style="">
<?php <?php
if ($action == 'new') { if ($action == 'new') {
html_print_select(get_report_types(), 'type', $type, 'chooseType();', '', ''); html_print_select(reports_get_report_types(), 'type', $type, 'chooseType();', '', '');
} }
else { else {
echo get_report_name($type); echo reports_get_report_types($type);
echo '<input type="hidden" id="type" name="type" value="' . $type . '" />'; echo '<input type="hidden" id="type" name="type" value="' . $type . '" />';
} }
?> ?>

View File

@ -293,9 +293,15 @@ function html_print_select ($fields, $name, $selected = '', $script = '',
$nothing = __('None'); $nothing = __('None');
} }
$output .= '<option value="'.$nothing_value.'"'; $output .= '<option value="'.$nothing_value.'"';
if ($nothing_value == $selected) { if ($nothing_value == $selected) {
$output .= ' selected="selected"'; $output .= ' selected="selected"';
} }
else if (is_array ($selected)) {
if (in_array ($nothing_value, $selected)) {
$output .= ' selected="selected"';
}
}
$output .= '>'.$nothing.'</option>'; $output .= '>'.$nothing.'</option>';
} }

View File

@ -538,7 +538,17 @@ function modules_get_agentmodule ($id_agentmodule) {
$fields_[] = $field['column_name']; $fields_[] = $field['column_name'];
} }
$fields = implode(',', $fields_); $fields = implode(',', $fields_);
$result = db_process_sql("SELECT TO_NUMBER(MAX_CRITICAL) as max_critical, TO_NUMBER(MIN_CRITICAL) as min_critical, TO_NUMBER(MAX_WARNING) as max_warning, TO_NUMBER(MIN_WARNING) as min_warning, TO_NUMBER(POST_PROCESS) as post_process, " . $fields . " FROM tagente_modulo WHERE id_agente_modulo = " . $id_agentmodule);
$result = db_process_sql("
SELECT TO_NUMBER(MAX_CRITICAL) as max_critical,
TO_NUMBER(MIN_CRITICAL) as min_critical,
TO_NUMBER(MAX_WARNING) as max_warning,
TO_NUMBER(MIN_WARNING) as min_warning,
TO_NUMBER(POST_PROCESS) as post_process,
" . $fields . "
FROM tagente_modulo
WHERE id_agente_modulo = " . $id_agentmodule);
return $result[0]; return $result[0];
break; break;
} }
@ -565,7 +575,10 @@ function modules_get_agentmodule_id ($agentmodule_name, $agent_id) {
* @return bool true if is init and false if is not init * @return bool true if is init and false if is not init
*/ */
function modules_get_agentmodule_is_init ($id_agentmodule) { function modules_get_agentmodule_is_init ($id_agentmodule) {
$result = db_get_row_filter ('tagente_estado', array('id_agente_modulo' => $id_agentmodule), 'utimestamp'); $result = db_get_row_filter ('tagente_estado',
array('id_agente_modulo' => $id_agentmodule),
'utimestamp');
return (bool)$result['utimestamp']; return (bool)$result['utimestamp'];
} }
@ -589,7 +602,8 @@ function modules_get_agent_modules_count ($id_agent = 0) {
$filter = sprintf (" WHERE id_agente IN (%s)", implode (",", (array) $id_agent)); $filter = sprintf (" WHERE id_agente IN (%s)", implode (",", (array) $id_agent));
} }
return (int) db_get_sql ("SELECT COUNT(*) FROM tagente_modulo" . $filter); return (int) db_get_sql ("SELECT COUNT(*)
FROM tagente_modulo" . $filter);
} }
/** /**

View File

@ -411,11 +411,12 @@ function reports_delete_content ($id_report_content) {
* Get report type name from type id. * Get report type name from type id.
* *
* @param int $type Type id of the report. * @param int $type Type id of the report.
* @param boolean $template Set true for to get types for templates. By default false.
* *
* @return string Report type name. * @return string Report type name.
*/ */
function get_report_name ($type) { function get_report_name ($type, $template = false) {
$types = get_report_types (); $types = reports_get_report_types ($template);
if (! isset ($types[$type])) if (! isset ($types[$type]))
return __('Unknown'); return __('Unknown');
@ -475,9 +476,11 @@ function get_report_type_data_source ($type) {
/** /**
* Get report types in an array. * Get report types in an array.
* *
* @param boolean $template Set true for to get types for templates. By default false.
*
* @return array An array with all the possible reports in Pandora where the array index is the report id. * @return array An array with all the possible reports in Pandora where the array index is the report id.
*/ */
function get_report_types () { function reports_get_report_types ($template = false) {
global $config; global $config;
$types = array (); $types = array ();
@ -497,6 +500,10 @@ function get_report_types () {
$types['sql_graph_hbar'] = array('optgroup' => __('Graphs'), $types['sql_graph_hbar'] = array('optgroup' => __('Graphs'),
'name' => __('SQL horizonal bar graph')); 'name' => __('SQL horizonal bar graph'));
} }
if ($template) {
$types['automatic_graph'] = array('optgroup' => __('Graphs'),
'name' => __('Automatic combined Graph'));
}

View File

@ -306,6 +306,7 @@ if (is_ajax ()) {
//$agent_modules['any_text'] = __('Any'); //$agent_modules['any_text'] = __('Any');
echo json_encode ($agent_modules); echo json_encode ($agent_modules);
return; return;
} }