From f51acb42d68e8d5f1e365c1cd8c0b14ced1bcb82 Mon Sep 17 00:00:00 2001 From: Sundog Date: Mon, 6 May 2024 12:40:50 -0400 Subject: [PATCH] initial work on admin/POI functionality - list all and create implemented --- src/webserver/admin/pois.php | 109 +++++++++++++++++++++++++++++++++++ 1 file changed, 109 insertions(+) create mode 100644 src/webserver/admin/pois.php diff --git a/src/webserver/admin/pois.php b/src/webserver/admin/pois.php new file mode 100644 index 0000000..a5bd1da --- /dev/null +++ b/src/webserver/admin/pois.php @@ -0,0 +1,109 @@ + + + +

Wander Admin

+ +

Points of Interest

+ +

Create New Point of Interest

+ + + + + + + + + + + + + + +query('SELECT * FROM POIs'); + while ($row = $results->fetchArray()) { + ?> + + + + + + + + + + + +
IDNameDescriptionActive?LatitudeLongitudeRadiusMap Marker
'>
+ + +

Create a New Point of Interest

+ +
+ +

+

+

+

+

+

+

+

+
+ +prepare('INSERT INTO POIs (name, description, latitude, longitude, radius, is_active, map_marker_icon) VALUES (:name, :description, :latitude, :longitude, :radius, :is_active, :map_marker_icon)'); + if ($stmt) { + $stmt->bindValue(':name', $_POST['name'], SQLITE3_TEXT); + $stmt->bindValue(':description', $_POST['description'], SQLITE3_TEXT); + $stmt->bindValue(':latitude', $_POST['latitude'], SQLITE3_FLOAT); + $stmt->bindValue(':longitude', $_POST['longitude'], SQLITE3_FLOAT); + $stmt->bindValue(':radius', empty($_POST['radius']) ? 25 : $_POST['radius']); + $stmt->bindValue(':is_active', $_POST['is_active'] === "on" ? 1 : 0, SQLITE3_INTEGER); + $stmt->bindValue(':map_marker_icon', $_POST['map_marker_icon'], SQLITE3_TEXT); + $result = $stmt->execute(); + if ($result) { + echo "

Record created. < back to Points of Interest

\n"; + } else { + echo "

OOPS! There was a problem adding the new point of interest!

\n"; + } + } else { + echo "

OOPS! There was a problem adding the new point of interest!!

\n"; + } + } else { + echo "Name, Latitude, Longitude are required - please go back and try again\n"; + } + break; + case 'edit': + case 'update': + case 'delete': + default: + echo "Unknown action: " . $_GET['action']; + } + } + +?> + +

< back to Admin

+ +