diff --git a/Web/Presenters/AudioPresenter.php b/Web/Presenters/AudioPresenter.php index 796e91f0..ab020563 100644 --- a/Web/Presenters/AudioPresenter.php +++ b/Web/Presenters/AudioPresenter.php @@ -97,9 +97,12 @@ final class AudioPresenter extends OpenVKPresenter $this->template->club = $owner < 0 ? $entity : NULL; $this->template->isMy = ($owner > 0 && ($entity->getId() === $this->user->id)); $this->template->isMyClub = ($owner < 0 && $entity->canBeModifiedBy($this->user->identity)); - } else { - $audios = $this->audios->getPopular(); - $audiosCount = $audios->size(); + } else if ($mode === 'alone_audio') { + $audios = [$this->template->alone_audio]; + $audiosCount = 1; + + $this->template->owner = $this->user->identity; + $this->template->ownerId = $this->user->id; } // $this->renderApp("owner=$owner"); @@ -271,6 +274,19 @@ final class AudioPresenter extends OpenVKPresenter } } + function renderAloneAudio(int $owner_id, int $audio_id): void + { + $this->assertUserLoggedIn(); + + $found_audio = $this->audios->get($audio_id); + if(!$found_audio || $found_audio->isDeleted() || !$found_audio->canBeViewedBy($this->user->identity)) { + $this->notFound(); + } + + $this->template->alone_audio = $found_audio; + $this->renderList(NULL, 'alone_audio'); + } + function renderListen(int $id): void { if ($_SERVER["REQUEST_METHOD"] === "POST") { @@ -762,6 +778,15 @@ final class AudioPresenter extends OpenVKPresenter $audios = $stream->page($page, 10); $audiosCount = $stream->size(); break; + case 'alone_audio': + $found_audio = $this->audios->get($ctx_id); + if(!$found_audio || $found_audio->isDeleted() || !$found_audio->canBeViewedBy($this->user->identity)) { + $this->flashFail("err", "Error", "Not found", 89, true); + } + + $audios = [$found_audio]; + $audiosCount = 1; + break; } $pagesCount = ceil($audiosCount / $perPage); diff --git a/Web/Presenters/templates/Audio/List.xml b/Web/Presenters/templates/Audio/List.xml index 19496114..8cc0a436 100644 --- a/Web/Presenters/templates/Audio/List.xml +++ b/Web/Presenters/templates/Audio/List.xml @@ -11,6 +11,8 @@ {_audio_new} {elseif $mode == 'popular'} {_audio_popular} + {elseif $mode == 'alone_audio'} + {$alone_audio->getName()} {else} {if $ownerId > 0} {_playlists} {$owner->getMorphedName("genitive", false)} @@ -47,6 +49,10 @@ » {if $isMy}{_my_playlists}{else}{_playlists}{/if} + +
+ {_my_audios_small} +
{/block} {block content} @@ -62,6 +68,12 @@ entity_id: {$ownerId}, page: {$page} } + {elseif $mode == 'alone_audio'} + window.__current_page_audio_context = { + name: 'alone_audio', + entity_id: {$alone_audio->getId()}, + page: 1 + } {/if} diff --git a/Web/Presenters/templates/Audio/bigplayer.xml b/Web/Presenters/templates/Audio/bigplayer.xml index 44f7bfd0..fcda029a 100644 --- a/Web/Presenters/templates/Audio/bigplayer.xml +++ b/Web/Presenters/templates/Audio/bigplayer.xml @@ -1,4 +1,4 @@ -
+
diff --git a/Web/Presenters/templates/Audio/player.xml b/Web/Presenters/templates/Audio/player.xml index 2dc9a709..75bf78b9 100644 --- a/Web/Presenters/templates/Audio/player.xml +++ b/Web/Presenters/templates/Audio/player.xml @@ -3,7 +3,7 @@ {php $isAvailable = $audio->isAvailable()} {php $performers = $audio->getPerformers()} {php $editable = isset($thisUser) && $audio->canBeModifiedBy($thisUser)} -
+