-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdj.php
More file actions
144 lines (123 loc) · 4.49 KB
/
dj.php
File metadata and controls
144 lines (123 loc) · 4.49 KB
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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
<?php
include 'db_connect.php';
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
$normalQueue = $pdo->query("
SELECT * FROM Queue q
JOIN KaraokeFiles k ON q.FileID = k.FileID
JOIN Song s ON k.SongID = s.SongID
WHERE q.Price IS NULL OR q.Price = 0
GROUP BY q.QueueID
")->fetchAll();
$priorityQueue = $pdo->query("
SELECT * FROM Queue q
JOIN KaraokeFiles k ON q.FileID = k.FileID
JOIN Song s ON k.SongID = s.SongID
WHERE q.Price IS NOT NULL AND q.Price <> 0
GROUP BY q.QueueID
")->fetchAll();
?>
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="styles.css">
<script>
function sortTable()
{
var table, rows, switching, i, x, y, shouldSwitch;
table = document.getElementsByTagName("table")[0];
}
</script>
<title>DJ Page</title>
</head>
<body>
<div class="dj-body">
<h1 class="header">DJ Dashboard</h1>
<p class="form-label">Welcome to the DJ Dashboard! Here, you can view the queue and manage the songs.</p>
<h2>Normal Queue</h2>
<br>
<br>
<table id="normalQueueTable">
<tr>
<th class="clickable-header" onclick="sortTable(0, 'priorityQueueTable')">Order</th>
<th>Song Name</th>
<th>Artist</th>
<th>Genre</th>
<th>Version</th>
<th>User Name</th>
</tr>
<?php foreach ($normalQueue as $queueItem) : ?>
<tr onclick="selectQueue(this, 'priorityQueueTable')">
<td><?php echo $queueItem['QueueID']; ?></td>
<td><?php echo $queueItem['Title']; ?></td>
<td><?php echo $queueItem['ArtistName']; ?></td>
<td><?php echo $queueItem['Genre']; ?></td>
<td><?php echo $queueItem['Version']; ?></td>
<td><?php echo $queueItem['Username']; ?></td>
</tr>
<?php endforeach; ?>
</table>
<br>
<br>
<h2>Priority Queue</h2>
<br>
<br>
<table id="priorityQueueTable">
<tr>
<th class="clickable-header" onclick="sortTable(0, 'priorityQueueTable')">Order</th>
<th>Song Name</th>
<th>Artist</th>
<th>Genre</th>
<th>Version</th>
<th>User Name</th>
<th class="clickable-header" onclick="sortTable(9, 'priorityQueueTable')">Price</th>
</tr>
<?php foreach ($priorityQueue as $queueItem) : ?>
<tr onclick="selectQueue(this, 'priorityQueueTable')">
<td><?php echo $queueItem['QueueID']; ?></td>
<td><?php echo $queueItem['Title']; ?></td>
<td><?php echo $queueItem['ArtistName']; ?></td>
<td><?php echo $queueItem['Genre']; ?></td>
<td><?php echo $queueItem['Version']; ?></td>
<td><?php echo $queueItem['Username']; ?></td>
<td><?php echo $queueItem['Price']; ?></td>
</tr>
<?php endforeach; ?>
</table>
<br>
<br>
<button onclick="addToPlaylist()" class="button" type="button">Add to Playlist</button>
<!-- Playlist -->
<h2>Playlist</h2>
<br>
<br>
<table id="playlistTable">
<tr>
<th>Song Name</th>
<th>Artist</th>
</tr>
<?php foreach ($_SESSION['playlist'] as $song) : ?>
<tr>
<td><?php echo $song['song']; ?></td>
<td><?php echo $song['artist']; ?></td>
</tr>
<?php endforeach; ?>
</table>
<br>
<br>
<!-- Currently Playing Song -->
<h2>Currently Playing</h2>
<?php if ($_SESSION['current_song'] !== null) : ?>
<p class="form-label">Song: <?php echo $_SESSION['current_song']['song']; ?></p>
<p class="form-label">Artist: <?php echo $_SESSION['current_song']['artist']; ?></p>
<?php else : ?>
<p class="form-label">No song is currently playing.</p>
<?php endif; ?>
<br>
<button onclick="nextSong()" class="button" type="button">Next Song</button>
<a href="admin.php" class="button">Admin</a>
<a href="ind.php" class="back-button">Back</a>
</div>
</body>
</html>