"; $layout_datas = get_db_all_rows_field_filter ('tlayout_data', 'id_layout', $id_layout); $lines = array (); if ($layout_datas !== false) { 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)) { $status = return_status_layout ($layout_data['id_layout_linked']); } else { $id_agent = get_db_value ("id_agente", "tagente_estado", "id_agente_modulo", $layout_data['id_agente_modulo']); $id_agent_module_parent = get_db_value ("id_agente_modulo", "tlayout_data", "id", $layout_data["parent_item"]); // Item value $status = return_status_agent_module ($layout_data['id_agente_modulo']); if ($layout_data['no_link_color'] == 1) $status_parent = -1; else $status_parent = return_status_agent_module ($id_agent_module_parent); } // STATIC IMAGE (type = 0) if ($layout_data['type'] == 0) { // Link image //index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=1 if ($status == 0) // Bad monitor $z_index = 2; elseif ($status == 2) // Alert $z_index = 3; else $z_index = 1; // Print BAD over good // Draw image echo '
'; if ($show_links) { if ($layout_data['id_layout_linked'] == "" || $layout_data['id_layout_linked'] == 0) { echo ""; } else { echo ''; } } if ($status == 0) { if ($layout_data['width'] != "" && $layout_data['width'] != 0) echo ''; else echo ''; } else { if ($layout_data['width'] != "" && $layout_data['width'] != 0) echo ''; else echo ''; } echo ""; // Draw label echo "
"; echo $layout_data['label']; echo "
"; } // SINGLE GRAPH (type = 1) if ($layout_data['type'] == 1) { // single graph // Draw image echo '
'; if ($show_links) { if (($layout_data['id_layout_linked'] == "") || ($layout_data['id_layout_linked'] == 0)) { echo ''; } else { echo ''; } } echo ''; echo ""; echo "
"; } else if ($layout_data['type'] == 2) { $line['id'] = $layout_data['id']; $line['x'] = $layout_data['pos_x']; $line['y'] = $layout_data['pos_y']; $line['width'] = $layout_data['width']; $line['height'] = $layout_data['height']; $line['color'] = $layout_data['label_color']; array_push ($lines, $line); } // 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"]; $line['node_end'] = 'layout-data-'.$layout_data["id"]; $line['color'] = $status_parent ? '#00dd00' : '#dd0000'; array_push ($lines, $line); } } } if ($draw_lines) { /* If you want lines in the map, call using Javascript: draw_lines (lines, id_div); on body load, where id_div is the id of the div which holds the map */ echo "\n".''."\n"; } // End main div echo ""; } /** * @return array Layout data types */ function get_layout_data_types () { $types = array (0 => __('Static graph'), 1 => __('Module graph')); return $types; } ?>