Веб-интерфейс к MPD.
[mpd-web.git] / ajax / playlist.php
1 <?php
2
3 include('mpd.php');
4
5 $cur_track= $mpd->current_track_id;
6 $playlist= $mpd->playlist;
7 ?>
8 <div id="playlist">
9 <?php include("../view/default/tmpl/playlistmenu.php"); ?>
10 <div id="items">
11     <table>
12     <tr id="items_heading">
13         <td></td><td>Title</td><th colspan="4">Controls</th>
14     </tr>
15     <?php
16       for($i=0;$i<count($playlist);$i++) {
17     ?>
18       <tr id="item<?php if($cur_track == $i){echo "Active";} elseif($i%2==0) { echo "Even";}else{echo "Odd";}?>">
19           <td id="track_number">
20                 <a name="<?php echo $i;?>"></a></td>
21           </td>
22           <td id="file">
23                   <span class="button" onclick="PlaylistCommand('playitem',<?php echo $i;?>)"><?php
24                         if ($playlist[$i]['name']==$playlist[$i]['title']) { 
25                                 echo htmlentities(cut_file($playlist[$i]['name']));
26                         } else {
27                                 echo htmlentities($playlist[$i]['title']);
28                         }
29                 ?></span>
30           </td>
31           <td id="move">
32                  <span class="button" onclick="PlaylistCommand('moveup',<?php echo $i;?>)"><img width="15" src="images/up.png"></span>
33           </td>
34           <td id="move">
35                  <span class="button" onclick="PlaylistCommand('movedown',<?php echo $i;?>)"><img width="15" src="images/down.png"></span>
36           </td>
37           <td id="remove">
38                  <span class="button" onclick="PlaylistCommand('remove',<?php echo $i;?>)"><img width="15" src="images/remove.png"></span>
39           </td>
40           <td id="check">
41                   <input type="checkbox" name="itemlist[]" value="<?php echo $i;?>">
42           </td>
43       </tr>
44     <?php
45       }
46     ?>
47     </table>
48 </div>
49 <?php include("../view/default/tmpl/playlistmenu.php"); ?>
50 </div>