-
Notifications
You must be signed in to change notification settings - Fork 0
/
cancelMosaique.php
88 lines (61 loc) · 2.21 KB
/
cancelMosaique.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
<?php
session_start();
$logged = false;
include "db.php";
if(isset($_SESSION["id"])){
$userId = $_SESSION["id"];
$logged = true;
updateUserLastSeen($_SESSION["id"]);
}
$nbIdsMarked = intval($_GET['nbIdsMarked']);
$nbIdsSpecial = intval($_GET['nbIdsSpecial']);
$nbIds = intval($_GET['nbIds']);
$type=$_GET['type'];
$marked = [];
$all = [];
$special = [];
for($i = 0 ; $i < $nbIds ; $i++){
$tmp = 'id'.$i;
array_push($all, intval($_GET[$tmp]));
}
for($i = 0 ; $i < $nbIdsMarked ; $i++){
$tmp = 'idMarked'.$i;
array_push($marked, intval($_GET[$tmp]));
}
for($i = 0 ; $i < $nbIdsSpecial ; $i++){
$tmp = 'idSpecial'.$i;
array_push($special, intval($_GET[$tmp]));
}
deleteLast16TagsUser($userId);
for($i = 0 ; $i < $nbIds ; $i++){
decreaseNbTimesTaggedImage($all[$i]);
}
if($logged){
$val = count($marked) + count($special);
$val = - $val;
updateUserScore($userId, $val);
}
if($_SESSION["privileges"] == 1){
echo '<div id="progressBar">';
$nbTagged = getNbImagesTaggedActive($type);
$nbImages = getNbEntriesActive($type);
$percentage = round(($nbTagged/$nbImages)*100, 2);
echo '<div id="bar" style="width:'.$percentage.'%">';
echo round(($nbTagged/$nbImages)*100, 2).'% Tagged';
echo '</div>';
echo '</div>';
}
echo '<h1>Mark the ';echo $type; echo '</h1>';
echo '<div class="grid">';
$ids = $all;
for($i = 0 ; $i < 16 ; $i++){
$id = $ids[$i];
echo '<div class="element-item">';
echo '<img id=stop'; echo $i ; echo ' src="assets/stop.png" style="width:75%;position:absolute ; display:none ;pointer-events: none">';
echo '<img id=tick'; echo $i ; echo ' src="assets/ok.png" style="width:75% ;position:absolute ; display:none ;pointer-events: none">';
echo '<img imageId="';echo $id;echo '" value="0" id="';echo $i; echo '" class="tile'.$type.'" src="Images/';echo $type; echo '/' ; echo $id; echo '.png" onclick="markTile(';echo $i;echo ',';echo $id;echo ', false)" >';
echo '</div>';
}
echo '</div>';
echo '<p><button id="yes" style="float:right;" class="btn btn-primary" role="button" onclick="updateTagger(callBackReloadIsotope, \'';echo $type ; echo '\'' ; echo ' )" >OK</button></p>';
?>