-
Notifications
You must be signed in to change notification settings - Fork 0
/
play.php
executable file
·221 lines (184 loc) · 6.75 KB
/
play.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
<?php
session_start();
require("StakeTinder.php");
$stakemembers = $_SESSION['StakeMembers'];
$warddata = $_SESSION['warddata'];
$warddata_ref = $_SESSION['warddatareference'];
$wards = json_encode($warddata);
$wards_ref = json_encode($warddata_ref);
$data = json_encode($stakemembers);
?>
<!DOCTYPE HTML>
<html>
<head>
<title>Stake Tinder</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="stylesheet" href="assets/css/main.css" />
<style>
#chartdiv {
width: 100%;
height: 500px;
margin: auto;
}
</style>
<script>
stakemembers = JSON.parse('<?=$data?>');
current_person = 0;
wards = JSON.parse('<?=$wards?>'); //JSON.parse('{"10308":{"name":"Provo YSA 196th Ward","unitNumber":10308,"value":0},"10839":{"name":"Provo YSA 197th Ward","unitNumber":10839,"value":0},"75019":{"name":"Provo YSA 198th Ward","unitNumber":75019,"value":0},"74837":{"name":"Provo YSA 199th Ward","unitNumber":74837,"value":0},"91189":{"name":"Provo YSA 200th Ward","unitNumber":91189,"value":0},"161543":{"name":"Provo YSA 201st Ward","unitNumber":161543,"value":0},"194042":{"name":"Provo YSA 202nd Ward","unitNumber":194042,"value":0},"227870":{"name":"Provo YSA 203rd Ward","unitNumber":227870,"value":0},"227889":{"name":"Provo YSA 204th Ward","unitNumber":227889,"value":0},"270652":{"name":"Provo YSA 205th Ward","unitNumber":270652,"value":0},"275670":{"name":"Provo YSA 206th Ward","unitNumber":275670,"value":0},"413887":{"name":"Provo YSA 207th Ward","unitNumber":413887,"value":0}}
wards_ref = JSON.parse('<?=$wards_ref?>');
function advancePerson(){
current_person++;
document.getElementById("current_profile_name").innerHTML = stakemembers[current_person]['name'];
document.getElementById("current_profile_ward").innerHTML = wards_ref[stakemembers[current_person]['unitNo']]['name'];
document.getElementById("current_profile_photo").src = stakemembers[current_person]['photo'];
if(!imageExists(stakemembers[current_person]['photo'])){
advancePerson();
}
}
function yes(){
advancePerson();
for(var i=0;i<wards.length;i++){
var id = wards[i]['unitNo'];
if(id == stakemembers[current_person]['unitNo']){
wards[i]['value'] = wards[i]['value']+1;
}
}
chart.validateData();
/*$.ajax({
url: "recieve_input.php",
type: "post",
data: {
person_id: stakemembers[current_person]["id"],
marked: "yes"
},
success: function(response) {
},
error: function(xhr) {
//Do Something to handle error
}
});*/
}
function no(){
advancePerson();
/*$.ajax({
url: "recieve_input.php",
type: "post",
data: {
person_id: stakemembers[current_person]["id"],
marked: "no"
},
success: function(response) {
},
error: function(xhr) {
//Do Something to handle error
}
});*/
}
function imageExists(image_url){
var http = new XMLHttpRequest();
http.open('HEAD', image_url, false);
http.send();
return http.status != 404;
}
//json_encode($stakemembers);
</script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<script src="https://www.amcharts.com/lib/3/amcharts.js"></script>
<script src="https://www.amcharts.com/lib/3/serial.js"></script>
<script src="https://www.amcharts.com/lib/3/plugins/export/export.min.js"></script>
<link rel="stylesheet" href="https://www.amcharts.com/lib/3/plugins/export/export.css" type="text/css" media="all" />
<script src="https://www.amcharts.com/lib/3/themes/light.js"></script>
<script>
chart = AmCharts.makeChart( "chartdiv", {
"type": "serial",
"theme": "light",
"dataProvider": wards,
"valueAxes": [ {
"gridColor": "#FFFFFF",
"gridAlpha": 0.2,
"dashLength": 0
} ],
"gridAboveGraphs": true,
"startDuration": 1,
"graphs": [ {
"balloonText": "[[category]]: <b>[[value]]</b>",
"fillAlphas": 0.8,
"lineAlpha": 0.2,
"type": "column",
"valueField": "value"
} ],
"chartCursor": {
"categoryBalloonEnabled": false,
"cursorAlpha": 0,
"zoomable": false
},
"categoryField": "name",
"categoryAxis": {
"gridPosition": "start",
"gridAlpha": 0,
"tickPosition": "start",
"tickLength": 20
},
"export": {
"enabled": true
}
} );
</script>
</head>
<body class="subpage">
<!-- Header -->
<header id="header">
<nav class="left">
<a href="#menu"><span>Menu</span></a>
</nav>
<a href="index.php" class="logo">Stake Tinder</a>
</header>
<!-- Menu -->
<nav id="menu">
<ul class="links">
<li><a href="index.php">Home</a></li>
</ul>
</nav>
<!-- Main -->
<section id="main" class="wrapper">
<div class="inner">
<header class="align-center">
<h1><div id="current_profile_name"></div></h1>
<script>document.getElementById("current_profile_name").innerHTML = stakemembers[current_person]['name'];</script>
<p><div id="current_profile_ward"></div></p>
<script>document.getElementById("current_profile_ward").innerHTML = wards_ref[stakemembers[current_person]['unitNo']]['name'];</script>
<img id="current_profile_photo" height="350px"/>
<script>document.getElementById("current_profile_photo").src = stakemembers[current_person]['photo'];</script></p>
</header>
<center>
<button class="big" style="font-size:25px;" onclick="no()">✖</button>
<button class="big" style="font-size:25px;" onclick="yes()">✓</button>
</center>
</div>
</section>
<section id="two" class="wrapper">
<div id="chartdiv"></div>
</section>
<!-- Footer -->
<footer id="footer">
<!--<div class="inner">
<h2>Get In Touch</h2>
<ul class="actions">
<li><span class="icon fa-phone"></span> <a href="#">(000) 000-0000</a></li>
<li><span class="icon fa-envelope"></span> <a href="#">[email protected]</a></li>
<li><span class="icon fa-map-marker"></span> 123 Somewhere Road, Nashville, TN 00000</li>
</ul>
</div>
<div class="copyright">
© Untitled. Design <a href="https://templated.co">TEMPLATED</a>. Images <a href="https://unsplash.com">Unsplash</a>.
</div>-->
</footer>
<!-- Scripts -->
<script src="assets/js/jquery.min.js"></script>
<script src="assets/js/jquery.scrolly.min.js"></script>
<script src="assets/js/skel.min.js"></script>
<script src="assets/js/util.js"></script>
<script src="assets/js/main.js"></script>
</body>
</html>