From 11fc84b0e9c87581b36172776b7f30c2563f4c83 Mon Sep 17 00:00:00 2001 From: Jonas Heinrich Date: Thu, 16 Feb 2017 13:00:43 +0100 Subject: [PATCH] added db mapper --- appinfo/routes.php | 1 + db/stationmapper.php | 23 +++++++++++++++++++++++ js/main.js | 9 +++++++++ 3 files changed, 33 insertions(+) create mode 100644 db/stationmapper.php diff --git a/appinfo/routes.php b/appinfo/routes.php index c368069..6a2f53c 100644 --- a/appinfo/routes.php +++ b/appinfo/routes.php @@ -6,6 +6,7 @@ */ /** @var $this \OCP\Route\IRouter */ + $this->create('radio_index', '/') ->actionInclude('radio/index.php'); diff --git a/db/stationmapper.php b/db/stationmapper.php new file mode 100644 index 0000000..b9214cb --- /dev/null +++ b/db/stationmapper.php @@ -0,0 +1,23 @@ +findEntity($sql, [$id, $userId]); + } + + public function findAll($userId) { + $sql = 'SELECT * FROM *PREFIX*ownnotes_notes WHERE user_id = ?'; + return $this->findEntities($sql, [$userId]); + } + +} diff --git a/js/main.js b/js/main.js index 58420ef..d783d05 100644 --- a/js/main.js +++ b/js/main.js @@ -43,6 +43,15 @@ $(function(){ } function get_station_ids(){ + $.ajax({ + method: "GET", + url: "http://127.0.0.1/index.php/apps/radio/stations", + dataType: 'json', + success: function(data) { + alert(data); + return true; + } + }); return ["89920","44707","91101","85755","45281","78011","91102"] };