".$lang_label["delete_ok"].""; else $result = "

".$lang_label["delete_no"]."

"; echo $result; } // Delete module SQL code if (isset($_GET["delete_report"])){ $id = $_GET["delete_report"]; $sql = "DELETE FROM tlayout_data WHERE id_layout = $id"; $sql2 = "DELETE FROM tlayout WHERE id = $id"; $res=mysql_query($sql); $res2=mysql_query($sql2); if ($res AND $res2) $result = "

".$lang_label["delete_ok"]."

"; else $result = "

".$lang_label["delete_no"]."

"; echo $result; } // Create new report. First step if (isset($_GET["create_report"])){ $createmode = 2; } // Add module SQL code if (isset($_GET["add_module"])){ if (isset($_POST["id_report"])) $id_report = $_POST["id_report"]; else { audit_db($id_user,$REMOTE_ADDR, "Hack attempt","Parameter trash in map builder"); include ("general/noaccess.php"); exit; } $my_id_agent = entrada_limpia($_POST["id_agent"]); $my_id_module = entrada_limpia($_POST["id_module"]); $my_period = entrada_limpia($_POST["period"]); $my_type = entrada_limpia($_POST["type"]); $my_cg = entrada_limpia($_POST["id_custom_graph"]); $my_slamax = entrada_limpia($_POST["sla_max"]); $my_slamin = entrada_limpia($_POST["sla_min"]); $my_slalimit = entrada_limpia($_POST["sla_limit"]); $sql = "INSERT INTO tlayout_data (id_layout, id_gs, id_agent_module, type, sla_max, sla_min, sla_limit, period) VALUES ('$id_report', '$my_cg', '$my_id_module', '$my_type', '$my_slamax', '$my_slamin', '$my_slalimit', '$my_period')"; if ($res=mysql_query($sql)) $result = "

".$lang_label["create_ok"]."

"; else $result = "

".$lang_label["create_no"]."

"; echo $result; } // Create item SQL code if (isset($_POST["createmode"])){ $createmode = $_POST["createmode"]; $map_name = entrada_limpia($_POST["map_name"]); $map_background = entrada_limpia($_POST["map_background"]); $map_width = entrada_limpia($_POST["map_width"]); $map_height = entrada_limpia($_POST["map_height"]); // INSERT REPORT DATA if ($createmode == 1){ $form_id_user = $id_user; $sql = "INSERT INTO tlayout (name, background, width, height) VALUES ('$map_name', '$map_background', '$map_width', '$map_height')"; if ($res=mysql_query($sql)) $result = "

".$lang_label["create_ok"]."

"; else $result = "

".$lang_label["create_no"]."

"; $id_map = mysql_insert_id(); // UPDATE REPORT DATA } else { $id_map = entrada_limpia($_POST["id_map"]); $sql = "UPDATE tlayout SET name = '$map_name', height= '$map_height', width = '$map_width', background = '$map_background' WHERE id = $id_map"; if ($res=mysql_query($sql)) $result = "

".$lang_label["modify_ok"]."

"; else $result = "

".$lang_label["modify_no"]."

"; } echo $result; if ($id_map != ""){ $_GET["id"] = $id_map; $createmode=0; } } // GET DATA OF REPORT // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ if ($createmode==2 OR isset($_GET["id"]) OR (isset($_POST["id_map"]))) { if (isset($_GET["id"])) $id_map = $_GET["id"]; elseif (isset($_POST["id_map"])) $id_map = $_POST["id_map"]; else $id_map = -1; if (isset($_POST["id_agent"])) $id_agent = $_POST["id_agent"]; else $id_agent = 0; if ($createmode != 2){ $createmode = 0; $sql = "SELECT * FROM tlayout WHERE id = $id_map"; $res=mysql_query($sql); if ($row = mysql_fetch_array($res)){ $map_name = $row["name"]; $map_background = $row["background"]; $map_width = $row["width"]; $map_height = $row["height"]; } } else { $map_name = ""; $map_background = ""; $map_width = ""; $map_height = ""; $createmode = 1; } echo "

".$lang_label["reporting"]." > "; echo $lang_label["map_builder"]."

