2008-07-17 Esteban Sanchez <estebans@artica.es>

* godmode/reporting/reporting_builder.php,
        godmode/reporting/map_builder.php: Check if all_agents were set to 
        avoid warning on foreach.

        * include/functions_db.php: Fixed typo in return_status_layout().
        Return false on get_db_all_rows_sql().

        * include/functions_visual_map.php: Check layouts_data to avoid
        warning on foreach. Removed ugly comments.



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@958 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
Esteban Sanchez 2008-07-17 07:38:02 +00:00
parent 34797317a3
commit 081ca73ba7
5 changed files with 31 additions and 11 deletions

View File

@ -1,3 +1,15 @@
2008-07-17 Esteban Sanchez <estebans@artica.es>
* godmode/reporting/reporting_builder.php,
godmode/reporting/map_builder.php: Check if all_agents were set to
avoid warning on foreach.
* include/functions_db.php: Fixed typo in return_status_layout().
Return false on get_db_all_rows_sql().
* include/functions_visual_map.php: Check layouts_data to avoid
warning on foreach. Removed ugly comments.
2008-07-17 Esteban Sanchez <estebans@artica.es>
* include/functions_db.php: Removed debug output to check use of

View File

@ -371,10 +371,12 @@ if (! $edit_layout && ! $id_layout) {
$all_agents = get_agents_in_group ($id_group);
$agents = array ();
foreach ($all_agents as $agent) {
$agents[$agent['id_agente']] = strtolower($agent['nombre']);
if ($all_agents !== false) {
foreach ($all_agents as $agent) {
$agents[$agent['id_agente']] = strtolower($agent['nombre']);
}
asort($agents);
}
asort($agents);
echo '<div id="layout_editor_drop">';
echo '<h1>'.lang_string ('Map element editor').'</h1>';

View File

@ -192,10 +192,12 @@ if ($id_report) {
$all_agents = get_agents_in_group ($report_id_group);
$agents = array ();
foreach ($all_agents as $agent) {
$agents[$agent['id_agente']] = strtolower($agent['nombre']);
if ($all_agents !== false) {
foreach ($all_agents as $agent) {
$agents[$agent['id_agente']] = strtolower($agent['nombre']);
}
asort ($agents);
}
asort ($agents);
if ($edit_sla_report_content) {
/* Edit SLA report form */

View File

@ -198,7 +198,7 @@ function get_agents_in_group ($id_group, $disabled = false) {
} elseif ($disabled && $id_group != 1) {
return get_db_all_rows_field_filter ('tagente', 'id_grupo', (int) $id_group, 'nombre');
} else {
$sql = sprintf ("SELECT * FROM `tagente` WHERE `id_grupo` = '%d' AND `disabled` = '0' ORDER BY `nombre`",$id_group);
$sql = sprintf ("SELECT * FROM `tagente` WHERE `id_grupo` = '%d' AND `disabled` = 0 ORDER BY `nombre`",$id_group);
return get_db_all_rows_sql ($sql);
}
}
@ -1337,7 +1337,8 @@ function get_db_all_rows_sql ($sql) {
}
if (! empty ($retval))
return $retval;
return ""; //Return empty because NULL is a possible database value
//Return false, check with === or !==
return false;
}
/**
@ -1435,7 +1436,7 @@ function return_status_agent_module ($id_agentmodule = 0){
function return_status_layout ($id_layout = 0) {
$temp_status = 0;
$temp_total = 0;
$sql = sprintf ("SELECT id_agente_modulo, parent_item, id_layout_linked FROM `tlayout_date` WHERE `id_layout` = '%d'",$id_layout);
$sql = sprintf ("SELECT id_agente_modulo, parent_item, id_layout_linked FROM `tlayout_data` WHERE `id_layout` = '%d'",$id_layout);
$result = get_db_all_rows_sql ($sql);
foreach ($result as $rownum => $data) {
if (($data["id_layout_linked"] != 0) && ($data["id_agente_modulo"] == 0)) {

View File

@ -24,6 +24,11 @@ function print_pandora_visual_map ($id_layout, $show_links = true, $draw_lines =
$layout_datas = get_db_all_rows_field_filter ('tlayout_data', 'id_layout', $id_layout);
$lines = array ();
if ($layout_datas === false) {
echo '</div>';
return;
}
foreach ($layout_datas as $layout_data) {
// Linked to other layout ?? - Only if not module defined
if (($layout_data['id_layout_linked'] != 0) && ($layout_data['id_agente_modulo'] == 0)) {
@ -40,7 +45,6 @@ function print_pandora_visual_map ($id_layout, $show_links = true, $draw_lines =
}
// STATIC IMAGE (type = 0)
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
if ($layout_data['type'] == 0) {
// Link image
@ -108,7 +112,6 @@ function print_pandora_visual_map ($id_layout, $show_links = true, $draw_lines =
}
// Get parent relationship - Create line data
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
if ($layout_data["parent_item"] != "" && $layout_data["parent_item"] != 0) {
$line['id'] = $layout_data['id'];
$line['node_begin'] = 'layout-data-'.$layout_data["parent_item"];