Permalink
Browse files

Show marker

  • Loading branch information...
1 parent e5fd014 commit f211b33d94ce8d8c1ae3e5e3f30edfe818a46213 @silsha committed May 14, 2012
Showing with 40 additions and 7 deletions.
  1. +11 −1 bronielocator.php
  2. +4 −1 index.html
  3. +25 −5 js/ponytime.js
  4. BIN static/arrow.png
View
@@ -3,7 +3,17 @@
mysql_connect("localhost", "ponytime", "PASSWORD") or die ("Fehler 1337: Keine Verbindung zur Datenbank möglich.");
mysql_select_db("ponytime") or die ("Fehler 2342: DB-Fehler.");
-$qry = mysql_query("SELECT * FROM places");
+$swlat = $_GET['swlat'];
+$swlng = $_GET['swlng'];
+$nelat = $_GET['nelat'];
+$nelng = $_GET['nelng'];
+
+
+if(isset($swlat, $swlng, $nelat, $swlng)){
+ $qry = mysql_query("SELECT * FROM places WHERE lat > $swlat AND lat < $nelat AND log < $nelng AND log > $swlng");
+}else{
+ $qry = mysql_query("SELECT * FROM places");
+}
while($row = mysql_fetch_object($qry))
{
$json[$row->id]['name'] = $row->name;
View
@@ -35,8 +35,11 @@
<div id="map">
</div>
+ <div id="list">
+ </div>
+
<div id="footer">
- <p>Bla bla bla</p>
+ <p></p>
</div>
</div>
<script type="text/javascript" src="js/ponytime.js"></script>
View
@@ -2,17 +2,16 @@ var bronies = (function() {
var self = this;
var map;
- var getViewerLocation = function(maps) {
+ var getViewerLocation = function() {
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(function(position) {
var pos = new google.maps.LatLng(position.coords.latitude, position.coords.longitude);
- maps.panTo(pos);
- maps.setZoom(11);
-
+ map.panTo(pos);
+ map.setZoom(11);
var dot = "static/dot.png";
var marker = new google.maps.Marker({
position: pos,
- map: maps,
+ map: map,
title: "Deine Position",
icon: dot
});
@@ -32,8 +31,29 @@ var bronies = (function() {
alert("Fehler: " + status);
}
});
+ bronies.getPonytimes;
return false;
}
+
+ self.getPonytimes = function(){
+ var bounds = map.getBounds();
+ $.ajax({
+ type: "GET",
+ //url: "/bronielocator/",
+ url: "/bronielocator/",
+ data: {
+ swlat: bounds.getSouthWest().lat(),
+ swlng: bounds.getSouthWest().lng(),
+ nelat: bounds.getNorthEast().lat(),
+ nelng: bounds.getNorthEast().lng()
+ }
+ }).done(function(msg){
+ document.getElementById('list').innerHTML = '';
+ $.each(msg, function(index, value){
+ document.getElementById('list').innerHTML += '<div id="' + index + '"><h2>' + value.name + '</h2><b>Webseite:</b> <a href="'+ value.url +'">'+ value.url +'</a></div>';
+ })
+ });
+ }
self.init = function() {
var geocoder = new google.maps.Geocoder();
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit f211b33

Please sign in to comment.