-
Notifications
You must be signed in to change notification settings - Fork 0
/
artist.php
98 lines (84 loc) · 3.01 KB
/
artist.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
<?php
include("includes/includedFiles.php");
if(isset($_GET['id'])) {
$artistId = $_GET['id'];
}
else {
header("Location: index.php");
}
$artist = new Artist($con, $artistId);
?>
<div class="entityInfo borderBottom">
<div class="centerSection">
<div class="artistInfo">
<h1 class="artistName">
<?php
echo $artist->getName();
?>
<div class="headerButtons">
<button class="button green" onclick="playFirstSong()">PLAY</button>
</div>
</h1>
</div>
</div>
</div>
<div class="trackListContainer borderBottom">
<h2>SONGS</h2>
<ul class="tracklist">
<?php
$songIdArray = $artist->getSongIds();
$i = 1;
foreach($songIdArray as $songId) {
if($i > 5) {
break;
}
$albumSong = new Song($con, $songId);
$albumArtist = $albumSong->getArtist();
echo "<li class='tracklistRow'>
<div class='trackCount'>
<img class='play' src='assets/images/icons/play-white.png' onclick='setTrack(\"" . $albumSong->getId() . "\", tempPlaylist, true)'>
<span class='trackNumber'>$i</span>
</div>
<div class='trackInfo'>
<span class='trackName'>" . $albumSong->getTitle() . "</span>
<span class='artistName'>" . $albumArtist->getName() . "</span>
</div>
<div class='trackOptions'>
<input type='hidden' class='songId' value='" . $albumSong->getId() . "'>
<img class='optionsButton' src='assets/images/icons/more.png' onclick='showOptionsMenu(this)'>
</div>
<div class='trackDuration'>
<span class='duration'>" . $albumSong->getDuration() ."</span>
</div>
</li>";
$i++;
}
?>
<script>
var tempSongIds = '<?php echo json_encode($songIdArray); ?>';
tempPlaylist = JSON.parse(tempSongIds);
</script>
</ul>
</div>
<div class="gridViewContainer">
<h2>ALBUMS</h2>
<?php
$albumQuery = mysqli_query($con, "SELECT * FROM albums WHERE artist='$artistId'");
while($row = mysqli_fetch_array($albumQuery)) {
echo "<div class='gridViewItem'>
<span role='link' tabindex='0' onclick='openPage(\"album.php?id=" . $row['id'] . "\")'>
<img src='" . $row['artworkPath'] . "'>
<div class='gridViewInfo'>"
. $row['title'] .
"</div>
</span>
</div>";
}
?>
</div>
<nav class="optionsMenu">
<input type="hidden" class="songId">
<?php echo Playlist::getPlaylistsDropdown($con, $userLoggedIn->getUsername()) ?>
<div class="item">Copy song link</div>
<div class="item">Share</div>
</nav>