-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvs-list.php
More file actions
executable file
·300 lines (252 loc) · 12.2 KB
/
Copy pathvs-list.php
File metadata and controls
executable file
·300 lines (252 loc) · 12.2 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
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
300
<?php
session_start();
if(!isset($_SESSION["username"])){
header("location:index.php");
}
if (isset($_GET["tid"]))
$task_id = $_GET["tid"];
else
$task_id = 0;
if (isset($_GET["iid"]))
$interface_id = $_GET["iid"];
else
$interface_id = 1;
include "conn.php";
if ($task_id == 0)
$result1 = $mysqli->query("SELECT * FROM videos");
else {
$result1 = $mysqli->query("SELECT * FROM videos WHERE task_id='$task_id'");
$result2 = $mysqli->query("SELECT * FROM tasks WHERE id='$task_id'");
$task = $result2->fetch_assoc();
}
$videos_array = array();
$labels_array = array();
$meta_array = array();
while ($video = $result1->fetch_assoc()) {
$video_filename = $video['filename'];
$string = file_get_contents("video/$video_filename.info.json");
$json = json_decode($string, true);
$result3 = $mysqli->query("SELECT * FROM labels WHERE video_id = '" . $video['id'] . "'");
$label_array = array();
// $html = "";
while ($label = $result3->fetch_assoc()) {
$label_array[] = $label;
}
$labels_array[] = $label_array;
$videos_array[] = $video;
$meta_array[] = $json;
}
if ($task_id == 0)
$result4 = $mysqli->query("SELECT count(distinct videos.id) AS freq, tool FROM labels, videos WHERE labels.video_id=videos.id AND tool<>'' GROUP BY tool ORDER BY freq DESC LIMIT 7");
else
$result4 = $mysqli->query("SELECT count(distinct videos.id) AS freq, tool FROM labels, videos WHERE labels.video_id=videos.id AND tool<>'' AND videos.task_id='$task_id' GROUP BY tool ORDER BY freq DESC LIMIT 7");
// $result4 = $mysqli->query("SELECT count(*) AS freq, tool FROM labels, videos WHERE labels.video_id=videos.id AND tool<>'' AND videos.task_id='$task_id' GROUP BY tool ORDER BY freq DESC LIMIT 7");
$tools_array = array();
while ($tool = $result4->fetch_assoc()) {
$tools_array[] = $tool;
}
include('header.php');
?>
<div class="row">
<h1 class="span12" id="title"></h1>
<div id="stats" class="span4"></div>
</div>
<form id="myForm" action="vs-process.php" method="POST">
<ol id="results" class="list-striped list-hover"></ol>
<div class="alert alert-block alert-error fade in">
<button type="button" class="close" data-dismiss="alert">×</button>
<h4 class="alert-heading">Please answer all the questions.</h4>
</div>
<br>
<button id="nextButton" class="btn btn-large btn-primary" type="submit">
NEXT
</button>
</form>
</div><!--container-->
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script>window.jQuery || document.write('<script src="js/libs/jquery-1.7.2.min.js"><\/script>')</script>
<script src="js/libs/bootstrap/bootstrap.min.js"></script>
<script type="text/javascript" src="js/libs/jquery-ui-1.8.22.custom.min.js"></script>
<script type="text/javascript" src="js/libs/jwplayer/jwplayer.js"></script>
<script type="text/javascript" src="js/libs/jcarousel/jquery.jcarousel.min.js"></script>
<script src="js/libs/jcview/jquery.vt.jcview.js"></script>
<script src="js/libs/log4javascript.js"></script>
<script type="text/javascript" src="js/libs/lightbox/jquery.lightbox-0.5.js"></script>
<script src="js/script.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$(".alert").hide();
var input = $("<input>").attr("type", "hidden").attr("name", "part").val("<?php echo $_GET['part'];?>");
$('#myForm').append($(input));
var input = $("<input>").attr("type", "hidden").attr("name", "cond").val("<?php echo $_GET['cond'];?>");
$('#myForm').append($(input));
var input = $("<input>").attr("type", "hidden").attr("name", "step").val("<?php echo $_GET['step'];?>");
$('#myForm').append($(input));
var input = $("<input>").attr("type", "hidden").attr("name", "from").val("<?php echo $_SERVER['PHP_SELF'];?>");
$('#myForm').append($(input));
$("#myForm").submit(function(){
$(".alert").hide();
var radio_groups = {};
$(":radio").each(function(){
radio_groups[this.name] = true;
});
for(group in radio_groups){
if_checked = !!$(":radio[name='"+group+"']:checked").length;
if (!if_checked) {
$(".alert").show();
//console.log(group+(if_checked?' has checked radios':' does not have checked radios'));
return false;
}
}
});
/* Code for injecting random values to all radio buttons*/
/*
var radio_groups = {}
$(":radio").each(function(){
radio_groups[this.name] = true;
});
for(group in radio_groups){
var val = Math.floor(Math.random() * 7);
$(":radio[name='"+group+"']:nth("+val+")").attr("checked", true);
};
*/
// Nav bar activation
var task_id = <?php echo $task_id; ?>;
var interface_id = <?php echo $interface_id; ?>;
var is_admin = <?php echo $_SESSION["is_admin"]; ?>;
//console.log(is_admin, !is_admin, (is_admin == true), (is_admin == false));
var log = log4javascript.getDefaultLogger();
var ajaxAppender = new log4javascript.AjaxAppender("ajax-add-log.php");
log.addAppender(ajaxAppender);
var num_videos = <?php echo $result1->num_rows; ?>;
var labels_array = <?php echo json_encode($labels_array); ?>;
var videos_array = <?php echo json_encode($videos_array); ?>;
var tools_array = <?php echo json_encode($tools_array); ?>;
var meta_array = <?php echo json_encode($meta_array); ?>;
var num_labels = 0;
var filters = [];
// Setting the page title
var cond = <?php echo $_GET["cond"]; ?>;
if (cond > 0)
$("#task-selector li").eq(cond).addClass("active");
if (task_id == 0){
$("#title").html("Showing all videos");
} else {
$("#title").html("<?php echo $task['name'];?>");
}
// Add video entries for each interface
$.each(videos_array, function(index, value){
var input = $("<input>").attr("type", "hidden").attr("name", "vid" + index).val(this.id);
$('#myForm').append($(input));
var params = "?vid=" + this.id + "&iid=" + interface_id;
if (interface_id == 1) {
num_labels = num_labels + labels_array[index].length;
var html2 = "";
if (is_admin)
html2 = "<p class='video-info-meta pull-right'><a href='label.php" + params + "'>(Label)</a></p>";
//$title = $("<h3/>").addClass("span8").append("<a href='browse.php" + params + "'>" + this.title + "</a>");
//$title = $("<h3/>").addClass("span8").append(this.title);
//$desc = $("<div/>").addClass("span8").append(meta_array[index].description);
//$detail = $("<div/>").addClass("span3").append("<p class='pull-right video-info-meta'>" + getTimeDisplay(this.duration) + " | " + labels_array[index].length + " labels</p>" + html2);
//$info = $("<div/>").addClass("video-info row").append($title).append($detail).append($desc);
$info = $("<div/>").addClass("video-info row");//.append($title);
$view = $("<div/>").addClass("row").append("<div class='video-view span12'></div>");
$likert = $("<div/>").addClass("row").append("<div class='video-likert span12'>" + likert.getVSVideoHTML(index) + "</div>");
$item = $("<div/>").addClass("video-item").append($info).append($view).append($likert);
$("<li/>").data("video_id", this.id).append($item).appendTo("#results");
} else if (interface_id == 2) {
num_labels = num_labels + labels_array[index].length;
var html2 = "";
if (is_admin)
html2 = "<p class='video-info-meta pull-right'><a href='label.php" + params + "'>(Label)</a></p>";
//$title = $("<h3/>").addClass("span8").append("<a href='browse.php" + params + "'>" + this.title + "</a>");
//$title = $("<h3/>").addClass("span8").append(this.title);
//$desc = $("<div/>").addClass("span8").append(meta_array[index].description);
//$detail = $("<div/>").addClass("span3").append("<p class='pull-right video-info-meta'>" + getTimeDisplay(this.duration) + " | " + labels_array[index].length + " labels</p>" + html2);
//$info = $("<div/>").addClass("video-info row").append($title).append($detail).append($desc);
$info = $("<div/>").addClass("video-info row");//.append($title);
$view = $("<div/>").addClass("row").append("<div class='video-view span12'><div id='mediaplayer" + index + "'></div></div>");
$likert = $("<div/>").addClass("row").append("<div class='video-likert span12'>" + likert.getVSVideoHTML(index) + "</div>");
$item = $("<div/>").addClass("video-item").append($info).append($view).append($likert);
$("<li/>").data("video_id", this.id).append($item).appendTo("#results");
} else if (interface_id == 3) {
num_labels = num_labels + labels_array[index].length;
var html2 = "";
if (is_admin)
html2 = "<p class='video-info-meta pull-right'><a href='label.php" + params + "'>(Label)</a></p>";
//$title = $("<h3/>").addClass("span8").append("<a href='browse.php" + params + "'>" + this.title + "</a>");
//$title = $("<h3/>").addClass("span8").append(this.title);
//$desc = $("<div/>").addClass("span8").append(meta_array[index].description);
//$detail = $("<div/>").addClass("span3").append("<p class='pull-right video-info-meta'>" + getTimeDisplay(this.duration) + " | " + labels_array[index].length + " labels</p>" + html2);
//$info = $("<div/>").addClass("video-info row").append($title).append($detail).append($desc);
$info = $("<div/>").addClass("video-info row");//.append($title);
$view = $("<div/>").addClass("row").append("<div class='video-view span12'><div id='mediaplayer" + index + "'></div></div>");
$likert = $("<div/>").addClass("row").append("<div class='video-likert span12'>" + likert.getVSVideoHTML(index) + "</div>");
$item = $("<div/>").addClass("video-item").append($info).append($view).append($likert);
$("<li/>").data("video_id", this.id).append($item).appendTo("#results");
}
});
// Display statistics
$("#stats").html("Total: " + num_videos + " videos");
/* From here, VT Browser ONLY */
// for each result entry, display a slideshow summary
$(".video-view").each(function(index){
//console.log(videos_array[index].duration);
if (interface_id == 1){
$(this).jcview({
labels: labels_array[index],
duration: videos_array[index].duration
});
} else if (interface_id == 2){
var filename = "video/ff/" + videos_array[index].filename + ".flv";
if (jwplayer("mediaplayer" + index) != null){
jwplayer("mediaplayer" + index).setup({
flashplayer: "js/libs/jwplayer/player.swf",
width: "400",
height: "250",
controlbar: "bottom",
file: filename,
image: meta_array[index].thumbnail
});
}
} else if (interface_id == 3){
var filename = "video/sc/" + videos_array[index].filename + ".flv";
if (jwplayer("mediaplayer" + index) != null){
jwplayer("mediaplayer" + index).setup({
flashplayer: "js/libs/jwplayer/player.swf",
width: "400",
height: "250",
controlbar: "bottom",
file: filename,
image: meta_array[index].thumbnail
});
}
}
});
/*
function mycarousel_initCallback(carousel) {
$('.jcarousel-control a').click(function() {
carousel.scroll($.jcarousel.intval($('.jcarousel-control a').index($(this))));
return false;
});
}
*/
$(".mycarousel").jcarousel({
scroll: 2,
visible: 11//,
//initCallback: mycarousel_initCallback
});
// lightbox init
$("a.lightbox").lightBox();
});
</script>
<!--
<script>
var _gaq=[['_setAccount','UA-XXXXX-X'],['_trackPageview']];
(function(d,t){var g=d.createElement(t),s=d.getElementsByTagName(t)[0];
g.src=('https:'==location.protocol?'//ssl':'//www')+'.google-analytics.com/ga.js';
s.parentNode.insertBefore(g,s)}(document,'script'));
</script>
-->
</body>
</html>