-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathmap_post.php
More file actions
128 lines (124 loc) · 4.1 KB
/
Copy pathmap_post.php
File metadata and controls
128 lines (124 loc) · 4.1 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
127
128
<?php
require_once "backend/functions.php";
require_once "backend/map.php";
ini_set('display_errors', false);
if ( $_SERVER[ "REQUEST_METHOD" ] == 'POST' )
{
if (isset($_POST[ 'coors' ])) {
$obj = json_decode( $_POST[ 'coors' ] );
$coors = isset($obj->{'coorArr'}) ? $obj->{'coorArr'} : NULL;
$CableLineId = isset($obj->{'CableLineId'}) ? (int)$obj->{'CableLineId'} : NULL;
} else {
$coors = $CableLineId = NULL;
}
$uId = (isset($_POST[ 'userId' ])) ? (int)$_POST[ 'userId' ] : NULL;
$_SESSION[ 'user_id' ] = $uId;
if ( $_POST[ 'mode' ] == "updCableLine" )
{
$seqStart = $obj->{'seqStart'};
$seqEnd = $obj->{'seqEnd'};
updCableLinePoints( $coors, $CableLineId, $seqStart, $seqEnd, TRUE );
setTmpMapLastEdit();
}
elseif ( $_POST[ 'mode' ] == "addCableLine" )
{
$length = $obj->{'length'};
$name = $obj->{'name'};
$comment = $obj->{'comment'};
$CableType = $obj->{'CableType'};
addCableLinePoint( $coors, $CableType, $length, $name, $comment, TRUE );
setTmpMapLastEdit();
}
elseif ( $_POST[ 'mode' ] == "addSingPoint" )
{
require_once ( "func/CableType.php" );
/*$apartment = $obj->{'apartment'};
$building = $obj->{'building'};*/
$meterSign = $obj->{'meterSign'};
$note = $obj->{'note'};
$networkNode = isset($obj->{'networkNode'}) ? $obj->{'networkNode'} : "";
addSingPoint( $coors, $CableLineId, $networkNode, "NULL", "NULL",
$meterSign, $note );
setTmpMapLastEdit();
}
elseif ( $_POST[ 'mode' ] == "deleteSingPoint" )
{
deleteSingPoint( $coors, TRUE );
setTmpMapLastEdit();
}
elseif ( $_POST[ 'mode' ] == "deleteCableLine" )
{
deleteCableLine( $CableLineId, TRUE );
setTmpMapLastEdit();
}
elseif ( $_POST[ 'mode' ] == "addNode" )
{
$NetworkBoxId = $obj->{'NetworkBoxId'};
$apartment = NULL;
$building = NULL;
$note = $obj->{'note'};
$name = $obj->{'name'};
$place = $obj->{'place'};
addNode( $coors, $name, $NetworkBoxId, $note, NULL,
$building, $apartment, $place, TRUE );
setTmpMapLastEdit();
}
elseif ( $_POST[ 'mode' ] == "deleteNode" )
{
deleteNode( $coors, TRUE );
setTmpMapLastEdit();
}
elseif ( $_POST[ 'mode' ] == "moveNode" )
{
moveNode( $coors, TRUE );
setTmpMapLastEdit();
}
elseif ( $_POST[ 'mode' ] == "divCableLine" )
{
$nodeInfo[ 'name' ] = $obj->{'name'};
$nodeInfo[ 'NetworkBoxId' ] = $obj->{'NetworkBoxId'};
/*$nodeInfo[ 'apartment' ] = $obj->{'apartment'};
$nodeInfo[ 'building' ] = $obj->{'building'};*/
$nodeInfo[ 'note' ] = $obj->{'note'};
$nodeInfo[ 'place' ] = $obj->{'place'};
$ret = divCableLine( $coors, $CableLineId, $nodeInfo, TRUE );
if ($ret['error']) {
print json_encode($ret);
} else {
setTmpMapLastEdit();
print json_encode( array( "error" => false ) );
}
}
elseif ( $_POST[ 'mode' ] == "addNetworkBox" )
{
$networkBoxType = $obj->{'networkBoxType'};
$invNum = $obj->{'invNum'};
$boxId = addNetworkBox( $networkBoxType, $invNum, TRUE );
if (isset($boxId['id'])) {
$result = array( "NetworkBoxId" => $boxId['id'] );
} else {
$result = array( "error" => (isset($boxId['error'])) ? $boxId['error'] : NULL );
}
setTmpMapLastEdit();
setMapUserActivity( $uId );
print json_encode( $result );
die();
}
elseif ( $_POST[ 'mode' ] == "save" )
{
$result = saveTmpData();
if (defined($result['error'])) {
print json_encode( array( "error" => $result['error'] ) );
} else {
print json_encode( array( "error" => false ) );
}
}
elseif ( $_POST[ 'mode' ] == "cancel" )
{
setMapLastEdit();
$result = checkData();
print json_encode( $result );
}
setMapUserActivity( $uId );
}
?>