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\Art;
25use Ampache\Repository\Model\Plugin;
26use Ampache\Repository\Model\Song;
27use Ampache\Module\Api\Ajax;
28use Ampache\Module\System\Core;
29use Ampache\Module\Util\Ui;
30
31?>
32<div id="browse_header">
33<?php require_once Ui::find_template('show_browse_form.inc.php'); ?>
34</div> <!-- Close browse_header Div -->
35
36<?php $user = Core::get_global('user');
37if ($user->id) {
38    foreach (Plugin::get_plugins('display_home') as $plugin_name) {
39        $plugin = new Plugin($plugin_name);
40        if ($plugin->load($user)) {
41            $plugin->_plugin->display_home();
42        }
43    }
44} ?>
45
46<?php if (AmpConfig::get('home_now_playing')) { ?>
47<div id="now_playing">
48    <?php show_now_playing(); ?>
49</div> <!-- Close Now Playing Div -->
50<?php
51} ?>
52<!-- Randomly selected Albums of the Moment -->
53<?php if (AmpConfig::get('home_moment_albums')) {
54    echo Ajax::observe('window', 'load', Ajax::action('?page=index&action=random_albums', 'random_albums')); ?>
55<div id="random_selection" class="random_selection">
56    <?php Ui::show_box_top(T_('Albums of the Moment'));
57    echo T_('Loading...');
58    Ui::show_box_bottom(); ?>
59</div>
60<?php
61}
62    if (AmpConfig::get('home_moment_videos') && AmpConfig::get('allow_video')) {
63        echo Ajax::observe('window', 'load', Ajax::action('?page=index&action=random_videos', 'random_videos')); ?>
64<div id="random_video_selection" class="random_selection">
65    <?php Ui::show_box_top(T_('Videos of the Moment'));
66        echo T_('Loading...');
67        Ui::show_box_bottom(); ?>
68</div>
69    <?php
70    } ?>
71<?php if (AmpConfig::get('home_recently_played')) { ?>
72<!-- Recently Played -->
73<div id="recently_played">
74    <?php
75        $data = Song::get_recently_played();
76        Song::build_cache(array_keys($data));
77        require_once Ui::find_template('show_recently_played.inc.php'); ?>
78</div>
79<?php
80    } ?>
81