-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplaylist.php
103 lines (79 loc) · 4.86 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
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
<?php include("includes/includedFiles.php");
if(isset($_GET['playlistId'])) {
$playlistId = $_GET['playlistId'];
}
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">
</div>
</div>
<div class="rightSection">
<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>
<br>
Share this playlist:
<a href="whatsapp://send?text=*Check Out This playlist on SyncPhonic created by <?php echo $owner->getUsername();?>* <?php echo $ROOT_URL?>playlist.php?playlistId=<?php echo $playlistId?>" data-action="share/whatsapp/share"><i class="fa fa-whatsapp fa-2x" aria-hidden="true"></i></a>
<a href="https://twitter.com/intent/tweet?text=Check Out This playlist on SyncPhonic created by <?php echo $owner->getUsername();?>&url=<?php echo $ROOT_URL?>playlist.php?playlistId=<?php echo $playlistId;?>" ><i class="fa fa-twitter fa-2x" aria-hidden="true"></i></a>
<a href="https://www.facebook.com/sharer.php?t=Check Out This playlist on SyncPhonic created by <?php echo $owner->getUsername();?>&u=<?php echo $ROOT_URL?>playlist.php?playlistId=<?php echo $playlistId;?>" ><i class="fa fa-facebook fa-2x" aria-hidden="true"></i></a>
</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();
$songArtist_2 = $playlistSong->getArtist_2();
$songArtist_3 = $playlistSong->getArtist_3();
$songArtist_4 = $playlistSong->getArtist_4();
echo "<li class='tracklistRow'>
<div class='trackCount'>
<img class='play' src='assets/images/icons/play-white.png' onclick='setTrack(\"".$playlistSong->getId()."\", tempPlaylist, true);'>
<span class='trackNumber'>$i</span>
</div>
<div class='trackInfo'>
<span class='trackName'>".$playlistSong->getTitle()."</span>
<span role='link' tabindex='0' class='artistName' onclick='openPage(\"artist.php?artistId=".$songArtist->getId()."\")'>".$songArtist->getName()."</span> ";
if($songArtist_2->getName() != 'NULL'){ echo "<span role='link' tabindex='0' class='artistName' onclick='openPage(\"artist.php?artistId=".$songArtist_2->getId()."\")'>, ".$songArtist_2->getName()."</span>"; }
if($songArtist_3->getName() != 'NULL'){ echo "<span role='link' tabindex='0' class='artistName' onclick='openPage(\"artist.php?artistId=".$songArtist_3->getId()."\")'>, ".$songArtist_3->getName()."</span>"; }
if($songArtist_4->getName() != 'NULL'){ echo "<span role='link' tabindex='0' class='artistName' onclick='openPage(\"artist.php?artistId=".$songArtist_4->getId()."\")'>, ".$songArtist_4->getName()."</span>"; }
echo " </div>
<div class='trackOptions'>
<input type='hidden' class='songId' value='" . $playlistSong->getId() . "'>
<img class='optionsButton' src='assets/images/icons/more.png' onclick='showOptionsMenu(this)'>
</div>
<div class='trackDuration'>
<span class='duration'>" . $playlistSong->getDuration() . "</span>
</div>
</li>";
$i = $i + 1;
?>
<nav class="shareMenu" data-share-id='<?php echo $playlistSong->getId();?>'>
Share:
<a href="whatsapp://send?text=*Check Out This Song on SyncPhonic: <?php echo $playlistSong->getTitle()." by ".$songArtist->getName(); ?>* <?php echo $ROOT_URL?>song.php?songId=<?php echo $playlistSong->getId();?>" data-action="share/whatsapp/share"><i class="fa fa-whatsapp fa-2x" aria-hidden="true"></i></a>
<a href="https://twitter.com/intent/tweet?text=Check Out This Song on SyncPhonic: <?php echo $playlistSong->getTitle()." by ".$songArtist->getName(); ?>&url=<?php echo $ROOT_URL?>song.php?songId=<?php echo $playlistSong->getId();?>" ><i class="fa fa-twitter fa-2x" aria-hidden="true"></i></a>
<a href="https://www.facebook.com/sharer.php?t=Check Out This Song on SyncPhonic : <?php echo $playlistSong->getTitle()." by ".$songArtist->getName(); ?>&u=<?php echo $ROOT_URL?>/song.php?songId=<?php echo $playlistSong->getId();?>" ><i class="fa fa-facebook fa-2x" aria-hidden="true"></i></a>
</nav>
<?php } ?>
<script>
var tempSongIds = '<?php echo json_encode($songIdArray); ?>';
tempPlaylist = JSON.parse(tempSongIds);
</script>
</ul>
</div>
<nav class="optionsMenu">
<input type="hidden" class="songId">
<?php echo Playlist::getPlaylistsDropdown($con, $userLoggedIn->getUsername()); ?>
<div class="item" onclick="removeFromPlaylist(this, '<?php echo $playlistId; ?>')">Remove from Playlist</div>
</nav>