"; echo "
"; echo ""; if ($createmode == 0){ echo ""; } echo ""; echo "
"; echo $lang_label["report_name"]; echo ""; echo ""; echo "
"; echo $lang_label["background"]; echo ""; echo ""; echo "
"; echo $lang_label["width"]; echo ""; echo ""; echo "
"; echo $lang_label["height"]; echo ""; echo ""; // Button echo "
"; echo ""; echo "
"; if ($createmode == 0) echo ""; else echo ""; echo "
"; echo "
"; if ($createmode == 0){ // Part 2 - Add new items to report // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ echo "

".$lang_label["reporting_item_add"]."

"; // Show combo with agents // ---------------------- echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo "
".$lang_label["source_agent"].""; echo "'; echo ""; echo ""; // Modules combo // ----------------------- echo "
"; echo ""; if (isset($id_agent)) echo ""; echo "
"; echo "".$lang_label["modules"].""; echo ""; echo ""; // Component type echo "
"; echo "".$lang_label["reporting_type"].""; echo ""; echo ""; // Period echo "
"; echo "".$lang_label["period"].""; echo ""; echo ""; echo "
"; echo "".$lang_label["pos_x"].""; echo ""; echo ""; echo "".$lang_label["pos_y"].""; echo ""; echo "
"; echo "".$lang_label["height"].""; echo ""; echo ""; echo "".$lang_label["width"].""; echo ""; echo "
"; echo "".$lang_label["label"].""; echo ""; echo "
"; echo "".$lang_label["image"].""; echo ""; echo "
"; echo "".$lang_label["map_linked"].""; echo ""; echo ""; echo "
"; echo "".$lang_label["parent_item"].""; echo ""; echo ""; echo "
"; echo "".$lang_label["label_color"].""; echo ""; echo ""; echo ""; echo "".$lang_label["link_color"].""; echo ""; echo ""; echo "
"; echo ""; echo "
"; echo ""; echo "
"; echo ""; // Part 3 - List of already assigned report items // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ echo "

".$lang_label["report_items"]."

"; echo ""; echo ""; $sql = "SELECT * FROM tlayout_data WHERE id_layout = $id_map"; $res=mysql_query($sql); $color = 0; while ($row = mysql_fetch_array($res)){ // Calculate table line color if ($color == 1){ $tdcolor = "datos"; $color = 0; } else { $tdcolor = "datos2"; $color = 1; } $id_layoutdata = $row["id"]; $type = $row["type"]; switch ($type){ case "0": $type_desc = "Single graph"; break; case "1": $type_desc = "Module graph"; break; case "2": $type_desc = "Line"; break; } $period = $row["period"]; $id_am = $row["id_agente_modulo"]; $x = $row["pos_x"]; $y = $row["pos_y"]; $name = "N/A"; $agent_name = "N/A"; if ($id_am != ""){ $agent_name = dame_nombre_agente_agentemodulo ($id_am); $module_name = dame_nombre_modulo_agentemodulo ($id_am); } echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo "
".$lang_label["type"]." ".$lang_label["agent_name"]." ".$lang_label["module_name"]." ".$lang_label["pos_x"]." ".$lang_label["pos_y"]." ".$lang_label["delete"]."
".$type_desc."".$agent_name."".$module_name."".$x."".$y.""; echo ""; } echo "
"; } } else { // Map LIST Selection screen // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ echo "

".$lang_label["reporting"]." > "; echo $lang_label["map_builder"]."

"; echo ""; echo ""; $color=1; $sql="SELECT * FROM tlayout"; $res=mysql_query($sql); while ($row = mysql_fetch_array($res)){ if ((dame_admin($id_user)==1)){ // Calculate table line color if ($color == 1){ $tdcolor = "datos"; $color = 0; } else { $tdcolor = "datos2"; $color = 1; } echo ""; echo ""; echo ""; echo ""; $id_map = $row["id"]; echo "
".$lang_label["map_name"]." ".$lang_label["background"]." ".$lang_label["size"]." ".$lang_label["Manage"]." ".$lang_label["delete"]."
".$row["name"]."".$row["background"]."".$row["width"]."x".$row["height"].""; echo ""; } } echo "
"; echo ""; echo ""; echo "
"; echo ""; echo ""; echo "
"; } ?>