diff --git a/Web/Models/Entities/Audio.php b/Web/Models/Entities/Audio.php index 3b998f32..23941f4c 100644 --- a/Web/Models/Entities/Audio.php +++ b/Web/Models/Entities/Audio.php @@ -147,6 +147,11 @@ class Audio extends Media return $this->getRecord()->performer; } + function getPerformers(): array + { + return explode(", ", $this->getRecord()->performer); + } + function getName(): string { return $this->getPerformer() . " — " . $this->getTitle(); diff --git a/Web/Models/Repositories/Audios.php b/Web/Models/Repositories/Audios.php index 73f5ac29..1b8b174d 100644 --- a/Web/Models/Repositories/Audios.php +++ b/Web/Models/Repositories/Audios.php @@ -248,15 +248,17 @@ class Audios { $query = "%$query%"; $result = $this->audios->where([ - "unlisted" => 0, - "deleted" => 0, + "unlisted" => 0, + "deleted" => 0, + /*"withdrawn" => 0, + "processed" => 1,*/ ]); $order_str = (in_array($order['type'], ['id', 'length', 'listens']) ? $order['type'] : 'id') . ' ' . ($order['invert'] ? 'ASC' : 'DESC');; if($params["only_performers"] == "1") { $result->where("performer LIKE ?", $query); } else { - $result->where("name LIKE ? OR performer LIKE ?", $query, $query); + $result->where("CONCAT_WS(' ', performer, name) LIKE ?", $query); } foreach($params as $paramName => $paramValue) { diff --git a/Web/Presenters/AudioPresenter.php b/Web/Presenters/AudioPresenter.php index ae38d1d0..796e91f0 100644 --- a/Web/Presenters/AudioPresenter.php +++ b/Web/Presenters/AudioPresenter.php @@ -779,16 +779,21 @@ final class AudioPresenter extends OpenVKPresenter $audiosArr = []; foreach($audios as $audio) { - $audiosArr[] = [ - "id" => $audio->getId(), - "name" => $audio->getTitle(), - "performer" => $audio->getPerformer(), - "keys" => $audio->getKeys(), - "url" => $audio->getUrl(), - "length" => $audio->getLength(), - "available" => $audio->isAvailable(), - "withdrawn" => $audio->isWithdrawn(), - ]; + $output_array = []; + $output_array['id'] = $audio->getId(); + $output_array['name'] = $audio->getTitle(); + $output_array['performer'] = $audio->getPerformer(); + + if(!$audio->isWithdrawn() && $audio->isAvailable()) { + $output_array['keys'] = $audio->getKeys(); + $output_array['url'] = $audio->getUrl(); + } + + $output_array['length'] = $audio->getLength(); + $output_array['available'] = $audio->isAvailable(); + $output_array['withdrawn'] = $audio->isWithdrawn(); + + $audiosArr[] = $output_array; } $resultArr = [ diff --git a/Web/Presenters/templates/@layout.xml b/Web/Presenters/templates/@layout.xml index 0e514bb8..ce6c080c 100644 --- a/Web/Presenters/templates/@layout.xml +++ b/Web/Presenters/templates/@layout.xml @@ -20,7 +20,6 @@ {script "js/utils.js"} {script "js/node_modules/dashjs/dist/dash.all.min.js"} - {script "js/al_music.js"} {css "js/node_modules/tippy.js/dist/backdrop.css"} {css "js/node_modules/cropperjs/dist/cropper.css"} @@ -392,6 +391,7 @@ {script "js/al_suggestions.js"} {script "js/al_navigation.js"} {script "js/al_comments.js"} + {script "js/al_music.js"} {ifset $thisUser} {script "js/al_notifs.js"} diff --git a/Web/Presenters/templates/Audio/List.xml b/Web/Presenters/templates/Audio/List.xml index 32d2e26b..19496114 100644 --- a/Web/Presenters/templates/Audio/List.xml +++ b/Web/Presenters/templates/Audio/List.xml @@ -54,18 +54,24 @@ {include "bigplayer.xml"} - - - -
+
-
-
+
+
{include "../components/content_error.xml", description => $ownerId > 0 ? ($ownerId == $thisUser->getId() ? tr("no_audios_thisuser") : tr("no_audios_user")) : tr("no_audios_club")}
-
-
+
+
{include "player.xml", audio => $audio, club => $club}
@@ -81,12 +87,12 @@
-
+
{include "../components/content_error.xml", description => $ownerId > 0 ? ($ownerId == $thisUser->getId() ? tr("no_playlists_thisuser") : tr("no_playlists_user")) : tr("no_playlists_club")}
-
+
{include 'playlistListView.xml', playlist => $playlist}
diff --git a/Web/Presenters/templates/Audio/Playlist.xml b/Web/Presenters/templates/Audio/Playlist.xml index 7f8c7348..5a96ad6c 100644 --- a/Web/Presenters/templates/Audio/Playlist.xml +++ b/Web/Presenters/templates/Audio/Playlist.xml @@ -32,8 +32,14 @@ {block content} {include "bigplayer.xml"} + -
{if $cover} diff --git a/Web/Presenters/templates/Audio/bigplayer.xml b/Web/Presenters/templates/Audio/bigplayer.xml index 6ae6326d..44f7bfd0 100644 --- a/Web/Presenters/templates/Audio/bigplayer.xml +++ b/Web/Presenters/templates/Audio/bigplayer.xml @@ -1,56 +1,56 @@
-