-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex3.php
More file actions
232 lines (176 loc) · 7.51 KB
/
Copy pathindex3.php
File metadata and controls
232 lines (176 loc) · 7.51 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
<?php
set_include_path(dirname(__FILE__));
require_once 'Zend/Loader/Autoloader.php';
$autoloader = Zend_Loader_Autoloader::getInstance();
$autoloader->registerNamespace( 'Zend_' );
ini_set('display_errors', 1);
error_reporting(E_ALL);
session_start();
if (isset($_GET['subject'])) {$subject=$_GET['subject'];$_SESSION['subject']=$subject;}
else {
if (isset($_SESSION['subject'])) {$subject=$_SESSION['subject'];}
else {$subject="anonymous";};
}
if (isset($_GET['condnum'])) {$condnum=$_GET['condnum'];}
else {
if (isset($_SESSION['condnum'])) {$condnum=$_SESSION['condnum'];$_SESSION['condnum']=$condnum;}
else {$condnum=-1;};
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="author" content="Christoph Trattner">
<title>Recipe Search Tool</title><!-- page title -->
<script src="js/jquery-2.1.0.min.js"></script>
<link rel="stylesheet" href="css/jquery.typeahead.css">
<script src="js/jquery.typeahead.js"></script>
<script src ="js/tether.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<script language=javascript src="mlweb20.js"></script>
<!-- Bootstrap Core CSS -->
<link href="css/bootstrap.min.css" rel="stylesheet">
<link href="css/font-awesome-4.7.0/css/font-awesome.min.css" rel="stylesheet">
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-34429356-1']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
<body onLoad="timefunction('onload', 'body', 'body')">
<!--BEGIN set vars-->
<script language="javascript">
//override defaults
mlweb_outtype = "CSV";
mlweb_fname = "mlwebform";
chkFrm = false;
warningTxt = "Please answer all questions.";
choice = "";
</script>
<FORM id="mlwebform" name="mlwebform" onSubmit="return false" method="POST" action="save.php">
<INPUT type=hidden id='processData' name="procdata" value="">
<!-- set all variables here -->
<input id="expName" type=hidden name="expname" value="index3">
<input type=hidden name="nextURL" value="SurveyC3.php">
<input type=hidden name="to_email" value="">
<!--these will be set by the script -->
<input type=hidden name="subject" value="<?php echo($subject)?>">
<input type=hidden id="condnum" name="condnum" value="<?php echo($condnum)?>">
<input id="choice" type=hidden name="choice" value="">
<div class="container">
<!-- Page Content -->
<div style="width: 100%; max-width: 500px; margin: 0 auto;">
<br/><br/>
<h2 class="text-center">Recipe Search Tool</h2>
<p class="text-center">Task 3/4</p>
<p>Use the search bar below to search for a recipe. If you do so, eight recipes will appear on your screen. Please inspect them carefully and click on the recipe that you like the most. Afterwards we will ask you a few questions about the chosen recipe and the list of search results. </p>
<p> Please use the search bar below to type in the following search term: <b><?php echo($_SESSION['c3qt']);?></b>. It is important that you use <b>exactly</b> this search term.</p>
Please click on the recipe that you are most likely to make
</p>
<form id="form-user_v1" name="form-user_v1">
<div class="typeahead__container">
<div class="typeahead__field">
<span class="typeahead__query">
<input class="js-typeahead-user_v1" name="user_v1[query]" onfocus="if (this.hasAttribute('readonly')) {
this.removeAttribute('readonly');
// fix for mobile safari to show virtual keyboard
this.blur(); this.focus(); }" type="search" placeholder="Search for recipe" autocomplete="off">
</span>
<span class="typeahead__button">
<button type="submit">
<i class="typeahead__search-icon"></i>
</button>
</span>
</div>
</div>
</form>
<br/>
<script>
$.typeahead({
input: '.js-typeahead-user_v1',
minLength: 1,
dynamic: true,
delay: 500,
backdrop: {
"background-color": "#fff"
},
template: function (query, item) {
var color = "#777";
if (item.status === "owner") {
color = "#ff1493";
}
//alert("hallo");
return '<span class="row">' +
'<span class="image">' +
' <img width="50" src="{{image}}">' +
"</span>" +
' <span class="recipe">{{recipe}}</span>' +
"</span>"
},
emptyTemplate: "no result for {{query}}",
source: {
recipes: {
display: "recipe",
// href: "{{id}}",
/*data: [{
"id": 415849,
"recipe": "an inserted user that is not inside the database",
"image": "https://avatars3.githubusercontent.com/u/415849",
"status": "contributor"
}],*/
ajax: function (query) {
return {
type: "GET",
url: "<?php echo($_SESSION['c3q']);?>",
path: "data.recipes",
data: {
q: "{{query}}"
},
callback: {
done: function (data) {
/*for (var i = 0; i < data.data.recipes.length; i++) {
if (data.data.recipes[i].recipe === 'running-coder') {
data.data.recipes[i].status = 'owner';
} else {
data.data.recipes[i].status = 'contributor';
}
}*/
// console.log(data);
return data;
}
}
}
}
},
},
callback: {
onClick: function (node, a, item, event) {
//add value to form element
$("#choice").val(item.recipe);
timefunction('submit', 'body', 'body')
document.forms[mlweb_fname].submit();
// You can do a simple window.location of the item.href
//alert(JSON.stringify(item));
},
onSendRequest: function (node, query) {
console.log('request is sent')
},
onReceiveRequest: function (node, query) {
console.log('request is received')
}
},
debug: true
});
</script>
</div>
</div>
</form>
</body>
</html>