-
Notifications
You must be signed in to change notification settings - Fork 0
/
artist.php
98 lines (81 loc) · 2.71 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
<?php
include("includes/includedFiles.php");
if (isset($_GET['id'])) {
$artistId = $_GET['id'];
} else {
header("Location: index.php");
}
$artist = new Artist($pdo, $artistId);
?>
<div class="row">
<div class="entity-info border-bottom">
<div class="center-section">
<div class="artist-info">
<h1 class="artist-name"><?php echo $artist->getName(); ?></h1>
<div class="header-buttons">
<button class="btn primary" onclick="playFirstSong()">PLAY</button>
</div>
</div>
</div>
</div> <!-- entity-info -->
<div class="track-section border-bottom">
<h2>Songs</h2>
<ul class="track-list">
<?php
$songArray = $artist->getSongIds();
$i = 1; // To count track
foreach ($songArray as $songId) {
$albumSong = new Song($pdo, $songId["id"]);
$albumList = $albumSong->getArtist();
echo "<li class='track-item'>
<div class='track-count'>
<i class='fa fa-play-circle-o' aria-hidden='true' onclick='setTrack( {id: " . $albumSong->getId() ."}, tempPlayList, true)'></i>
<span class='track-number'>$i</span>
</div>
<div class='track-info'>
<span id='track-name'>" . $albumSong->getTitle() . "</span>
<span id='artist-name'>" . $albumList->getName() . "</span>
</div>
<div class='track-options'>
<input type='hidden' class='song-id' value='" . $albumSong->getId() . "'>
<i id='options-button' class='fa fa-caret-down' aria-hidden='true' onclick='showOptionsMenu(this)'></i>
</div>
<div class='track-duration'>
<span class='duration'>" . $albumSong->getDuration() . "</span>
</div>
</li>";
$i++; // To count track
}
?>
<script>
var tempSongsIds = '<?php echo json_encode($songArray); ?>';
tempPlayList = JSON.parse(tempSongsIds);
</script>
</ul> <!-- track-list"-->
</div> <!-- track-section -->
<div class="album-container container">
<h2>Albums</h2>
<div class="row">
<?php
$albumQuery = "SELECT * FROM albums WHERE artist='$artistId'";
$albumQueries = $pdo->prepare($albumQuery, array(PDO::ATTR_CURSOR => PDO::CURSOR_SCROLL));
$albumQueries->execute();
$rowCount = $albumQueries->rowCount();
foreach ($albumQueries as $album) {
echo "<div class='card-view'>
<span onclick='openPage(\"album.php?id=" . $album['id'] . "\")' tabindex='0'>
<img src='". $album['artworkPath'] . "'>
<div class='album-caption'>"
. $album['title'] .
"</div>
</span>
</div>";
}
?>
</div>
<nav class="options-menu">
<input type="hidden" class="song-id">
<?php echo Playlist::getPlaylistsDropdown($pdo, $userLoggedIn->getUserName()); ?>
</nav>
</div> <!-- album-container -->
</div>