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\Rating; 26use Ampache\Repository\Model\Userflag; 27use Ampache\Repository\Model\Video; 28use Ampache\Module\Authorization\Access; 29use Ampache\Module\Api\Ajax; 30use Ampache\Module\Playback\Stream_Playlist; 31use Ampache\Module\Util\Ui; 32 33$web_path = AmpConfig::get('web_path'); 34$button = Ajax::button('?page=index&action=random_videos', 'random', T_('Refresh'), 'random_video_refresh'); ?> 35<?php Ui::show_box_top(T_('Videos of the Moment') . ' ' . $button, 'box box_random_videos'); ?> 36<?php 37if ($videos) { 38 foreach ($videos as $video_id) { 39 $video = Video::create_from_id($video_id); 40 $video->format(); ?> 41 <div class="random_video"> 42 <div id="video_<?php echo $video_id ?>" class="art_album libitem_menu"> 43 <?php $art_showed = false; 44 if ($video->get_default_art_kind() == 'preview') { 45 $art_showed = Art::display('video', $video->id, $video->f_full_title, 9, $video->link, false, 'preview'); 46 } 47 if (!$art_showed) { 48 $thumb = Ui::is_grid_view('video') ? 7 : 6; 49 Art::display('video', $video->id, $video->f_full_title, $thumb, $video->link); 50 } ?> 51 </div> 52 <div class="play_video"> 53 <?php if (AmpConfig::get('directplay')) { ?> 54 <?php echo Ajax::button('?page=stream&action=directplay&object_type=video&object_id=' . $video->id, 'play', T_('Play'), 'play_album_' . $video->id); ?> 55 <?php if (Stream_Playlist::check_autoplay_next()) { ?> 56 <?php echo Ajax::button('?page=stream&action=directplay&object_type=video&object_id=' . $video->id . '&playnext=true', 'play_next', T_('Play next'), 'nextplay_video_' . $video->id); ?> 57 <?php 58 } ?> 59 <?php if (Stream_Playlist::check_autoplay_append()) { ?> 60 <?php echo Ajax::button('?page=stream&action=directplay&object_type=video&object_id=' . $video->id . '&append=true', 'play_add', T_('Play last'), 'addplay_video_' . $video->id); ?> 61 <?php 62 } ?> 63 <?php 64 } ?> 65 </div> 66 <?php 67 if (Access::check('interface', 25)) { ?> 68 <?php if (AmpConfig::get('ratings')) { ?> 69 <span class="cel_rating" id="rating_<?php echo $video->id; ?>_video"><?php echo Rating::show($video->id, 'video'); ?></span> 70 <?php } ?> 71 72 <?php if (AmpConfig::get('userflags')) { ?> 73 <span class="cel_rating" id="userflag_<?php echo $video->id; ?>_video"><?php echo Userflag::show($video->id, 'video'); ?></span> 74 <?php } ?> 75 <?php } ?> 76 </div> 77 <?php 78 } ?> 79<?php 80} ?> 81 82<?php Ui::show_box_bottom(); ?> 83