summaryrefslogtreecommitdiffstats
path: root/templates/show_songs.inc
blob: 13819f3e90cc1d8499eb956812dcdedc22156318 (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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
<?php
/*

 Copyright (c) 2001 - 2005 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
 as published by the Free Software Foundation; either version 2
 of the License, or (at your option) any later version.

 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.

*/
$web_path = conf('web_path');
?>


<form name="songs" method="post" enctype="multipart/form-data">
<table border="0">
  <tr><td colspan="2">
    <table class="border" cellspacing="0" cellpadding="0" border="0">
    <tr class="table-header">
            <th>&nbsp;&nbsp;<a href="#" onclick="check_songs(); return false;">Select</a></th>
            <?php if (isset($playlist_id) && $playlist_id != 0 && ($user->id == $pluser->id || $user->has_access('100'))) { $tab = 1; ?> <th><?php echo _("Track"); ?></th> <?php } ?>
            <th><?php echo _("Song title"); ?></th>
            <th><?php echo _("Artist"); ?></th>
            <th><?php echo _("Album"); ?></th>
            <th><?php echo _("Track"); ?></td>
            <th><?php echo _("Time"); ?></th>
            <th><?php echo _("Size"); ?></th>
            <th><?php echo _("Bitrate"); ?></th>
            <th><?php echo _("Genre"); ?></th>
            <th><?php echo _("Flag"); ?></th>
            <th><?php echo _("Action"); ?></th>
    </tr>
    <?php
    foreach ($song_ids as $song_id) {

	    unset($text_class);
            $song = new Song($song_id);
            $song->format_song();

            // Still needed crap
            $totalsize += $song->size;
            $totaltime += $song->time;
	    if ($song->status == "disabled") { $text_class = "class=\"disabled\""; } 
    ?>
    <tr class="<?php echo flip_class(); ?>">
            <td align="center">
              <input type="checkbox" name="song[]" value="<?php echo $song->id; ?>" id="song_<?php echo $song->id; ?>"></input>
            </td>
        <?php
            if (isset($playlist_id) && $playlist_id != 0 && ($user->id == $pluser->id || $user->has_access('100'))) {
                    $tracknum = get_playlist_track_from_song($playlist_id, $song->id);
        ?>
            <td>
              <input type="text" tabindex="<?php echo $tab; ?>" size="3" name="<?php echo "tr_" . $song->id; ?>" value="<?php echo $tracknum ?>" onchange="<?php echo "document.getElementById('song_" . $song->id . "').checked='checked';"; ?>" />
            </td>
        <?php
                    $tab++;
            }
        ?>
             <td>
              <a href="<?php echo $web_path; ?>/song.php?action=m3u&song=<?php echo $song->id; ?>" title="<?php echo $song->title; ?>" <?php echo $text_class; ?>> <?php echo $song->f_title; ?> </a>
            </td>
            <td>
              <a href="<?php echo $web_path; ?>/artists.php?action=show&amp;artist=<?php echo $song->artist; ?>" title="<?php echo $song->f_artist_full; ?>" <?php echo $text_class; ?>> <?php echo $song->f_artist; ?> </a>
            </td>
            <td>
              <a href="<?php echo $web_path; ?>/albums.php?album=<?php echo $song->album; ?>" title="<?php echo $song->f_album_full; ?>" <?php echo $text_class; ?>> <?php echo $song->f_album; ?> </a>
            </td>
            <td align="right">
              <?php echo $song->track; ?>
            </td>
            <td align="right">
              <?php echo $song->f_time; ?>
            </td>
            <td align="right" nowrap>
              <?php echo $song->f_size; ?> MB
            </td>
            <td align="right">
              <?php echo $song->f_bitrate; ?>
            </td>
            <td>
              <?php echo $song->f_genre; ?>
            </td>
            <td <?php echo $song->f_style; ?> title="<?php echo $song->flagcomment; ?>">
              <?php echo $song->flagtype; ?>
            </td>
            <td>
              <?php if ($user->has_access('100')) { ?>
                <a href="<?php echo $web_path; ?>/admin/song.php?action=edit&amp;song=<?php echo $song->id; ?>">Edit</a> | <a href="<?php echo $web_path; ?>/flag.php?song=<?php echo $song->id; ?>&amp;action=flag">Flag</a> | 
                  <?php if ($song->status === 'enabled') { ?>
                    <a href="<?php echo $web_path; ?>/admin/song.php?action=disable&song_ids=<?php echo $song->id; ?>">Disable</a>
                  <?php } else { ?>
                    <a href="<?php echo $web_path; ?>/admin/song.php?action=enabled&song_ids=<?php echo $song->id; ?>">Enable</a>
                  <?php } //status ?>
              <?php } else { ?>
                <a href="<?php echo $web_path; ?>/flag.php?song=<?php echo $song->id; ?>&amp;action=flag">Flag</a>
              <?php } //access ?>
		<?php if ($user->prefs['download']) { ?>
			| <a href="<?php echo $web_path; ?>/download/index.php?action=download&amp;song_id=<?php echo $song->id; ?>&amp;fn=<?php echo rawurlencode($song->f_artist_full . " - " . $song->title . "." . $song->type); ?>"><?php echo _("Download"); ?></a>
		<?php } ?>
		<?php if ($user->prefs['direct_link']) { ?>
		| <a href="<?php echo $web_path; ?>/play/index.php?song=<?php echo $song->id; ?>&uid=<?php echo $user->id . "&sid=" . session_id(); ?>&amp;fn=<?php echo rawurlencode($song->f_artist_full . " - " . $song->title . "." . $song->type); ?>">
			<?php echo _("Direct Link"); ?>
		<?php } ?>
		</a>	
            </td>
          </tr>
    <?
    }// foreach loop

    //
    // Another here doc
    //
    $time = floor($totaltime/60) . ":" . sprintf("%02d", ($totaltime%60) );
    $megs = sprintf("%.2f", ($totalsize/1048576));
    $num = count($song_ids);

    ?>
    <tr class="table-header">
      <td></td>
      <?php if (isset($playlist_id) && $playlist_id != 0 && ($user->id == $pluser->id || $user->access === 'admin')) { ?> <td></td> <?php } ?>
      <td><?php echo _("Total"); ?>:</td>
      <td nowrap><?php echo $num; ?> song(s)</td>
      <td></td>
      <td></td>
      <td align="right" nowrap><?php echo $time; ?></td>
      <td align="right" nowrap><?php echo $megs; ?> MB</td>
      <td></td>
      <td></td>
      <td></td>
      <td colspan="2"></td>
    </tr>
    </table>
</td></tr>
</table>
<br />
<?php show_play_selected(); ?>
</form>