From a0759d7c52ed412fca666fa2628a0d026b55182f Mon Sep 17 00:00:00 2001 From: Rello Date: Wed, 1 Feb 2017 21:46:19 +0100 Subject: [PATCH] Add Album selector to controller #132 --- controller/categorycontroller.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/controller/categorycontroller.php b/controller/categorycontroller.php index 922659e5..057ff974 100644 --- a/controller/categorycontroller.php +++ b/controller/categorycontroller.php @@ -113,6 +113,12 @@ private function getCategoryforUser($category){ WHERE AT.`user_id` = ? ORDER BY LOWER(FC.`name`) ASC "; + } elseif ($category === 'Album') { + $SQL="SELECT `id`,`name`, LOWER(`name`) AS `lower` + FROM `*PREFIX*audioplayer_albums` + WHERE `user_id` = ? + ORDER BY LOWER(`name`) ASC + "; } $stmt =$this->db->prepareQuery($SQL); @@ -180,6 +186,14 @@ private function getSongIdsForCategory($category,$categoryId){ WHERE `AT`.`folder_id` = ? AND `AT`.`user_id` = ? ORDER BY LOWER(`AT`.`title`) ASC"; + } elseif ($category === 'Album') { + $SQL="SELECT `AT`.`id` , `AT`.`title` ,`AT`.`number` ,`AT`.`length` ,`AA`.`name` AS `artist`, `AB`.`name` AS `album`,`AT`.`file_id`,LOWER(`AT`.`title`) AS `lower` + FROM `*PREFIX*audioplayer_tracks` `AT` + LEFT JOIN `*PREFIX*audioplayer_artists` `AA` ON `AT`.`artist_id` = `AA`.`id` + LEFT JOIN `*PREFIX*audioplayer_albums` `AB` ON `AT`.`album_id` = `AB`.`id` + WHERE `AB`.`id` = ? + AND `AB`.`user_id` = ? + ORDER BY LOWER(`AT`.`title`) ASC"; } $stmt = $this->db->prepareQuery($SQL);