".$lang_label["delete_ok"].""; else $result = "
".$lang_label["delete_no"]."
"; echo $result; } // Delete module SQL code if (isset($_GET["delete_map"])){ $id = $_GET["delete_map"]; $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_map"])){ $createmode = 2; } if (isset($_GET["update_module"])){ if (isset($_GET["update_module"])) $id_element = $_GET["update_module"]; else { audit_db($id_user,$REMOTE_ADDR, "Hack attempt","Parameter trash in map builder"); include ("general/noaccess.php"); exit; } $pos_x = give_parameter_post ("pos_x",0); $pos_y = give_parameter_post ("pos_y",0); $my_height = give_parameter_post ("height"); $my_width = give_parameter_post ("width"); $my_label = give_parameter_post ("label"); $my_image = give_parameter_post ("image"); $sql = "UPDATE tlayout_data SET pos_x = '$pos_x', pos_y = '$pos_y', width = '$my_width', height = '$my_height', image = '$my_image', label = '$my_label' WHERE id = $id_element"; if ($res=mysql_query($sql)) $result = "
".$lang_label["modify_ok"]."
"; else { $result = "
".$lang_label["modify_no"]."
"; echo $sql; echo "
"; } echo $result; } // Add module SQL code if (isset($_GET["add_module"])){ if (isset($_POST["id_map"])) $id_map = $_POST["id_map"]; else { audit_db($id_user,$REMOTE_ADDR, "Hack attempt","Parameter trash in map builder"); include ("general/noaccess.php"); exit; } $my_id_map = give_parameter_post ("id_map",0); $my_id_agent = give_parameter_post ("id_agent",0); $my_id_module = give_parameter_post ("id_module",0); $my_period = give_parameter_post ("period",3600); $my_type = give_parameter_post ("type",0); $my_pos_x = give_parameter_post ("pos_x",0); $my_pos_y = give_parameter_post ("pos_y",0); $my_height = give_parameter_post ("height"); $my_width = give_parameter_post ("width"); $my_label = give_parameter_post ("label"); $my_image = give_parameter_post ("image"); $my_map_linked = give_parameter_post ("map_linked"); $my_parent_item = give_parameter_post ("parent_item"); $my_label_color = give_parameter_post ("label_color",""); $my_link_color = give_parameter_post ("link_color",0); $sql = "INSERT INTO tlayout_data (id_layout, pos_x, pos_y, height, width, label, image, type, period, id_agente_modulo, id_layout_linked, parent_item, label_color, no_link_color) VALUES ('$my_id_map', '$my_pos_x', '$my_pos_y', '$my_height', '$my_width', '$my_label', '$my_image', '$my_type', '$my_period', '$my_id_module', '$my_map_linked', '$my_parent_item', '$my_label_color', '$my_link_color')"; 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, id_group) VALUES ('$map_name', '$map_background', '$map_width', '$map_height', 1)"; 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 "
"; echo $lang_label["background"]; echo "
"; // echo "
"; echo '
'; if ($map_background != "") echo "
".$map_background."
"; $ficheros2 = list_files('images/console/background/', "",0, 0); $a=0; while (isset($ficheros2[$a])){ echo "
".$ficheros2[$a]."
"; $a++; } 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["map_item_add"]; ?>
"; echo "
"; echo "
"; // Show combo with agents // ---------------------- echo "
"; echo "
"; echo "
"; echo "
"; echo "
".$lang_label["source_agent"]."
"; echo "
"; echo "
"; if ($id_agent != 0) echo "
".dame_nombre_agente($id_agent); $sql1='SELECT * FROM tagente order by nombre'; $result=mysql_query($sql1); while ($row=mysql_fetch_array($result)){ if ( $id_agent != $row["id_agente"]) echo "
".$row["nombre"]."
"; } echo '
'; echo "
"; echo ""; // Modules combo // ----------------------- echo "
"; echo "
"; if (isset($id_agent)) echo "
"; echo "
"; echo "
"; echo "
".$lang_label["modules"]."
"; echo "
"; echo "
"; echo "
--
"; if ($id_agent != 0){ // Populate Module/Agent combo $sql1="SELECT * FROM tagente_modulo WHERE id_agente = ".$id_agent. " order by nombre"; $result = mysql_query($sql1); while ($row=mysql_fetch_array($result)){ echo "
".$row["nombre"]."
"; } } echo "
"; // Component type echo "
"; echo "
".$lang_label["reporting_type"]."
"; echo "
"; echo "
"; echo "
".$lang_label["static_graph"]."
"; echo "
".$lang_label["module_graph"]."
"; echo "
".$lang_label["line"]."
"; echo "
"; // Period echo "
"; echo "
".$lang_label["period"]."
"; echo "
"; echo "
"; echo "
"."Hour"."
"; echo "
"."2 Hours"."
"; echo "
"."3 Hours"."
"; echo "
"."6 Hours"."
"; echo "
"."12 Hours"."
"; echo "
"."Last day"."
"; echo "
"."Two days"."
"; echo "
"."Last Week"."
"; echo "
"."15 days"."
"; echo "
"."Last Month"."
"; echo "
"."Two Month"."
"; echo "
"."Six Months"."
"; echo "
"; echo "
"; echo "
".$lang_label["pos_x"]."
"; echo "
"; echo "
"; echo "
"; echo "
".$lang_label["pos_y"]."
"; echo "
"; echo "
"; echo "
"; echo "
".$lang_label["height"]."
"; echo "
"; echo "
"; echo "
"; echo "
".$lang_label["width"]."
"; echo "
"; echo "
"; echo "
"; echo "
".$lang_label["label"]."
"; echo "
"; echo "
"; echo "
"; echo "
".$lang_label["image"]."
"; echo "
"; echo '
'; $ficheros = list_files('images/console/icons/', "",0, 0); $a=0; while (isset($ficheros[$a])){ $myfichero = substr($ficheros[$a],0,strlen($ficheros[$a])-4); if ((strpos($myfichero,"_bad") == 0) && (strpos($myfichero,"_ok") == 0) && ($myfichero != "" )) echo "
".$myfichero."
"; $a++; } echo '
'; echo "
"; echo "
".$lang_label["map_linked"]."
"; echo "
"; echo "
"; $sql_pi = "SELECT * FROM tlayout"; $res_pi=mysql_query($sql_pi); echo "
".$row_pi["N/A"]; while ($row_pi = mysql_fetch_array($res_pi)){ echo "
".$row_pi["name"]; } echo "
"; echo "
"; echo "
".$lang_label["parent_item"]."
"; echo "
"; echo "
"; $sql_pi = "SELECT * FROM tlayout_data WHERE id_layout = $id_map"; $res_pi=mysql_query($sql_pi); echo "
".$row_pi["N/A"]; while ($row_pi = mysql_fetch_array($res_pi)){ echo "
".$row_pi["label"]; } echo "
"; echo "
"; echo "
".$lang_label["label_color"]."
"; echo "
"; echo "
"; echo "
".$lang_label["white"]."
"; echo "
".$lang_label["black"]."
"; echo "
"; echo "
"; echo "
".$lang_label["link_color"]."
"; echo "
"; echo "
"; echo "
".$lang_label["yes"]."
"; echo "
".$lang_label["no"]."
"; echo "
"; echo "
"; echo "
"; echo "
"; echo "
"; echo "
"; echo ""; echo "
"; // Part 3 - List of already assigned report items // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ echo "
".$lang_label["report_items"]."
"; $sql = "SELECT * FROM tlayout_data WHERE id_layout = $id_map"; $res=mysql_query($sql); if (mysql_num_rows($res)) { echo "
"; echo "
".$lang_label["type"]."
".$lang_label["module_name"]."
".$lang_label["label"]."
".$lang_label["image"]."
".$lang_label["pos_x"]."
".$lang_label["pos_y"]."
".$lang_label["width"]."
".$lang_label["height"]."
".$lang_label["delete"]."
".$lang_label["update"]."
"; $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; } $id_element = $row["id"]; $period = $row["period"]; $id_am = $row["id_agente_modulo"]; $x = $row["pos_x"]; $y = $row["pos_y"]; $myimage = $row["image"]; $width= $row["width"]; $height = $row["height"]; $label = $row["label"]; $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 "
".$type_desc."
"; echo "
".$agent_name." / "; echo $module_name."
"; echo "
"; echo "
"; echo "
"; echo '
'; echo "
".$myimage."
"; $ficheros = list_files('images/console/icons/', "",0, 0); $a=0; while (isset($ficheros[$a])){ $myfichero = substr($ficheros[$a],0,strlen($ficheros[$a])-4); if ((strpos($myfichero,"_bad") == 0) && (strpos($myfichero,"_ok") == 0) && ($myfichero != "" )) echo "
".$myfichero."
"; $a++; } echo '
'; echo "
"; echo "
"; echo "
"; echo "
"; echo "
"; echo "
"; echo "
"; echo "
"; echo "
"; echo "
"; echo "
"; echo "
"; echo ""; } echo "
"; } else { echo "
".$lang_label["no_repitem_def"]."
"; } } } else { // Map LIST Selection screen // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ echo "
".$lang_label["reporting"]." > "; echo $lang_label["map_builder"]."
"; $color=1; $sql="SELECT * FROM tlayout"; $res=mysql_query($sql); if (mysql_num_rows($res)) { echo "
"; echo "
".$lang_label["map_name"]."
".$lang_label["background"]."
".$lang_label["size"]."
".$lang_label["Manage"]."
".$lang_label["delete"]."
"; 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 "
".$row["name"]."
"; echo "
".$row["background"]."
"; echo "
".$row["width"]."x".$row["height"]."
"; $id_map = $row["id"]; echo "
"; echo "
"; } } echo "
"; echo "
"; } else { echo "
".$lang_label["no_map_def"]."
"; echo "
"; } echo "
"; echo "
"; echo "
"; echo ""; echo "
"; } ?>