added db mapper
This commit is contained in:
parent
47c5f63c1d
commit
11fc84b0e9
@ -6,6 +6,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/** @var $this \OCP\Route\IRouter */
|
/** @var $this \OCP\Route\IRouter */
|
||||||
|
|
||||||
$this->create('radio_index', '/')
|
$this->create('radio_index', '/')
|
||||||
->actionInclude('radio/index.php');
|
->actionInclude('radio/index.php');
|
||||||
|
|
||||||
|
23
db/stationmapper.php
Normal file
23
db/stationmapper.php
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
<?php
|
||||||
|
namespace OCA\Radio\Db;
|
||||||
|
|
||||||
|
use OCP\IDb;
|
||||||
|
use OCP\AppFramework\Db\Mapper;
|
||||||
|
|
||||||
|
class StationMapper extends Mapper {
|
||||||
|
|
||||||
|
public function __construct(IDb $db) {
|
||||||
|
parent::__construct($db, 'radio_stations', '\OCA\Radio\Db\Station');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function find($id, $userId) {
|
||||||
|
$sql = 'SELECT * FROM *PREFIX*ownnotes_notes WHERE id = ? AND user_id = ?';
|
||||||
|
return $this->findEntity($sql, [$id, $userId]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function findAll($userId) {
|
||||||
|
$sql = 'SELECT * FROM *PREFIX*ownnotes_notes WHERE user_id = ?';
|
||||||
|
return $this->findEntities($sql, [$userId]);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -43,6 +43,15 @@ $(function(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
function get_station_ids(){
|
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"]
|
return ["89920","44707","91101","85755","45281","78011","91102"]
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user