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\User; 26use Ampache\Repository\Model\Video; 27use Ampache\Module\Api\Ajax; 28use Ampache\Module\Util\ObjectTypeToClassNameMapper; 29use Ampache\Module\Util\Ui; 30 31/** @var Ampache\Repository\Model\Browse $browse */ 32/** @var array $object_ids */ 33 34$web_path = AmpConfig::get('web_path'); 35$show_ratings = User::is_registered() && (AmpConfig::get('ratings') || AmpConfig::get('userflags')); 36$hide_genres = AmpConfig::get('hide_genres'); 37$is_table = $browse->is_grid_view(); 38//mashup and grid view need different css 39$cel_cover = ($is_table) ? "cel_cover" : 'grid_cover'; 40$cel_tags = ($is_table) ? "cel_tags" : 'grid_tags'; 41$cel_counter = ($is_table) ? "cel_counter" : 'grid_counter'; ?> 42<?php if ($browse->is_show_header()) { 43 require Ui::find_template('list_header.inc.php'); 44} ?> 45<table class="tabledata striped-rows <?php echo $browse->get_css_class() ?>" data-objecttype="video"> 46 <thead> 47 <tr class="th-top"> 48 <th class="cel_play essential"></th> 49 <th class="<?php echo $cel_cover; ?>"><?php echo T_('Art'); ?></th> 50 <th class="cel_title essential persist"><?php echo Ajax::text('?page=browse&action=set_sort&browse_id=' . $browse->id . '&type=video&sort=title', T_('Title'), 'sort_video_title'); ?></th> 51 <th class="cel_add essential"></th> 52<?php if (isset($video_type) && $video_type != 'video') { 53 require Ui::find_template('show_partial_' . $video_type . 's.inc.php'); 54} ?> 55 <th class="cel_release_date optional"><?php echo Ajax::text('?page=browse&action=set_sort&browse_id=' . $browse->id . '&type=video&sort=release_date', T_('Release Date'), 'sort_video_release_date'); ?></th> 56 <th class="cel_codec optional"><?php echo Ajax::text('?page=browse&action=set_sort&browse_id=' . $browse->id . '&type=video&sort=codec', T_('Codec'), 'sort_video_codec'); ?></th> 57 <th class="cel_resolution optional"><?php echo Ajax::text('?page=browse&action=set_sort&browse_id=' . $browse->id . '&type=video&sort=resolution', T_('Resolution'), 'sort_video_rez'); ?></th> 58 <th class="cel_length optional"><?php echo Ajax::text('?page=browse&action=set_sort&browse_id=' . $browse->id . '&type=video&sort=length', T_('Time'), 'sort_video_length'); ?></th> 59 <?php if (AmpConfig::get('show_played_times')) { ?> 60 <th class="<?php echo $cel_counter; ?> optional"><?php echo T_('# Played'); ?></th> 61 <?php } ?> 62 <?php if (!$hide_genres) { ?> 63 <th class="<?php echo $cel_tags; ?> optional"><?php echo T_('Genres'); ?></th> 64 <?php } ?> 65 <?php if ($show_ratings) { ?> 66 <th class="cel_ratings optional"><?php echo T_('Rating'); ?></th> 67 <?php } ?> 68 <th class="cel_action essential"><?php echo T_('Action'); ?></th> 69 </tr> 70 </thead> 71 <tbody> 72 <?php foreach ($object_ids as $video_id) { 73 if (isset($video_type)) { 74 $className = ObjectTypeToClassNameMapper::map($video_type); 75 $libitem = new $className($video_id); 76 } else { 77 $libitem = new Video($video_id); 78 } 79 $libitem->format(); ?> 80 <tr id="video_<?php echo $libitem->id; ?>"> 81 <?php require Ui::find_template('show_video_row.inc.php'); ?> 82 </tr> 83 <?php 84} ?> 85 <?php if (!count($object_ids)) { ?> 86 <tr> 87 <td colspan="42"><span class="nodata"><?php echo T_('No video found'); ?></span></td> 88 </tr> 89 <?php } ?> 90 </tbody> 91 <tfoot> 92 <tr class="th-bottom"> 93 <th class="cel_play"></th> 94 <th class="<?php echo $cel_cover; ?>"><?php echo T_('Art'); ?></th> 95 <th class="cel_title"><?php echo Ajax::text('?page=browse&action=set_sort&browse_id=' . $browse->id . '&type=video&sort=title', T_('Title'), 'sort_video_title'); ?></th> 96 <th class="cel_add"></th> 97<?php if (isset($video_type) && $video_type != 'video') { 98 require Ui::find_template('show_partial_' . $video_type . 's.inc.php'); 99 } ?> 100 <th class="cel_release_date"><?php echo Ajax::text('?page=browse&action=set_sort&browse_id=' . $browse->id . '&type=video&sort=release_date', T_('Release Date'), 'sort_video_release_date'); ?></th> 101 <th class="cel_codec"><?php echo Ajax::text('?page=browse&action=set_sort&browse_id=' . $browse->id . '&type=video&sort=codec', T_('Codec'), 'sort_video_codec'); ?></th> 102 <th class="cel_resolution"><?php echo Ajax::text('?page=browse&action=set_sort&browse_id=' . $browse->id . '&type=video&sort=resolution', T_('Resolution'), 'sort_video_rez'); ?></th> 103 <th class="cel_length"><?php echo Ajax::text('?page=browse&action=set_sort&browse_id=' . $browse->id . '&type=video&sort=length', T_('Time'), 'sort_video_length'); ?></th> 104 <?php if (AmpConfig::get('show_played_times')) { ?> 105 <th class="<?php echo $cel_counter; ?> optional"><?php echo T_('# Played'); ?></th> 106 <?php } ?> 107 <?php if (!$hide_genres) { ?> 108 <th class="<?php echo $cel_tags; ?>"><?php echo T_('Genres'); ?></th> 109 <?php } ?> 110 <?php if ($show_ratings) { ?> 111 <th class="cel_ratings optional"><?php echo T_('Rating'); ?></th> 112 <?php } ?> 113 <th class="cel_action"><?php echo T_('Action'); ?></th> 114 </tr> 115 </tfoot> 116</table> 117<?php show_table_render(); ?> 118<?php if ($browse->is_show_header()) { 119 require Ui::find_template('list_header.inc.php'); 120 } ?> 121