2014-05-07 Miguel de Dios <miguel.dedios@artica.es>

* include/functions_ui.php, include/functions_networkmap.php: clean
	source code style.
	
	* include/functions_modules.php: added function
	"modules_get_interfaces".




git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@9881 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
mdtrooper 2014-05-07 17:15:48 +00:00
parent e10a9432cd
commit a0dd4b2222
4 changed files with 56 additions and 6 deletions

View File

@ -1,3 +1,11 @@
2014-05-07 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_ui.php, include/functions_networkmap.php: clean
source code style.
* include/functions_modules.php: added function
"modules_get_interfaces".
2014-05-07 Juan Manuel Ramon <juanmanuel.ramon@artica.es> 2014-05-07 Juan Manuel Ramon <juanmanuel.ramon@artica.es>
* pandoradb_data.sql * pandoradb_data.sql

View File

@ -961,6 +961,40 @@ function modules_get_unit ($id_agente_modulo) {
return $unit = (string) db_get_value ('unit', 'tagente_modulo', 'id_agente_modulo', (int) $id_agente_modulo); return $unit = (string) db_get_value ('unit', 'tagente_modulo', 'id_agente_modulo', (int) $id_agente_modulo);
} }
function modules_get_interfaces($id_agent, $fields_param = false) {
$return = array();
$fields = $fields_param;
if ($fields !== false) {
if (is_array($fields)) {
$fields[] = 'id_tipo_modulo';
}
}
$modules = db_get_all_rows_filter('tagente_modulo',
array('id_agente' => $id_agent), $fields);
if (empty($modules))
$modules = array();
foreach ($modules as $module) {
if ($module['id_tipo_modulo'] == 18 || $module['id_tipo_modulo'] == 6) {
if ($fields_param !== false) {
if (is_array($fields_param)) {
if (in_array('id_tipo_modulo', $fields) !== false) {
unset($module['id_tipo_modulo']);
}
}
}
$return[] = $module;
}
}
return $return;
}
/** /**
* Get all the times a monitor went down during a period. * Get all the times a monitor went down during a period.
* *

View File

@ -261,7 +261,9 @@ function networkmap_generate_dot ($pandora_name, $group = 0,
$filter['id_grupo'] = $group; $filter['id_grupo'] = $group;
$agents = agents_get_agents ($filter, $agents = agents_get_agents ($filter,
array ('id_grupo, nombre, id_os, id_parent, id_agente, normal_count, warning_count, critical_count, unknown_count, total_count, notinit_count')); array ('id_grupo, nombre, id_os, id_parent, id_agente,
normal_count, warning_count, critical_count,
unknown_count, total_count, notinit_count'));
} }
else if ($group == -666) { else if ($group == -666) {
$agents = false; $agents = false;
@ -269,7 +271,8 @@ function networkmap_generate_dot ($pandora_name, $group = 0,
else { else {
$agents = agents_get_agents ($filter, $agents = agents_get_agents ($filter,
array ('id_grupo, nombre, id_os, id_parent, id_agente, array ('id_grupo, nombre, id_os, id_parent, id_agente,
normal_count, warning_count, critical_count, unknown_count, total_count, notinit_count')); normal_count, warning_count, critical_count,
unknown_count, total_count, notinit_count'));
} }
if ($agents === false) if ($agents === false)
@ -277,7 +280,8 @@ function networkmap_generate_dot ($pandora_name, $group = 0,
$agents = array(); $agents = array();
// Open Graph // Open Graph
$graph = networkmap_open_graph ($layout, $nooverlap, $pure, $zoom, $ranksep, $font_size); $graph = networkmap_open_graph ($layout, $nooverlap, $pure, $zoom,
$ranksep, $font_size);
// Parse agents // Parse agents
$nodes = array (); $nodes = array ();
@ -321,7 +325,8 @@ function networkmap_generate_dot ($pandora_name, $group = 0,
// Parse modules // Parse modules
foreach ($modules as $key => $module) { foreach ($modules as $key => $module) {
if ($module['id_tipo_modulo'] != 18 && (!$l2_network || $module['id_tipo_modulo'] != 6)) { if ($module['id_tipo_modulo'] != 18 &&
(!$l2_network || $module['id_tipo_modulo'] != 6)) {
continue; continue;
} }

View File

@ -1039,13 +1039,16 @@ function ui_print_help_icon ($help_id, $return = false, $home_url = '', $image =
function ui_require_css_file ($name, $path = 'include/styles/') { function ui_require_css_file ($name, $path = 'include/styles/') {
global $config; global $config;
$filename = $path.$name.'.css'; $filename = $path . $name . '.css';
if (! isset ($config['css'])) if (! isset ($config['css']))
$config['css'] = array (); $config['css'] = array ();
if (isset ($config['css'][$name])) if (isset ($config['css'][$name]))
return true; return true;
if (! file_exists ($filename) && ! file_exists ($config['homedir'].'/'.$filename))
if (! file_exists ($filename) &&
! file_exists ($config['homedir'] . '/' . $filename))
return false; return false;
$config['css'][$name] = $filename; $config['css'][$name] = $filename;