-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathnewest_view.php
104 lines (92 loc) · 3.43 KB
/
newest_view.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
104
<?php
include 'includes/callAPI.php';
// Check if we have an offset value passed for pagination
if (!empty($_GET["ofst"])) {
$offset = $_GET["ofst"];
} else {
$offset = 0;
}
//Set up some offset values for our next and prev buttons
if ($offset == 0) {
$poffset = 0;
} else {
$poffset = $offset - 24;
}
$noffset = $offset + 24;
$get_data = handshakeAPI();
$hshake = json_decode($get_data, true);
$auth=$hshake['auth'];
$get_data = statsAPI($auth, 'newest', $offset);
$results = json_decode($get_data, true);
$total = count($results['album']);
$cnt = 0; //Reset our counter
$supastring = '';
for ($cnt = 0; $cnt < $total; $cnt++){
$supastring .= $results['album'][$cnt]['id'];
if ($cnt < $total - 1) $supastring .= ',';
}
include 'includes/header_iframe.php';
?>
<script>parent.activeMenu(2);</script> <!-- Call js function in parent to highlight the correct active menu item -->
<body>
<div class="ui inverted space segment">
<div class='ui middle aligned grid'>
<div class="left floated five wide column">
<h1 class="ui smoke header">Newest Albums <i class="small meteor icon"></i></h1>
</div>
<!-- supa-mix column -->
<div class="right floated right aligned two wide column">
<span class="ui small text">SUPA-MIX</span>
<a class="icn" href="supamix_tracks.php?filt=<?php echo $supastring;?>">
<i class="bordered blender icon" id="supamix"></i>
</a>
</div>
<div class="right floated right aligned five wide column">
<?php
if ($offset > 0) echo '<a class="icn" href="newest_view.php?ofst=' . $poffset . '"><i class="arrow circle left icon"></i></a> ';
if ($total == 24) echo '<a class="icn" href="newest_view.php?ofst=' . $noffset . '"><i class="arrow circle right icon"></i></a>';
?>
</div>
</div>
<?php
$cnt = 0; //Reset our counter to build grid of 24 entries
echo "<div class='ui six column grid container'>";
//Loop 4 rows
for ($i = 1; $i <=4; $i++){
echo "<div class='ui row'>";
//Build out the cover art row with 6 columns
for ($j = 1; $j <=6; $j++){
echo "<div class='ui column'>";
if ($cnt < $total) {
echo '<a href="album_view.php?uid=' . $results['album'][$cnt]['id'] . '">';
echo "<img class='ui small image' src='" . $results['album'][$cnt]['art'] . "' ></a>";
}
echo "</div>";
$cnt++; //Increment our counter
}
$cnt = $cnt - 6; // Jump back 6 so we can build the same albums again
//Build out title and artist row with 6 columns
for ($j = 1; $j <=6; $j++){
echo "<div class='ui column'>";
if ($cnt < $total) {
echo '<br><center><a href="album_view.php?uid=' . $results['album'][$cnt]['id'] . '">';
echo $results['album'][$cnt]['name'] . "</a>";
echo '<br><a href="artist_albums.php?uid=' . $results['album'][$cnt]['artist']['id'] . '">';
echo $results['album'][$cnt]['artist']['name'] . "</a>";
echo '<br>'. $results['album'][$cnt]['year'] . '</center>';
}
echo "</div>";
$cnt++; //Increment our counter
}
echo "</div>"; // end of row
}
echo "</div>"; // end of grid container
?>
</div>
<script>
supamix.addEventListener('click', function() {
document.getElementById("supamix").className = "spinner loading icon";
});
</script>
</body>
</html>