diff --git a/web/API/stations.php b/web/API/stations.php index b8a981d..8e2401b 100644 --- a/web/API/stations.php +++ b/web/API/stations.php @@ -48,4 +48,23 @@ } return $res; + } + + function add($params) { + $stations = new \wsos\database\core\table(\DAL\station::class); + + $myStation = new \DAL\station(); + $myStation->name->set($params["name"]); + $myStation->description->set($params["description"]); + $myStation->locator->set([ + "gps" => [ + "lat" => floatval($params["lat"]), + "lon" => floatval($params["lon"]), + "alt" => floatval($params["alt"]) + ] + ]); + + $myStation->commit(); + + return ["id" => $myStation->id->get()]; } \ No newline at end of file diff --git a/web/VIEWS/dashboard.html b/web/VIEWS/dashboard.html index aed49e9..f94edf6 100644 --- a/web/VIEWS/dashboard.html +++ b/web/VIEWS/dashboard.html @@ -134,6 +134,9 @@