summaryrefslogtreecommitdiffstats
path: root/templates/show_democratic_playlist.inc.php
blob: bc2983b427ec93839430e65da93bb09eb607c3ce (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
<?php
/* vim:set tabstop=8 softtabstop=8 shiftwidth=8 noexpandtab: */
/**
 * Show Democratic Playlist
 *
 * PHP version 5
 *
 * LICENSE: GNU General Public License, version 2 (GPLv2)
 * Copyright (c) 2001 - 2011 Ampache.org All Rights Reserved
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License v2
 * as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 *
 * @category	Template
 * @package	Template
 * @author	Karl Vollmer <vollmer@ampache.org>
 * @copyright	2001 - 2011 Ampache.org
 * @license	http://opensource.org/licenses/gpl-2.0 GPLv2
 * @version	PHP 5.2
 * @link	http://www.ampache.org/
 * @since	File available since Release 1.0
 */

$web_path = Config::get('web_path');
?>
<?php require Config::get('prefix') . '/templates/list_header.inc.php'; ?>
<table class="tabledata" cellpadding="0" cellspacing="0">
<colgroup>
  <col id="col_action" />
  <col id="col_votes" />
  <col id="col_title" />
  <col id="col_album" />
  <col id="col_artist" />
  <col id="col_time" />
  <?php if (Access::check('interface','100')) { ?>
  <col id="col_admin" />
  <?php } ?>
</colgroup>
<?php
if (!count($object_ids)) {
	$playlist = new Playlist($democratic->base_playlist);
?>
<tr>
<td>
	<?php echo _('Playing from base Playlist'); ?>:
	<a href="<?php echo $web_path; ?>/playlist.php?action=show_playlist&amp;playlist_id=<?php echo $playlist->id; ?>">
	<?php echo scrub_out($playlist->name); ?>
	</a>
</td>
</tr>
<?php
} // if no songs
/* Else we have songs */
else {
?>
<tr class="th-top">
	<th class="cel_action"><?php echo _('Action'); ?></th>
	<th class="cel_votes"><?php echo _('Votes'); ?></th>
	<th class="cel_title"><?php echo _('Title'); ?></th>
	<th class="cel_album"><?php echo _('Album'); ?></th>
	<th class="cel_artist"><?php echo _('Artist'); ?></th>
	<th class="cel_time"><?php echo _('Time'); ?></th>
	<?php if (Access::check('interface','100')) { ?>
	<th class="cel_admin"><?php echo _('Admin'); ?></th>
	<?php } ?>
</tr>
<?php
$democratic = Democratic::get_current_playlist();
$democratic->set_parent();
foreach($object_ids as $row_id=>$data) {
	$media = new $data['object_type']($data['object_id']);
	$media->format();
?>
<tr class="<?php echo flip_class(); ?>">
	<td class="cel_action">
	<?php if ($democratic->has_vote($media->id)) { ?>
	<?php echo Ajax::button('?page=democratic&action=delete_vote&row_id=' . $row_id,'delete',_('Remove Vote'),'remove_vote_' . $row_id); ?>
	<?php } else { ?>
	<?php echo Ajax::button('?page=democratic&action=add_vote&object_id=' . $media->id . '&type=' . scrub_out($data['object_type']),'tick',_('Add Vote'),'remove_vote_' . $row_id); ?>
	<?php } ?>
	</td>
	<td class="cel_votes" ><?php echo scrub_out($democratic->get_vote($row_id)); ?></td>
	<td class="cel_title"><?php echo $media->f_link; ?></td>
	<td class="cel_album"><?php echo $media->f_album_link; ?></td>
	<td class="cel_artist"><?php echo $media->f_artist_link; ?></td>
	<td class="cel_time"><?php echo $media->f_time; ?></td>
	<?php if (Access::check('interface','100')) { ?>
	<td class="cel_admin">
	<?php echo Ajax::button('?page=democratic&action=delete&row_id=' . $row_id,'disable',_('Delete'),'delete_row_' . $row_id); ?>
	</td>
	<?php } ?>
</tr>
<?php
	} // end foreach
?>
<tr class="th-bottom">
	<th class="cel_action"><?php echo _('Action'); ?></th>
	<th class="cel_votes"><?php echo _('Votes'); ?></th>
	<th class="cel_title"><?php echo _('Title'); ?></th>
	<th class="cel_album"><?php echo _('Album'); ?></th>
	<th class="cel_artist"><?php echo _('Artist'); ?></th>
	<th class="cel_time"><?php echo _('Time'); ?></th>
	<?php if (Access::check('interface','100')) { ?>
	<th class="cel_admin"><?php echo _('Admin'); ?></th>
	<?php } ?>
</tr>
<?php
} // end else
?>
</table>
<?php require Config::get('prefix') . '/templates/list_header.inc.php'; ?>