|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/* |
|
4
|
|
|
* ****************************************************************************** |
|
5
|
|
|
* Copyright 2011-2017 DANTE Ltd. and GÉANT on behalf of the GN3, GN3+, GN4-1 |
|
6
|
|
|
* and GN4-2 consortia |
|
7
|
|
|
* |
|
8
|
|
|
* License: see the web/copyright.php file in the file structure |
|
9
|
|
|
* ****************************************************************************** |
|
10
|
|
|
*/ |
|
11
|
|
|
|
|
12
|
|
|
namespace web\lib\admin; |
|
13
|
|
|
|
|
14
|
|
|
require_once(dirname(dirname(dirname(dirname(__FILE__)))) . "/config/_config.php"); |
|
15
|
|
|
|
|
16
|
|
|
/** |
|
17
|
|
|
* This class provides map display functionality |
|
18
|
|
|
* |
|
19
|
|
|
* @author Stefan Winter <[email protected]> |
|
20
|
|
|
*/ |
|
21
|
|
|
class MapNone extends AbstractMap { |
|
22
|
|
|
|
|
23
|
|
|
public function __construct($inst, $readonly) { |
|
24
|
|
|
parent::__construct($inst, $readonly); |
|
25
|
|
|
return $this; |
|
26
|
|
|
} |
|
27
|
|
|
|
|
28
|
|
|
public function htmlHeadCode() { |
|
29
|
|
|
// no magic required if you want to nothing at all. |
|
30
|
|
|
return "<script> |
|
31
|
|
|
function locateMe() { |
|
32
|
|
|
navigator.geolocation.getCurrentPosition(locate_succes,locate_fail,{maximumAge:3600000, timeout:5000}); |
|
33
|
|
|
} |
|
34
|
|
|
|
|
35
|
|
|
function locate_succes(p) { |
|
36
|
|
|
$('#geo_long').val(p.coords.longitude); |
|
37
|
|
|
$('#geo_lat').val(p.coords.latitude); |
|
38
|
|
|
} |
|
39
|
|
|
function locate_fail(p) { |
|
40
|
|
|
alert('failure: '+p.message); |
|
41
|
|
|
} |
|
42
|
|
|
</script> |
|
43
|
|
|
"; |
|
44
|
|
|
} |
|
45
|
|
|
|
|
46
|
|
|
public function htmlBodyCode() { |
|
47
|
|
|
// no magic required if you want to nothing at all. |
|
48
|
|
|
return ""; |
|
49
|
|
|
} |
|
50
|
|
|
|
|
51
|
|
|
public function htmlShowtime($wizard = FALSE, $additional = FALSE) { |
|
52
|
|
|
if (!$this->readOnly) { |
|
53
|
|
|
// return $this->htmlPreEdit($wizard, $additional) . $this->htmlPostEdit(TRUE); |
|
54
|
|
|
return $this->htmlPreEdit($wizard, $additional) . $this->findLocationHtml() . $this->htmlPostEdit(TRUE); |
|
55
|
|
|
} |
|
56
|
|
|
} |
|
57
|
|
|
|
|
58
|
|
|
public function bodyTagCode() { |
|
59
|
|
|
return ""; |
|
60
|
|
|
} |
|
61
|
|
|
|
|
62
|
|
|
public static function optionListDisplayCode($coords, $number) { |
|
63
|
|
|
$pair = json_decode($coords, true); |
|
64
|
|
|
return "<table><tr><td>Latitude</td><td><strong>" . $pair['lat'] . "</strong></td></tr><tr><td>Longitude</td><td><strong>" . $pair['lon'] . "</strong></td></tr></table>"; |
|
65
|
|
|
} |
|
66
|
|
|
private function findLocationHtml() { |
|
67
|
|
|
return "<button type='button' onclick='locateMe()'>" . _("Locate Me!") . "</button></p>"; |
|
68
|
|
|
} |
|
69
|
|
|
} |
|
70
|
|
|
|