-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplaylist.php
70 lines (58 loc) · 2.38 KB
/
playlist.php
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
<?php
include("includes/includedFiles.php");
if(isset($_GET['id'])){
$playlistId= $_GET['id'];
}else{
header("Location: index.php");
}
$playlist = new Playlist($con,$playlistId);
$owner = new User($con, $playlist->getOwner());
?>
<div class="entityInfo">
<div class="leftSection">
<div class="playlistImage">
<img src="assets/images/icons/playlist.png" alt="">
</div>
</div>
<div class="righSection">
<h2><?php echo $playlist->getName(); ?></h2>
<p>By <?php echo $playlist->getOwner(); ?></p>
<p> <?php echo $playlist->getNumberOfSongs();?> Songs</p>
<button class ="button " onclick="deletePlaylist('<?php echo $playlistId ?>')">DELETE PLAYLIST </button>
</div>
</div>
<div class ="tracklistContainer">
<ul class="tracklist">
<?php
$songIdArray = $playlist->getSongIds();
$i = 1;
foreach($songIdArray as $songId){
$playlistSong = new Song($con,$songId);
$songArtist = $playlistSong->getArtist();
echo "
<li class ='tracklistRow'>
<div class='trackCount'>
<img class='play' src='assets/images/icons/play-white.png' onclick = 'setTrack(\"". $playlistSong->getId(). "\", temporaryPlaylist,true)'>
<span class='trackNumber'>$i</span>
</div>
<div class ='trackInfo'>
<span class='trackName'>".$playlistSong->getTitle()."</span>
<span class='artistName'>".$songArtist->getName()."</span>
</div>
<div class ='trackOptions'>
<img class='optionButton' src='assets/images/icons/more.png'>
</div>
<div class='trackDuration'>
<span class='duration'>". $playlistSong->getDuration()."</span>
</div>
</li>
";
$i = $i+1;
}
?>
<script>
var tempSongIds = '<?php echo json_encode($songIdArray);?>';
temporaryPlaylist = JSON.parse(tempSongIds);
</script>
</ul>
</div>