forked from level2-gis/gisapp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
load.php
88 lines (72 loc) · 2.93 KB
/
load.php
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
<?php
session_start();
//Setting some global variables
$user = "" . $_SESSION['user_name'];
$project = "" . $_SESSION['project'];
$data = json_decode($_SESSION['data']);
$settings = json_decode($_SESSION['settings']);
$gis_projects = json_decode($_SESSION['gis_projects']);
$qgs = json_decode($_SESSION['qgs']);
if (!property_exists($settings, "search")) {
$settings->search = null;
}
if (!property_exists($settings, "layerSpecifics")) {
$settings->layerSpecifics = null;
}
if (!property_exists($settings, "geoCode")) {
$settings->geoCode = null;
}
if (!property_exists($settings, "locationServices")) {
$settings->locationServices = null;
}
if (!property_exists($data, "client_url")) {
$data->client_url = "";
}
if (file_exists($_SERVER["DOCUMENT_ROOT"] . $gis_projects->path . 'admin/resources/images/' . $data->client_name . '.png')) {
$data->client_logo = $gis_projects->path . 'admin/resources/images/' . $data->client_name . '.png';
} else {
$data->client_logo = $gis_projects->path . 'admin/resources/images/_temp.png';
}
Header("content-type: application/x-javascript");
?>
//get project data from DB
var projectData = {};
//bind PHP --> JS
projectData.user = '<?php echo $user ?>';
projectData.client_name = '<?php echo $data->client_name ?>';
projectData.client_display_name = '<?php echo $data->client_display_name ?>';
projectData.client_url = '<?php echo $data->client_url ?>';
projectData.client_logo = '<?php echo $data->client_logo ?>';
projectData.search = eval(<?php echo json_encode($settings->search) ?>);
projectData.layerSpecifics = eval(<?php echo json_encode($settings->layerSpecifics) ?>);
projectData.geoCode = eval(<?php echo json_encode($settings->geoCode) ?>);
projectData.locationServices = eval(<?php echo json_encode($settings->locationServices) ?>);
projectData.gis_projects = eval(<?php echo json_encode($gis_projects) ?>);
projectData.project = '<?php echo $project ?>';
projectData.crs = '<?php echo $qgs->crs ?>';
projectData.title = '<?php echo $qgs->title ?>';
projectData.extent = '<?php echo implode(',',$qgs->extent) ?>';
projectData.layers = eval(<?php echo json_encode($qgs->layers) ?>);
projectData.baseLayers = function () {
var bl = eval(<?php echo json_encode($data->base_layers) ?>);
return bl;
};
projectData.extraLayers = function () {
var el = eval(<?php echo json_encode($data->extra_layers) ?>);
return el;
};
projectData.tablesOnStart = function () {
var t = eval(<?php echo json_encode($data->tables_onstart) ?>);
var tablesOnStart = [];
if (t != null) {
for (var k = 0; k < t.length; k++) {
tablesOnStart.push(t[k]);
}
}
return tablesOnStart;
};
projectData.overViewLayer = function () {
return eval('<?php echo 'new OpenLayers.Layer.'.$data->overview_layer[0]->type.'('.$data->overview_layer[0]->definition.')' ?>');
};
//TODO use in css!
var userLogoImg = projectData.gis_projects.path + 'admin/resources/images/user_gray.png';