-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmaps.php
More file actions
324 lines (260 loc) · 11.6 KB
/
maps.php
File metadata and controls
324 lines (260 loc) · 11.6 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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
<?php
// server should keep session data for AT LEAST 1 hour
// ini_set('session.gc_maxlifetime', 0);
// session_set_cookie_params(0);
ini_set('session.gc_maxlifetime', 14400);
session_start();
try
{
$bdd = new PDO('mysql:host=localhost;dbname=yoda;charset=utf8', 'root', 'cetroxNEST');
}
catch(Exception $e)
{
die('Erreur : '.$e->getMessage());
}
try
{
$bdd2 = new PDO('mysql:host=localhost;dbname=ecsupgrader;charset=utf8', 'yoda', 'cetroxNEST');
}
catch(Exception $e)
{
die('Erreur : '.$e->getMessage());
}
error_reporting(E_ALL);
set_time_limit(0);
date_default_timezone_set('Europe/London');
$selectVersion = $bdd->query('SELECT CFG_VERSION FROM YDA_CONFIG');
while ($version = $selectVersion->fetch()){
$yodaVersion = $version['CFG_VERSION'];
}
$ip = $_SERVER['REMOTE_ADDR'];
$page = $_SERVER['PHP_SELF'];
$browserArray = get_browser(NULL, true);
$browser = $browserArray['parent'];
$now = date("Y-m-d H:i:s");
$req = $bdd->prepare('INSERT INTO YDA_SPY(SPY_IP, SPY_TIME, SPY_PAGE, SPY_BROWSER) VALUES (:ip, :now, :page, :browser)');
$req->execute(array(
'ip' => $ip,
'now' => $now,
'page' => $page,
'browser' => $browser )) or die(print_r($bdd->errorCode()));
require_once('checkCookie.php');
checkCookie('maps.php');
$right=[];
$select = $bdd->query('SELECT RGT_CODE
FROM YDA_RIGHT
JOIN YDA_HOOK on HOK_ID_RGT = RGT_ID
JOIN YDA_PROFIL ON HOK_ID_PRO = PRO_ID
JOIN YDA_USERS ON USR_ID_PRO = PRO_ID
WHERE USR_ID ="'.$_SESSION["id_user"].'"');
while ($query = $select->fetch()){
array_push($right, $query['RGT_CODE']);
}
$planningAccess = 0;
$select = $bdd->query('SELECT USR_TECH, USR_DIRECTION
FROM YDA_USERS
WHERE USR_ID ="'.$_SESSION["id_user"].'"');
while ($query = $select->fetch()){
if($query['USR_TECH'] == 1 || $query['USR_DIRECTION'] == 1){
$planningAccess = 1;
}else{
$planningAccess = 0;
}
}
?>
<style>
/* Always set the map height explicitly to define the size of the div
* element that contains the map. */
#map {
height: calc(100% - 102px);
}
/* Optional: Makes the sample page fill the window. */
</style>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="Bookmarks for all the ETMI Customer Application. For RIS and PACS. Internal user Only !">
<meta name="author" content="Yohann LOPEZ">
<title>Yoda Maps</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/css/bootstrap.min.css" integrity="sha384-PsH8R72JQ3SOdhVi3uxftmaW6Vc51MKb0q5P2rRUpPvrszuE4W1povHYgTpBfshb" crossorigin="anonymous">
<link href="https://gitcdn.github.io/bootstrap-toggle/2.2.2/css/bootstrap-toggle.min.css" rel="stylesheet">
<!-- CSS Yoda -->
<link href="css/css_yoda.css" rel="stylesheet">
<link href="css/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css">
<link href="css/scrolltabs.css" rel="stylesheet">
<link rel="icon" type="image/png" href="./img/yoda.png" />
<script src="https://code.jquery.com/jquery-3.2.1.js" integrity="sha256-DZAnKJ/6XZ9si04Hgrsxu/8s717jcIzLy3oi35EouyE=" crossorigin="anonymous"></script>
</head>
<body background="css/Vignettes/Background.jpg" style="overflow-x:hidden;">
<!-- Navigation -->
<nav class="navbar navbar-expand-lg navbar-dark bg-dark">
<div class="container col-10">
<h3 style="col-10"><FONT color="#9ACD32" class="yoda">Y</font><FONT color="white" class="yohann">ohann</font> <FONT color="#9ACD32" class="yoda">O</font><FONT color="white" class="yohann">ptimized</font> <FONT color="#9ACD32" class="yoda">D</font><FONT color="white" class="yohann">irect link to</font> <FONT color="#9ACD32" class="yoda">A</font><FONT color="white" class="yohann">pplications</font><FONT color="#9ACD32" class="yoda"> v<?=$yodaVersion?></font></h3>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarResponsive" aria-controls="navbarResponsive" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarResponsive">
<ul class="navbar-nav ml-auto">
<div class="dropdown col-12">
<button class="btn btn-outline-light dropdown-toggle col-12" type="button" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Menu
</button>
<div class="dropdown-menu" aria-labelledby="dropdownMenuButton">
<?php $select = $bdd->query('SELECT * FROM YDA_MENU WHERE MEN_GROUP = 1');
// echo $_SERVER['PHP_SELF'];
while ($query = $select->fetch()){
echo '<a class="dropdown-item ';
if($_SERVER['PHP_SELF'] == '/yoda/'.$query['MEN_PAGE']){echo 'active';}
echo'" href="'.$query['MEN_PAGE'].'">'.$query['MEN_NAME'].'</a>';
} ?>
<div class="dropdown-divider"></div>
<?php $select = $bdd->query('SELECT * FROM YDA_MENU WHERE MEN_GROUP = 2');
while ($query = $select->fetch()){
echo '<a class="dropdown-item ';
if($_SERVER['PHP_SELF'] == $query['MEN_PAGE']){echo 'active';}
echo'" href="'.$query['MEN_PAGE'].'">'.$query['MEN_NAME'].'</a>';
} ?>
<?php if($planningAccess == 1):?>
<a class="dropdown-item" href="planning.php">Planning Support</a>
<?php endif;?>
<a class="dropdown-item" href="ajax/logout.php" style="color:red;">Deconnexion</a>
</div>
</div>
</ul>
</div>
</div>
</nav>
<div style="background-color:#343a40;" class="col-12">
<div class="btn-group btn-group-toggle col-12" data-toggle="buttons">
<label class="btn btn-outline-primary col-4 active">
<input type="radio" name="filter" id="aucunRB" autocomplete="off" checked> Aucun
</label>
<label class="btn btn-outline-info col-4">
<input type="radio" name="filter" id="versionRB" autocomplete="off"> Version
</label>
<label class="btn btn-outline-light col-4">
<input type="radio" name="filter" id="activityRB" autocomplete="off"> Activité
</label>
</div>
</div>
<div class="d-none" id='filterResult'></div>
<div id="map"></div>
<script>
var customLabelActi = {
nada: { icon: './css/Vignettes/greyPin.png'},
ris: { icon: './css/Vignettes/redPin.png'},
pacs: { icon: './css/Vignettes/greenPin.png' },
rispacs: { icon: './css/Vignettes/purplePin.png' },
};
var customLabelVers = {
v6: { icon: './css/Vignettes/orangePin.png'},
v7: { icon: './css/Vignettes/bluePin.png'}
};
var filter = 0;
$('input[type=radio][name=filter]').change(function() {
if (this.id == 'aucunRB') {
filter = 0;
initMap(this);
}
else if (this.id == 'versionRB') {
filter = 1;
initMap(this);
}
else if (this.id == 'activityRB') {
filter = 1;
initMap(this);
}
});
function firstUpper(string) {
return string.charAt(0).toUpperCase() + string.slice(1);
}
function initMap(RB) {
var map = new google.maps.Map(document.getElementById('map'), {
center: new google.maps.LatLng(20,0),
zoom: 3
});
var infoWindow = new google.maps.InfoWindow;
$.get("ajax/CreateXML.php", function(json){
// console.log(json);
});
// Change this depending on the name of your PHP or XML file
downloadUrl('./address.xml' , function(data) {
var xml = data.responseXML;
var markers = xml.documentElement.getElementsByTagName('marker');
console.log(xml);
Array.prototype.forEach.call(markers, function(markerElem) {
var name = markerElem.getAttribute('name');
name = firstUpper(name);
var address = markerElem.getAttribute('address');
address = firstUpper(address);
var activity = markerElem.getAttribute('activity');
var version = markerElem.getAttribute('version');
var point = new google.maps.LatLng(
parseFloat(markerElem.getAttribute('lat')),
parseFloat(markerElem.getAttribute('lng')));
var infowincontent = document.createElement('div');
var strong = document.createElement('strong');
strong.textContent = name
infowincontent.appendChild(strong);
infowincontent.appendChild(document.createElement('br'));
var text = document.createElement('text');
text.textContent = address
infowincontent.appendChild(text);
if (RB== null || RB.id == 'aucunRB') {
filter = 0;
}
else if (RB.id == 'versionRB') {
var icon = customLabelVers[version] || {};
filter = 1;
}
else if (RB.id == 'activityRB') {
var icon = customLabelActi[activity] || {};
filter = 1;
}
console.log(filter);
if(filter == 0){
var marker = new google.maps.Marker({
map: map,
position: point
});
}else{
var marker = new google.maps.Marker({
map: map,
position: point,
icon: icon.icon
});
}
marker.addListener('click', function() {
infoWindow.setContent(infowincontent);
infoWindow.open(map, marker);
});
});
});
}
function downloadUrl(url, callback) {
var request = window.ActiveXObject ?
new ActiveXObject('Microsoft.XMLHTTP') :
new XMLHttpRequest;
request.onreadystatechange = function() {
if (request.readyState == 4) {
request.onreadystatechange = doNothing;
callback(request, request.status);
}
};
request.open('GET', url, true);
request.send(null);
}
function doNothing() {}
</script>
<script async defer src="https://maps.googleapis.com/maps/api/js?key=AIzaSyCo_lLa3e8UeMBQdc6EYS5Wbw7udYxl3_o&callback=initMap"></script>
<!-- Bootstrap core JavaScript -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.3/umd/popper.min.js" integrity="sha384-vFJXuSJphROIrBnz7yo7oB41mKfc8JzQZiCq4NCceLEaO4IHwicKwpJf9c9IpFgh" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/js/bootstrap.min.js" integrity="sha384-alpBpkh1PFOepccYVYDB4do5UnbKysX5WZXm3XxPqe5iKTfUKjNkCk9SaVuEZflJ" crossorigin="anonymous"></script>
<script src="js/jquery.scrolltabs.js"></script>
<script src="js/yoda.js"></script>
<script src="https://gitcdn.github.io/bootstrap-toggle/2.2.2/js/bootstrap-toggle.min.js"></script>
<script></script>
</body>
</html>