AzuraCast/templates/stations/profile/index.phtml

137 lines
5.0 KiB
PHTML

<?php
/**
* @var App\Entity\Station $station
* @var \App\Assets $assets
*/
$this->layout(
'main',
[
'title' => __('Profile'),
'manual' => true,
'sidebar_tab' => 'profile',
]
);
$frontendConfig = $station->getFrontendConfig();
$props = [
// Common
'backendType' => $station->getBackendType(),
'frontendType' => $station->getFrontendType(),
'stationSupportsRequests' => $backend->supportsRequests(),
'stationSupportsStreamers' => $backend->supportsStreamers(),
'enableRequests' => $station->getEnableRequests(),
'enableStreamers' => $station->getEnableStreamers(),
'enablePublicPage' => $station->getEnablePublicPage(),
'enableOnDemand' => $station->getEnableOnDemand(),
'profileApiUri' => $router->fromHere('api:stations:profile'),
// ACL
'userCanManageMedia' => $acl->isAllowed(App\Acl::STATION_MEDIA, $station->getId()),
'userCanManageBroadcasting' => $acl->isAllowed(App\Acl::STATION_BROADCASTING, $station->getId()),
'userCanManageProfile' => $acl->isAllowed(App\Acl::STATION_PROFILE, $station->getId()),
'userCanManageReports' => $acl->isAllowed(App\Acl::STATION_REPORTS, $station->getId()),
'userCanManageStreamers' => $acl->isAllowed(App\Acl::STATION_STREAMERS, $station->getId()),
// Header
'stationName' => $station->getName(),
'stationDescription' => $station->getDescription(),
'manageProfileUri' => $router->fromHere('stations:profile:edit'),
// Now Playing
'backendSkipSongUri' => $router->fromHere('api:stations:backend', ['do' => 'skip']),
'backendDisconnectStreamerUri' => $router->fromHere('api:stations:backend', ['do' => 'disconnect']),
// Requests
'requestsViewUri' => $router->fromHere('stations:reports:requests'),
'requestsToggleUri' => $router->fromHere('stations:profile:toggle', ['feature' => 'requests', 'csrf' => $csrf]),
// Streamers
'streamersViewUri' => $router->fromHere('stations:streamers:index'),
'streamersToggleUri' => $router->fromHere('stations:profile:toggle', ['feature' => 'streamers', 'csrf' => $csrf]),
// Public Pages
'publicPageUri' => (string)$router->named('public:index', ['station_id' => $station->getShortName()], [], true),
'publicPageEmbedUri' => (string)$router->named(
'public:index',
['station_id' => $station->getShortName(), 'embed' => 'embed'],
[],
true
),
'publicWebDjUri' => (string)$router->named('public:dj', ['station_id' => $station->getShortName()], [], true),
'publicOnDemandUri' => (string)$router->named(
'public:ondemand',
['station_id' => $station->getShortName()],
[],
true
),
'publicPodcastsUri' => (string)$router->named(
'public:podcasts',
['station_id' => $station->getShortName()],
[],
true
),
'publicScheduleUri' => (string)$router->named(
'public:schedule',
['station_id' => $station->getShortName()],
[],
true
),
'publicOnDemandEmbedUri' => (string)$router->named(
'public:ondemand',
['station_id' => $station->getShortName(), 'embed' => 'embed'],
[],
true
),
'publicRequestEmbedUri' => (string)$router->named(
'public:embedrequests',
['station_id' => $station->getShortName()],
[],
true
),
'publicHistoryEmbedUri' => (string)$router->named(
'public:history',
['station_id' => $station->getShortName()],
[],
true
),
'publicScheduleEmbedUri' => (string)$router->named(
'public:schedule',
['station_id' => $station->getShortName(), 'embed' => 'embed'],
[],
true
),
'togglePublicPageUri' => $router->fromHere(
'stations:profile:toggle',
['feature' => 'public', 'csrf' => $csrf]
),
// Frontend
'frontendAdminUri' => (string)$frontend->getAdminUrl($station, $router->getBaseUrl()),
'frontendAdminPassword' => $frontendConfig->getAdminPassword(),
'frontendSourcePassword' => $frontendConfig->getSourcePassword(),
'frontendRelayPassword' => $frontendConfig->getRelayPassword(),
'frontendRestartUri' => $router->fromHere('api:stations:frontend', ['do' => 'restart']),
'frontendStartUri' => $router->fromHere('api:stations:frontend', ['do' => 'start']),
'frontendStopUri' => $router->fromHere('api:stations:frontend', ['do' => 'stop']),
// Backend
'numSongs' => (int)$num_songs,
'numPlaylists' => (int)$num_playlists,
'manageMediaUri' => $router->fromHere('stations:files:index'),
'managePlaylistsUri' => $router->fromHere('stations:playlists:index'),
'backendRestartUri' => $router->fromHere('api:stations:backend', ['do' => 'restart']),
'backendStartUri' => $router->fromHere('api:stations:backend', ['do' => 'start']),
'backendStopUri' => $router->fromHere('api:stations:backend', ['do' => 'stop']),
];
$assets
->load('fancybox')
->addInlineJs($this->fetch('partials/radio_controls.js'), 95)
->addVueRender('Vue_StationsProfile', '#profile', $props);
?>
<div id="profile"></div>