-
-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Google Maps für Einsatzorte #114
base: develop
Are you sure you want to change the base?
Changes from 7 commits
4aa6001
05ea58c
b53409e
1eae76f
abff043
43f3878
9e871c2
1548271
a4129e1
7db9342
dce2881
1933af4
0c22b7d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -75,6 +75,9 @@ public static function getMetaFields() | |
'einsatz_einsatzort' => array( | ||
'label' => 'Einsatzort' | ||
), | ||
'einsatz_location' => array( | ||
'label' => 'Goolemaps Position' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Google legt wert auf eine korrekte Schreibweise der Produkte: |
||
), | ||
'einsatz_einsatzleiter' => array( | ||
'label' => 'Einsatzleiter' | ||
), | ||
|
@@ -194,6 +197,16 @@ public function getLocation() | |
return $this->getPostMeta('einsatz_einsatzort'); | ||
} | ||
|
||
/** | ||
* Gibt den eingetragenen Einsatzort als googlemaps koordinate zurück | ||
* | ||
* @return string | ||
*/ | ||
public function getGmapsLocation() | ||
{ | ||
return $this->getPostMeta('einsatz_location'); | ||
} | ||
|
||
/** | ||
* Gibt die Einsatznummer zurück | ||
* | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -138,6 +138,15 @@ public function enqueueEditScripts($hook) | |
array(), | ||
Core::VERSION | ||
); | ||
|
||
if($this->options->isGMapActivate()) | ||
{ | ||
wp_enqueue_script( 'einsatzvw_GoogleMap' ); | ||
wp_enqueue_script( | ||
'einsatzverwaltung-gmap', | ||
$this->core->scriptUrl . 'einsatzverwaltung-gmaps.js' | ||
); | ||
} | ||
} | ||
|
||
/** | ||
|
@@ -188,10 +197,11 @@ public function displayMetaBoxEinsatzdetails($post) | |
$einsatzort = $report->getLocation(); | ||
$einsatzleiter = $report->getIncidentCommander(); | ||
$mannschaftsstaerke = $report->getWorkforce(); | ||
$gmapslocation = $report->getGmapsLocation(); | ||
|
||
$names = Data::getEinsatzleiterNamen(); | ||
echo '<input type="hidden" id="einsatzleiter_used_values" value="' . implode(',', $names) . '" />'; | ||
echo '<table><tbody>'; | ||
echo '<table style="width: 100%;"><tbody>'; | ||
|
||
if ($this->options->isAutoIncidentNumbers()) { | ||
echo '<tr><td>Einsatznummer</td><td>' . esc_html($nummer) . '</td></tr>'; | ||
|
@@ -227,6 +237,11 @@ public function displayMetaBoxEinsatzdetails($post) | |
esc_attr($einsatzort) | ||
); | ||
|
||
if($this->options->isGMapActivate()) | ||
{ | ||
$this->echoGMap($gmapslocation); | ||
} | ||
|
||
$this->echoInputText( | ||
'Einsatzleiter', | ||
'einsatzverwaltung_einsatzleiter', | ||
|
@@ -261,6 +276,34 @@ private function echoInputText($label, $name, $value, $placeholder = '', $size = | |
echo '/></td></tr>'; | ||
} | ||
|
||
/** | ||
* Generiert eine Googlemaps Karte zur bestimmung der Koordinate | ||
*/ | ||
private function echoGMap($location) | ||
{ | ||
if($location != "") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Wäre |
||
{ | ||
$latLon = explode(",",$location); | ||
} | ||
else | ||
{ | ||
$latLon = explode(",",$this->options->getGMapDefaultPos()); | ||
} | ||
|
||
echo '<tr><td>'; | ||
echo '<label for="einsatzverwaltung_location">Koordinate</label>'; | ||
echo '</td><td style="width: 100%;">'; | ||
echo '<input type="text" id="einsatzverwaltung_location" name="einsatzverwaltung_location" value="' . $location . '" size="20" readonly/>'; | ||
echo '<a class="button" id="einsatzverwaltung_get_location" onClick="geocodeAddress(document.getElementById(\'einsatzverwaltung_einsatzort\').value , \'einsatzverwaltung_location\')"><i class="fa fa-map-marker"></i></a>'; | ||
echo '</td></tr>'; | ||
echo '<tr><td colspan="2">'; | ||
echo '<div id="map-canvas" style="height: 400px;"></div>'; | ||
echo '</td></tr>'; | ||
echo '<script>'; | ||
echo ' google.maps.event.addDomListener(window, "load", initializeMap(' . $latLon[0] . ', ' . $latLon[1] . '));'; | ||
echo '</script>'; | ||
} | ||
|
||
/** | ||
* Gibt eine Checkbox für die Metabox aus | ||
* | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Eine Methode (
isGMapActivate()
), die danktoBoolean()
immer einen Boolean zurückliefert, auf einen leeren String prüfen?