-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmusik.php
299 lines (218 loc) · 8.46 KB
/
musik.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
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
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
<!--/*
***************** IMPRESSUM *******************
Studiengang: MultiMediaTechnology
fhs-nummer: fhs34789
Zweck: Basisquaifikation 1 (QPT1)
Autor: Ludwig Schamböck
*/ -->
<!doctype html>
<html>
<head>
<title>QPT</title>
<meta charset="utf-8">
<link rel="stylesheet" href="kube/css/kube.css">
<link rel="stylesheet" href="css/default.css">
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script>
<script type="text/javascript" src="raphael.js"></script>
<script type="text/javascript" src="http://www.google.com/jsapi"></script>
<script type="text/javascript" src="js/confirm.js"></script>
<!-- Musik -->
<script type="text/javascript" src="js/musikplayer.js"></script>
<script type="text/javascript" src="js/soundmanager/soundmanager2.js"></script>
<!-- soundmanager wird aufgerufen -->
<script type="text/javascript">
soundManager.setup({
//Pfad zu swf ordner
url: 'js/soundmanager/swf/'
});
</script>
<!-- Noten -->
<script type="text/javascript" src="./js/jquery/jquery.min.js"></script>
<script type="text/javascript" src="./js/jquery/jquery-ui-1.8.20.custom.min.js"></script>
<script type="text/javascript" src="./js/zip.js/arraybuffer.js"></script>
<script type="text/javascript" src="./js/zip.js/dataview.js"></script>
<script type="text/javascript" src="./js/zip.js/deflate.js"></script>
<script type="text/javascript" src="./js/zip.js/inflate.js"></script>
<script type="text/javascript" src="./js/zip.js/zip.js"></script>
<script type="text/javascript" src="./scorediv-pv0.0.3.js"></script>
<script>
$(document).ready(function(){
$(".noten").hide();
$(".shownoten").click(function(){
$(this).next(".noten").slideToggle('slow');
});
$(".current").hide();
$(".btnsplay").click(function(){
//$(this).next(".current").css('background-color', 'red');
$(this).next(".current").toggle('slow');
});
});
</script>
<!-- delete song from database -->
<script>
$(document).ready(function() {
$('.btndelete').click(function() {
if (confirm("Willst du diesen Sing wirklich löschen?")) {
var id = $(this).attr('id');
var data = 'id=' + id ;
var parent = $(this).parent().parent();
$.ajax( {
type: "POST",
url: "deletesong.php",
data: data,
cache: false,
success: function() {
parent.fadeOut('slow', function() {$(this).remove();});
}
});
}
});
});
</script>
<!-- update rockon -->
<script type="text/javascript">
$(document).ready(function() {
$(".rockon").click(function() {
var id = $(this).attr("id");
var name = $(this).attr("name");
var data = 'id='+ id ;
var parent = $(this);
$.ajax({
type: "POST",
url: "rockonrating.php",
data: data,
cache: false,
success: function() {
parent.html('dir und '+ name + ' andere gefällt das');
alert ("Der Song rockt!");
}
});
return false;
});
});
</script>
</head>
<body>
<img src="images/logo.png" alt="logo" class="logo-profil">
<div class="content">
<?php
include "functions.php";
//include "rockonrating.php";
if (isset($_SESSION['id'])) {
$id = $_SESSION['id'];
$musikquery = $dbh->prepare( "SELECT * FROM user_musik um JOIN musik m ON um.musik_id = m.id WHERE user_id = $id");
$musikquery->execute();
$musik = $musikquery->fetchAll(PDO::FETCH_OBJ);
$myid = $_SESSION['id'];
?>
<?php
$rowquery = $dbh->prepare("SELECT musik_id FROM user_musik WHERE user_id = $myid");
$rowquery->execute();
$num_rows = $rowquery->rowCount();
if ( $num_rows < 1) {
echo ('<span style=""> <h4 style="color: #fff; padding: 3%; background-color: #881100; text-align: center;"> Du hast noch keine Songs hochgeladen </h4> </span> ');
}
// if ($num_rows > 0) {
?>
<div id="player">
<img src="images/player2.png" class="playerLP">
<div id="holder">
<img id="platte" src="images/lp.png" alt="pattern">
</div>
</div>
<div class="bgmusik">
<?php
$index = 0;
//for($index; $index < count($musik); $index ++){
foreach($musik as $index => $value){ ?>
<div class="allesmusik">
<div class="listemusik">
<li>
<h4> <a href="#" class="play" onclick="soundManager.play('mySound<?php echo $musik[$index]->musik_id; ?>','<?php echo $musik[$index]->musiklink; ?>');" > <?php echo $musik[$index]->titel; ?> </a> </h4>
<!--<form method="post" action="musik.php" enctype="multipart/form-data" class="btndelete">-->
<input type="image" value="" src="images/btndelete.png" class="btndelete" id="<?php echo $musik[$index]->musik_id; ?>">
<!--</form>-->
<div class="btnsplay">
<!-- Buttons to Play Pause and Stop -->
<input type="image" value="" src="images/btnplay.png" class="btnplay play" onclick="soundManager.play('mySound<?php echo $musik[$index]->musik_id; ?>','<?php echo $musik[$index]->musiklink; ?>'); ">
<input type="image" value="" src="images/btnpause.png" class="btnpause pause" onclick="soundManager.pause('mySound<?php echo $musik[$index]->musik_id; ?>');">
<input type="image" value="" src="images/btnstop.png" class="btnpause pause" onclick="soundManager.unload('mySound<?php echo $musik[$index]->musik_id; ?>');">
<!-- /end of Buttons -->
</div>
<div class="current"><p style="color: #fff;"> zur zeit läuft: <strong><?php echo $musik[$index]->titel; ?></strong></p></div>
<?php
$ratingquery = $dbh->query( "SELECT rating FROM musik WHERE id = $value->musik_id");
$rating = $ratingquery->fetch(PDO::FETCH_OBJ);
$ratingup = $rating-> rating +1;
?>
<!-- rock on rating -->
<div class="rockon" id="<?php echo $musik[$index]->musik_id; ?>" name="<?php echo $ratingup; ?>" style="color: #fff;">
<input type="image" value="" src="images/btnrock.png" style="width: 30px; margin-top: -50%;" class="btnrock" name="<?php echo $ratingup; ?>">
<p class="like_show" > rock on: <span class="showrockon"><?php echo $rating->rating; ?></span> </p>
</div>
<button class="btn btn-round shownoten"> zu den Noten </button>
<div class="noten">
<form method="post" action="musik.php" enctype="multipart/form-data">
<input type="text" name="musikid" value="<?php echo $musik[$index]->musik_id; ?>" hidden>
<input type="file" name="xmlupload" value="upload xml" class="btn btn-small" >
<input type="submit" value="upload" class="btn btn-append">
</form>
<script type="text/javascript">zip.workerScriptsPath='../js/zip.js/';</script>
<div class="score-div" style="position: relative; width: 700px; height: 500px; margin-bottom: 10px;" musicxml_ref="<?php echo $value->notenlink; ?>"></div>
</div>
</li>
</div>
</div>
<?php
}
// }
?>
</div>
<?php
$vollstaendig = false;
$musikid = "";
$mid = "";
$rockon = "";
/*
if(array_key_exists("rockon", $_POST)){
if(trim($_POST['rockon']) == "") $vollstaendig = false;
else $rockon = htmlspecialchars(trim($_POST['rockon']));
$rockupdate = $rockon + 1;
if(trim($_POST['mid']) == "") $vollstaendig = false;
else $mid = htmlspecialchars(trim($_POST['mid']));
$deletemusik = $dbh->prepare("UPDATE musik SET rating = ? WHERE id = ?");
$deletemusik->execute(array($rockupdate, $mid));
header('location:musik.php');
}
*/
if(array_key_exists("musikid", $_POST)){
if(trim($_POST['musikid']) == "") $vollstaendig = false;
else $musikid = htmlspecialchars(trim($_POST['musikid']));
if (isset($_FILES['xmlupload']) and $vollstaendig=true ) {
$uploadDirXml = realpath('musikxml') . "/";
$file = $_FILES['xmlupload'];
$extension = array('xml');
//Endung der Datei
$file_ext = explode('.', $file['name']);
$file_ext = end($file_ext);
//Endung von Grossbuchstaben zu Kleinbuchstaben
$file_ext = strtolower($file_ext);
//$fileName = $file['name'];
if(in_array($file_ext, $extension)) {
move_uploaded_file($file['tmp_name'], $uploadDirXml . $file['name']);
$notenupdate = $dbh->prepare("UPDATE musik SET notenlink=? WHERE id = ?");
$notenupdate->execute(array("musikxml/". $file['name'], $musikid));
}
}
}
?>
<?php
}
else{
header('location:index.html');
}
include "navigation.php";
?>
</div>
</body>
</html>