Exemplo n.º 1
0
                DML::saveLayerProperties($_REQUEST["layerName"], $layerProperties);
            }
            GUI::printMessage("%s", GUI::createLayerScreen($_REQUEST["layerName"]));
            break;
        case "poi":
            $poi = DML::getPOI($_REQUEST["layerName"], $_REQUEST["poiID"]);
            if (empty($poi)) {
                throw new Exception(sprintf("POI not found: %s:%s", $_REQUEST["layerName"], $_REQUEST["poiID"]));
            }
            GUI::printMessage("%s", GUI::createPOIScreen($_REQUEST["layerName"], $poi));
            break;
        case "newPOI":
            GUI::printMessage("%s", GUI::createNewPOIScreen($_REQUEST["layerName"]));
            break;
        case "migrate":
            GUI::printMessage("%s", GUI::createMigrationScreen());
            break;
        default:
            throw new Exception(sprintf("Invalid action: %s", $_action));
    }
} catch (Exception $e) {
    GUI::printError("%s", $e->getMessage());
    GUI::printMessage("%s", GUI::createMainScreen());
}
exit;
$pois = DML::getPOIs("example");
printf("<table>\n");
foreach ($pois as $poi) {
    printf("<tr><td>%s</td><td>%s,%s</td></tr>\n", $poi->title, $poi->lat, $poi->lon);
}
printf("</table>");
Exemplo n.º 2
0
 /**
  * Create a list of POIs for a layer
  *
  * @param string $layerName
  *
  * @return string
  */
 public static function createPOITable($layerName)
 {
     $result = "";
     $pois = DML::getPOIs($layerName);
     if ($pois === NULL || $pois === FALSE) {
         throw new Exception("Error retrieving POIs");
     }
     $result .= "<table class=\"pois\">\n";
     $result .= "<tr><th>Title</th><th>&nbsp;</th></tr>\n";
     foreach ($pois as $poi) {
         $result .= "<tr>\n";
         $result .= sprintf("<td><a href=\"?action=poi&layerName=%s&poiID=%s\">%s</a></td>\n", urlencode($layerName), urlencode($poi->id), $poi->text->title ? $poi->text->title : "&lt;no title&gt;");
         $result .= sprintf("<td><form accept-charset=\"utf-8\" action=\"?action=deletePOI\" method=\"POST\"><input type=\"hidden\" name=\"layerName\" value=\"%s\"><input type=\"hidden\" name=\"poiID\" value=\"%s\"><button type=\"submit\">Delete</button></form></td>\n", urlencode($layerName), urlencode($poi->id));
         $result .= "</tr>\n";
     }
     $result .= "</table>\n";
     return $result;
 }