backup: live-stand vor erstem git-deployment
This commit is contained in:
88
module/googlemaps/show_google_maps.inc.php
Normal file
88
module/googlemaps/show_google_maps.inc.php
Normal file
@@ -0,0 +1,88 @@
|
||||
<?php
|
||||
//Holt hinterlegte Orte als assoziatives Array
|
||||
$sql_places = "SELECT address, description, lat, lng, title FROM google_maps_line WHERE header_id = '" . $sitepart_id."'";
|
||||
$qry_places = mysqli_query($GLOBALS['mysql_con'], $sql_places);
|
||||
IF (mysqli_num_rows($qry_places) == 1) {
|
||||
$places = array();
|
||||
$places[0] = mysqli_fetch_assoc($qry_places);
|
||||
} ELSE {
|
||||
$places = array();
|
||||
$i = 0;
|
||||
WHILE ($row = mysqli_fetch_assoc($qry_places)) {
|
||||
$places[$i] = $row;
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
//Funktionsaufrufe zur Generierung der benötigten Listen
|
||||
$markers = marker_list($places, $sitepart_id);
|
||||
$coordinates = coordinate_list($places);
|
||||
$infos = info_list($places);
|
||||
$openers = info_open_list($places, $sitepart_id);
|
||||
|
||||
|
||||
//Holt Höhe und Breite der Karte als width & height variablen
|
||||
$sql_map = "SELECT width, height, icon_location FROM google_maps_header WHERE id = '" . $sitepart_id."'";
|
||||
$qry_map = mysqli_query($GLOBALS['mysql_con'], $sql_map);
|
||||
$map_size = mysqli_fetch_assoc($qry_map);
|
||||
extract($map_size);
|
||||
|
||||
|
||||
//Generiert Script-Tags, JQuery-Funktion zum Setzen eines neuen meta-tags im Seiten-Header,
|
||||
//Deklariert Optionsvariable und beginnt die Definition der Initialisierungsfunktion
|
||||
$mapcode = "
|
||||
<script type=\"text/javascript\" src=\"//maps.google.com/maps/api/js?sensor=false&key=AIzaSyCaWSVx10NGOpzPoZfIfD197E1RNzMLgcU\"></script>
|
||||
<script type=\"text/javascript\">\n
|
||||
\$('head').append('<meta name=\"viewport\" content=\"initial-scale=1.0, user-scalable=yes\" />');\n
|
||||
var image = '" . $icon_location . "';
|
||||
var bounds = new google.maps.LatLngBounds();
|
||||
var myOptions_" . $sitepart_id . ";\n
|
||||
function initialize_map_" . $sitepart_id . "() {
|
||||
";
|
||||
|
||||
//Generiert Objekte für Koordinaten
|
||||
FOR ($i = 0; $i < count($coordinates); $i++) {
|
||||
$mapcode .= $coordinates[$i];
|
||||
}
|
||||
|
||||
//Definiert Optionen
|
||||
$mapcode .= "\n\t\t" . "myOptions_" . $sitepart_id . " = {
|
||||
\t\t zoom: 8,
|
||||
\t\t center: myLatlng_0,
|
||||
\t\t mapTypeId: google.maps.MapTypeId.ROADMAP,
|
||||
\t\t scrollwheel: false
|
||||
\t}
|
||||
\n\t\t" . "var map_" . $sitepart_id . " = new google.maps.Map(document.getElementById(\"map_canvas_" . $sitepart_id . "\"), myOptions_" . $sitepart_id . ");\n";
|
||||
|
||||
//Generiert Objekte für Info-Boxen
|
||||
FOR ($i = 0; $i < count($infos); $i++) {
|
||||
$mapcode .= $infos[$i];
|
||||
}
|
||||
|
||||
//Generiert Objekte für Marker
|
||||
FOR ($i = 0; $i < count($markers); $i++) {
|
||||
$mapcode .= $markers[$i];
|
||||
}
|
||||
|
||||
//Generiert Event-Listener/Trigger zum Öffnen der Info-Boxen
|
||||
FOR ($i = 0; $i < count($openers); $i++) {
|
||||
$mapcode .= $openers[$i];
|
||||
}
|
||||
|
||||
IF (count($places) > 1) {
|
||||
$mapcode .= "\n\t\t" . "map_" . $sitepart_id . ".fitBounds(bounds);\n";
|
||||
}
|
||||
|
||||
//Schließt Funktionsdefinition. Generiert Listener zum Aufrufen der Initialisierungsfunktion
|
||||
$mapcode .= "} \n google.maps.event.addDomListener(window, 'load', initialize_map_" . $sitepart_id . ");";
|
||||
|
||||
$mapcode .= "</script>";
|
||||
|
||||
echo $mapcode;
|
||||
?>
|
||||
|
||||
<!--<div class="google_maps" class="sitepart_<?= $sitepart_id ?>">-->
|
||||
<div class="googlemaps_content" id="map_canvas_<?= $sitepart_id ?>"
|
||||
style="width: <?= $width ?>px; height: <?= $height ?>px; color: #000000;"></div>
|
||||
<!--</div>-->
|
||||
|
||||
Reference in New Issue
Block a user