-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathbs_surveys.js.php
executable file
·77 lines (72 loc) · 2.07 KB
/
bs_surveys.js.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
<?php
ob_start();
require_once "include/flatnux.php";
require_once "modules/dbview/FNDBVIEW.php";
/*
$Tablerilievi=FN_XmlForm("ctl_surveys");
$rilievi=$Tablerilievi->xmltable->GetRecords();
*/
$params = array();
$tablename = "ctl_surveys";
$mod_survey = "survey";
$title = FN_Translate("surveys");
$table_link = "codecave";
if (!empty($_GET['t']) && $_GET['t'] == "artificials")
{
$tablename = "ctl_surveys_artificials";
$mod_survey = "survey_artificials";
$title = $title . " art";
$table_link = "codeartificial";
}
if (!empty($_GET['t']) && $_GET['t'] == "areas")
{
$tablename = "ctl_areas";
$mod_survey = "areas";
$title = $title . " aree";
$table_link = "code";
}
$Tablerilievi = FN_XmlForm($tablename);
$config = FN_LoadConfig("modules/dbview/config.php", "$mod_survey");
$dbview = new FNDBVIEW($config);
$params['fields'] = "id,filekml,$table_link";
$rilievi = $dbview->GetResults($config, $params);
while (false !== @ob_end_clean()
);
ob_start();
header('Access-Control-Allow-Origin: *');
header('Content-type: application/javascript');
$kml = array();
$visible = "false";
if (isset($_GET['mod']) && $_GET['mod'] == "caves" && $tablename == "ctl_surveys")
$visible = "true";
if (isset($_GET['mod']) && $_GET['mod'] == "artificials" && $tablename == "ctl_surveys_artificials")
$visible = "true";
if (isset($_GET['mod']) && $_GET['mod'] == "areas" && $tablename == "ctl_areas")
$visible = "true";
$visible = "false";
if (is_array($rilievi))
{
$i = 1;
foreach ($rilievi as $rilievo)
{
if (!empty($rilievo['filekml']))
{
$km = $Tablerilievi->xmltable->get_file($rilievo, 'filekml');
//(title, path, isBaselayer, visible, showPointNames, searchable, layergroup)
echo "\nOPS_Map.addKmlLayer(\"ril_{$i}_{$rilievo[$table_link]}\", \"$km\", false, $visible,false,false,'" . $title . "');";
}
$i++;
}
}
?>
OPS_Map.addLayerSwitcher();
<?php
$str = ob_get_clean();
if ($_FN['enable_compress_gzip'])
{
header("Content-Encoding: gzip");
die(gzencode($str));
}
else
die($str);
?>