1<?php
2/* vim:set softtabstop=4 shiftwidth=4 expandtab: */
3/**
4 *
5 * LICENSE: GNU Affero General Public License, version 3 (AGPL-3.0-or-later)
6 * Copyright 2001 - 2020 Ampache.org
7 *
8 * This program is free software: you can redistribute it and/or modify
9 * it under the terms of the GNU Affero General Public License as published by
10 * the Free Software Foundation, either version 3 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 * GNU Affero General Public License for more details.
17 *
18 * You should have received a copy of the GNU Affero General Public License
19 * along with this program.  If not, see <https://www.gnu.org/licenses/>.
20 *
21 */
22
23use Ampache\Config\AmpConfig;
24use Ampache\Repository\Model\Preference;
25use Ampache\Module\Api\Ajax;
26
27?>
28<div id="play_type_switch">
29<?php
30$name    = "is_" . AmpConfig::get('play_type');
31${$name} = 'selected="selected" ';
32
33if (Preference::has_access('play_type')) { ?>
34    <form method="post" id="play_type_form" action="javascript.void(0);">
35        <select id="play_type_select" name="type">
36            <?php if (AmpConfig::get('allow_stream_playback')) { ?>
37                <option value="stream" <?php if (isset($is_stream)) {
38    echo $is_stream;
39} ?>><?php echo T_('Stream'); ?></option>
40            <?php
41    }
42    if (AmpConfig::get('allow_localplay_playback')) { ?>
43                <option value="localplay" <?php if (isset($is_localplay)) {
44        echo $is_localplay;
45    } ?>><?php echo T_('Localplay'); ?></option>
46            <?php
47    }
48    if (AmpConfig::get('allow_democratic_playback')) { ?>
49                <option value="democratic" <?php if (isset($is_democratic)) {
50        echo $is_democratic;
51    } ?>><?php echo T_('Democratic'); ?></option>
52            <?php
53    } ?>
54            <option value="web_player" <?php if (isset($is_web_player)) {
55        echo $is_web_player;
56    } ?>><?php echo T_('Web Player'); ?></option>
57        </select>
58        <?php echo Ajax::observe('play_type_select', 'change', Ajax::action('?page=stream&action=set_play_type', 'play_type_select', 'play_type_form')); ?>
59    </form>
60<?php
61} // if they have access
62// Else just show what it currently is
63else {
64    echo T_(ucwords(AmpConfig::get('play_type')));
65} ?>
66</div>
67