-
Notifications
You must be signed in to change notification settings - Fork 1
/
task.php
216 lines (173 loc) · 11.4 KB
/
task.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
<?php
if (isset($_GET['task'])) {
$taskContents = file_get_contents("data/task.json", true);
$tpc = json_decode($taskContents, true);
$score = 0;
?>
<!DOCTYPE html>
<html>
<?php include 'elements/head.php' ?>
<body class="container" >
<div >
<div class="jumbotron" style="background:white ; text-align: center" >
<h1 class="display-4">Classifying Scientific Abstracts</h1>
<p class="lead">It's time to show your skills</p>
</div>
<div>
<div class="row">
<div style="background-color: #aef9a7" class="card col-md-4">
<span style="text-align: center; width: 100%" ><img style="padding: 5px" src="images/teacher.png" width="80"></span>
<p style="text-align: center; width: 100%" >Training</p>
</div>
<div style="background-color: #efefef" class="card col-md-4">
<span style="text-align: center; width: 100%"><img style="padding: 5px" src="images/document.png" width="80"></span>
<p style="text-align: center; width: 100%">Task</p>
</div>
<div class="card col-md-4">
<span style="text-align: center; width: 100%"><img style="padding: 5px" src="images/checkmark.png" width="80"></span>
<p style="text-align: center; width: 100%">Finish</p>
</div>
</div>
</div>
<?php
$answeredAll = true;
if (isset($_POST)) {
foreach ($_POST as $key => $value) {
if ($value == "select") {
$answeredAll = false;
}
}
}
if ($answeredAll == false) {
echo("<h1 class='display-4'>Sorry you didn't answer all questions.</h1>");
echo("<h4>Go back and try again</h4>");
echo("<button onclick='goBack()' class='btn btn-primary'>Go Back</button>
<script>
function goBack() {
window.history.back();
}
</script>");
} else {
$points = 0;
$contents = file_get_contents("data/training.json", true);
$pc = json_decode($contents, true);
for ($i = 0; $i < 4; $i++) {
if ($pc[$i]["decision"] == $_POST['q' . $i]) {
$points++;
}
}
$maxPoints = count($pc);
$score = $points / $maxPoints;
echo "<div class='alert-danger' style='margin:20px;padding:10px'>";
echo "<div>Here is the result of your test:</div>";
echo ("<h1 class='display-4'>Your score is: " . $score * 100 . "% </h1>");
echo "</div>";
}
?>
</div>
<?php if ($answeredAll) { ?>
<div class="container">
<div id="accordion">
<div class="card">
<div class="card-header" id="headingOne">
<h5 class="mb-0">
<button class="btn btn-link" data-toggle="collapse" data-target="#collapseOne" aria-expanded="true" aria-controls="collapseOne">
Click here to see (remember) the instructions
</button>
</h5>
</div>
<div id="collapseOne" class="collapse" aria-labelledby="headingOne" aria-expanded="false" data-parent="#accordion">
<div class="card-body">
<?php include 'elements/instructions.php' ?>
</div>
</div>
</div>
<div class="jumbotron" style="background:white ; text-align: center" >
<h1 class="display-4">Let's start the task execution!</h1>
<p class="lead">Now that your test score was calculated, you will perform the task.</p>
<p class="lead"><b>Be very careful, your results are very important to us!</b></p>
</div>
<form action="/crowdslr/evaluation.php?task=<?= $_GET['task'] ?>" method="POST">
<br><hr><br>
<input type="hidden" name="q0ic1" value="<?= $_POST['q0ic1'] ?>"/>
<input type="hidden" name="q0ic2" value="<?= $_POST['q0ic2'] ?>"/>
<input type="hidden" name="q0" value="<?= $_POST['q0'] ?>"/>
<input type="hidden" name="q1ic1" value="<?= $_POST['q1ic1'] ?>"/>
<input type="hidden" name="q1ic2" value="<?= $_POST['q1ic2'] ?>"/>
<input type="hidden" name="q1" value="<?= $_POST['q1'] ?>"/>
<input type="hidden" name="q2ic1" value="<?= $_POST['q2ic1'] ?>"/>
<input type="hidden" name="q2ic2" value="<?= $_POST['q2ic2'] ?>"/>
<input type="hidden" name="q2" value="<?= $_POST['q2'] ?>"/>
<input type="hidden" name="q3ic1" value="<?= $_POST['q3ic1'] ?>"/>
<input type="hidden" name="q3ic2" value="<?= $_POST['q3ic2'] ?>"/>
<input type="hidden" name="q3" value="<?= $_POST['q3'] ?>"/>
<input type="hidden" name="testScore" value="<?= $score ?>">
<div class="card " style="margin-top:20px;padding: 20px">
<h3><b><?= $tpc[$_GET['task']]['Title'] ?></b></h3>
<p>Abstract: <?= $tpc[$_GET['task']]['fullAbstract'] ?></p>
<br><br>
<p>IC1 - Does the article focus on aligning Software Engineering education with industrial needs?</p>
<select class="form-control" name="q<?= $tpc[$_GET['task']]['idAbstract'] ?>ic1">
<option value="select">Select an option</option>
<option value="yes">Yes</option>
<option value="no">No</option>
</select>
<br>
<p>IC2 - Is the article based on empirical data and not just the opinion of the authors?</p>
<select class="form-control" name="q<?= $tpc[$_GET['task']]['idAbstract'] ?>ic2">
<option value="select">Select an option</option>
<option value="yes">Yes</option>
<option value="no">No</option>
</select>
<br>
<p>Final decision</p>
<select required="true" class="form-control" name="q<?= $tpc[$_GET['task']]['idAbstract'] ?>">
<option value="select">Select an option</option>
<option value="Included">Included</option>
<option value="Excluded">Excluded</option>
</select>
</div>
<br>
<div class="alert" style="border: #dfdfdf solid 1px">
<p class="lead"> This is an attention test, if you are reading carefully all the task please check "<?= $tpc[$_GET['task']]['attentionTest'] ?>"</p>
<input type="radio" id="atstrongagree" name="attention" value="Strongly Agree">
<label for="atstrongagree">Strongly Agree</label><br>
<input type="radio" id="atsomewhatagree" name="attention" value="Somewhat Agree">
<label for="atsomewhatagree"> Somewhat Agree</label><br>
<input type="radio" id="atundecided" name="attention" value="Neither agree nor disagree">
<label for="atundecided">Neither agree nor disagree</label><br>
<input type="radio" id="atsomawhatdisagree" name="attention" value="Somewhat disagree">
<label for="atsomawhatdisagree">Somewhat disagree</label><br>
<input type="radio" id="atstrongagree" name="attention" value="Strongly disagree">
<label for="atstrongdisagree">Strongly disagree</label><br>
</div>
<div class="alert" style="border: #dfdfdf solid 1px">
<p class="lead"> I am confident that I correctly classified the article. Please check below the level of concordance in this sentence.</p>
<input type="radio" id="strongagree" name="confidence" value="Strongly Agree">
<label for="strongagree">Strongly Agree</label><br>
<input type="radio" id="somewhatagree" name="confidence" value="Somewhat Agree">
<label for="somewhatagree"> Somewhat Agree</label><br>
<input type="radio" id="undecided" name="confidence" value="Neither agree nor disagree">
<label for="undecided">Neither agree nor disagree</label><br>
<input type="radio" id="somawhatdisagree" name="confidence" value="Somewhat disagree">
<label for="somawhatdisagree">Somewhat disagree</label><br>
<input type="radio" id="strongagree" name="confidence" value="Strongly disagree">
<label for="strongdisagree">Strongly disagree</label><br>
</div>
<div class="alert" style="border: #dfdfdf solid 1px">
<label for="reasons">Could you provide, please, reasons for your inclusion or exclusion classification?</label>
<input type="text" class="form-control" name="reasons" placeholder="e.g., this study was out of the scope of Software Engineering"/>
</div>
<div style="margin: 40px;text-align: right;">
<input type="submit" name="submit" style="width: 200px" class="btn btn-success">
</div>
</form>
</div>
<?php } ?>
</body>
</html>
<?php
} else {
echo "<h1>Error: the page you are trying to access does not exist </h1>";
}
?>