Skip to content

Commit

Permalink
Make the title a hyperlink if node is tagged with website and update …
Browse files Browse the repository at this point in the history
…the symbol finder to include tourism and shops.
  • Loading branch information
tcort committed Apr 24, 2010
1 parent ca5cb90 commit 5860f4f
Showing 1 changed file with 39 additions and 2 deletions.
41 changes: 39 additions & 2 deletions www/classes/POIManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,43 @@ public function getValue($node_id, $key) {
}
}

public function getWebsite($node_id) {
$website = $this->getValue($node_id, "website");
if (strcmp("http://",substr($website,0,7))) {
$website = "http://" . $website;
}
return $website;
}

public function getName($node_id) {
$name = $this->getValue($node_id, "name");
$website = $this->getWebsite($node_id);
if (!strcmp($website,"http://Unknown")) {
return $name;
} else {
return "<a href=\"" . $website . "\">" . $name . "</a>";
}
}

public function getSymbol($node_id) {
$sym = $this->getValue($node_id, "amenity");
if (strcmp($sym, "Unknown")) {
return $sym;
}

$sym = $this->getValue($node_id, "tourism");
if (strcmp($sym, "Unknown")) {
return $sym;
}

$sym = $this->getValue($node_id, "shop");
if (strcmp($sym, "Unknown")) {
return $sym;
}

return $sym;
}

public function getWpts($min_lat, $max_lat, $min_lon, $max_lon, $zoom) {
$sql = "SELECT id, lat, lon FROM node WHERE lat BETWEEN '" . $this->db->escape($min_lat) . "' AND '" . $this->db->escape($max_lat) . "' AND lon BETWEEN '" . $this->db->escape($min_lon) . "' AND '" . $this->db->escape($max_lon) . "' AND zoom <= '" . $this->db->escape($zoom) . " ORDER BY RAND() LIMIT 500';";
$result = $this->db->query($sql);
Expand All @@ -66,9 +103,9 @@ public function getWpts($min_lat, $max_lat, $min_lon, $max_lon, $zoom) {
while ($result->hasNext()) {
$row = $result->next();
$wpt = new wpt($row[1],$row[2]);
$wpt->setName($this->getValue($row[0], "name"));
$wpt->setName($this->getName($row[0]));
$wpt->setDesc("");
$wpt->setSym($this->getValue($row[0], "amenity"));
$wpt->setSym($this->getSymbol($row[0]));

$gpx->addWpt($wpt);
}
Expand Down

0 comments on commit 5860f4f

Please sign in to comment.