This repository was archived by the owner on Jun 19, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy patheditMap.php
More file actions
126 lines (107 loc) · 3.02 KB
/
editMap.php
File metadata and controls
126 lines (107 loc) · 3.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
<script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <!-- Includes Jquery into the project -->
<script src="//code.jquery.com/ui/1.11.2/jquery-ui.js"></script>
<script>
$(function() {
$( "#draggable" ).draggable();
});
</script>
<?php
include "./db.php";
include "./objects.php";
$map_id = $_GET['map_id'];
$result = mysqli_query($con, "SELECT * FROM maps WHERE id = '$map_id' LIMIT 1");
$row = mysqli_fetch_assoc($result);
$image_url = $row['image_url'];
$shapes = array();
$currentHouseNumber = "0";
$currentShape = null;
$result = mysqli_query($con, "SELECT * FROM coordinates WHERE map_id = '$map_id' ORDER BY housenumber ASC, order_num ASC") or die ("ERROR: " . mysqli_error($con));
while ($row = mysqli_fetch_assoc($result))
{
if ($currentHouseNumber != $row['housenumber']) //create a new shape everytime we get to a new house
{
$currentShape = new Shape($row['housenumber']);
array_push($shapes, $currentShape);
$currentHouseNumber = $row['housenumber'];
}
$currentShape->addPoint(new Point($row['x_pos'],$row['y_pos']));
}
$firstTime = true;
$json_shapes = "[";
foreach($shapes as $shape)
{
if ($firstTime == false)
{
$json_shapes .= ",";
}
$json_shapes .= $shape->to_json();
$firstTime = false;
}
$json_shapes .= "]";
?>
<div class="page_wrapper">
<div class="right_div" id="draggable" >
<!--Box with addresses-->
Addresses (Draggable)
<select id="houseOptions" class='fullWidth' name="select_addresses" size="5">
<?php
//$result = mysqli_query($con,"SELECT id,address1 FROM mock_housemaster WHERE developmentcode = '".$developmentcode."' ");
$result = mysqli_query($con,"SELECT mock_housemaster.housenumber, mock_housemaster.address1
FROM mock_housemaster, maps
WHERE
maps.id = '$map_id' AND
mock_housemaster.developmentcode = maps.developmentcode ") or die("ERROR: " . mysqli_error($con));
while ($row = mysqli_fetch_assoc($result))
{
echo "<option value='".$row['housenumber']."'>".$row['address1']."</option>";
}
?>
</select>
<!--END Box with addresses-->
</div>
<div class="left_div">
<form>
<textarea id='newCords' rows=3 name="coords1" class="canvas-area input-xxlarge" disabled
placeholder="Shape Coordinates"
map_id="<?php echo $map_id; ?>"
data-image-url="<?php echo $image_url; ?>"
style="position:absolute;"
></textarea>
</form>
<!--Where the map will be displayed -->
<div id='areaViewer'></div>
</div>
</div>
<style>
.fullWidth{
width: 100%;
}
.page_wrapper {
width:100%;
border:1px solid;
}
.left_div {
width:auto;
background:white;
overflow:scroll;
}
.right_div {
width:200px;
background:white;
float:right;
position:absolute;
right: 0;
border: 1px solid black;
}
</style>
<script>
</script>
<?php include "./js/jquery.canvasAreaDraw2.php"; ?>
<!--
<script language="javascript" src="./js/jquery.canvasAreaDraw2.js"></script>
-->
<script>
$("#editMap").click(function() {
$("#portal").load("editMap.php"); //Load updateMap.php into portal.
});
</script>