/** * create new albums * @param array $details * @return json * */ public function insertNewAlbum($details) { $insert_id = parent::insertNewAlbum($details); if ($insert_id) { return $this->buildAnswer(0, 200, array("success" => 1, "insert_id" => $insert_id)); } return $this->buildAnswer(1, 400, array("success" => 1, "insert_id" => $insert_id)); }
private function checkImages(&$list) { parent::checkAlbumList($list); }
<?php include 'DBController.php'; class AlbumController { function __construct() { } function get_albums() { $db = new DBController(); return $db->get_album(); } } $album = new AlbumController(); while ($row = $album->get_albums()->fetchArray()) { var_dump($row); echo $row['date']; }
echo json_encode($album); }); /***** ADD / UPDATE Album ***/ Flight::route('PUT /albums', function () { $request = Flight::request(); $album_controller = new AlbumController(); $album = json_decode($request->body); if (!isset($album->ID)) { echo json_encode($album_controller->ajouterAlbum($album)); } else { echo json_encode($album_controller->modifierAlbum($album)); } }); /***** Delete Album ***/ Flight::route('DELETE /album/@id', function ($id) { $album_controller = new AlbumController(); $response = $album_controller->deleteAlbum($id); echo json_encode($response); }); /* **************** **************** Tracks **************** */ /***** ADD / UPDATE Track ***/ Flight::route('PUT /tracks', function () { $request = Flight::request(); $Track_controller = new TrackController(); $Track = json_decode($request->body); if ($Track->ID == 'NULL') { echo json_encode($Track_controller->ajouterTrack($Track));
public function __construct() { parent::__construct(); }