-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
369 lines (321 loc) · 14.8 KB
/
index.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
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
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
<?php
/*
* This file is part of Data Dashboard Project.
* Copyright [email protected] January 2012 where applicable
*
* Data Dashboard Project is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Foobar is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Foobar. If not, see <http://www.gnu.org/licenses/>.
*
*/
?>
<!DOCTYPE html>
<html lang="en">
<head>
<?php
$title = "Dashboard";
include("header.php");
?>
<link href="assets/css/exhibit.css" rel="stylesheet">
<style>
body {
padding-top: 60px;
}
</style>
<?php include("process_data/process_backend_data.php"); ?>
<?php include("process_data/process_stage2_data.php"); ?>
<?php include("process_data/process_stage1_data.php"); ?>
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<script type="text/javascript">
google.load("visualization", "1", {packages:["corechart"]});
google.setOnLoadCallback(drawChart);
function drawChart() {
var data = google.visualization.arrayToDataTable([
['Task', 'Hours per Day'],
<?php
foreach ($backend_region_pie as $key => $value) {
echo "['" . $key . "'," . $value . "],";
}
?>
]);
var options = {
title: 'Organistaion Type'
};
var chart = new google.visualization.PieChart(document.getElementById('chart_div'));
chart.draw(data, options);
google.visualization.events.addListener(chart, 'click', selectHandler);
}
</script>
<script type="text/javascript">
google.load("visualization", "1", {packages:["corechart"]});
google.setOnLoadCallback(drawChart);
function drawChart() {
var data = google.visualization.arrayToDataTable([
['Task', 'Hours per Day'],
<?php
foreach ($backend_area_of_focus_pie as $key => $value) {
echo "['" . $key . "'," . $value . "],";
}
?>
]);
var options = {
title: 'Area of focus'
};
var chart = new google.visualization.PieChart(document.getElementById('chart_div2'));
chart.draw(data, options);
google.visualization.events.addListener(chart, 'click', selectHandler);
function selectHandler() {
var selectedItem = chart.getSelection()[0];
if (selectedItem) {
var topping = data.getValue(selectedItem.row, 0);
if (topping == "Young People") {
window.location.assign("http://bntest.vm.bytemark.co.uk/david/nominet/website/exhibit_backend.php#eyJub3JtYWxpemVkIjp0cnVlLCJ0aXRsZSI6Ik5vbWluZXQgVHJ1c3Qge1NlbGVjdCBvbmx5IFlvdW5nIFBlb3BsZSBpbiBmYWNldCBBcmVhIE9mIEZvY3VzfSIsInVybCI6Imh0dHA6Ly9ibnRlc3Qudm0uYnl0ZW1hcmsuY28udWsvZGF2a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3JkZXJzIjpbeyJwcm9wZXJ0eSI6ImxhYmVsIiwiZm9yd2FyZCI6dHJ1ZSwiYXNjZW5kaW5nIjp0cnVlfSx7InByb3BlcnR5IjoiT3JnYW5pc2F0aW9uX3R5cGUiLCJmb3J3YXJkIjp0cnVlLCJhc2NlbmRpbmciOnRydWV9XSwic2hvd0FsbCI6dHJ1ZSwic2hvd0R1cGxpY2F0ZXMiOmZhbHNlLCJncm91cGVkIjp0cnVlLCJwYWdlIjowfX19LCJ2aWV3UGFuZWwtZGVmYXVsdC0wIjp7InR5cGUiOiJ2aWV3UGFuZWwiLCJzdGF0ZSI6eyJ2aWV3SW5kZXgiOjB9fX0sInN0YXRlIjoxLCJsZW5ndGh5Ijp0cnVlfSwiaWQiOiIxMzYwMTU1ODEyMTY5MDUwNjg1NDc4NzAwMzI0ODkiLCJjbGVhblVybCI6Imh0dHA6Ly9ibnRlc3Qudm0uYnl0ZW1hcmsuY28udWsvZGF2aWQvbm9taW5ldC93ZWJzaXRlL2V4aGliaXRfYmFja2VuZC5waHAiLCJoYXNoZWRVcmwiOiJodHRwOi8vYm50ZXN0LnZtLmJ5dGVtYXJrLmNvLnVrL2RhdmlkL25vbWluZXQvd2Vic2l0ZS8vZGF2aWQvbm9taW5ldC93ZWJzaXRlL2V4aGliaXRfYmFja2VuZC5waHA_Jl9zdWlkPTEzNjAxNTU4MTIxNjkwNTA2ODU0Nzg3MDAzMjQ4OSJ9");
}
}
}
}
</script>
<script type="text/javascript">
google.load("visualization", "1", {packages:["corechart"]});
google.setOnLoadCallback(drawChart);
function drawChart() {
var data = google.visualization.arrayToDataTable([
['Year', 'Applications'],
<?php
foreach ($stage2_years as $key => $value) {
echo "['" . $key . "'," . $value . "],";
}
?>
]);
var options = {
title: 'Stage 2 Applications by year',
hAxis: {title: 'Year', titleTextStyle: {color: 'red'}}
};
var chart = new google.visualization.ColumnChart(document.getElementById('chart_div4'));
chart.draw(data, options);
}
</script>
<script type="text/javascript">
google.load("visualization", "1", {packages:["corechart"]});
google.setOnLoadCallback(drawChart);
function drawChart() {
var data = google.visualization.arrayToDataTable([
['Benficiaries', 'Funding'],
<?php
$i=0;
foreach ($this_row_to_array['NT_funding'] as $row) {
$i++;
if ($i <50) {
echo "[" . $row . "],";
}
}
?>
]);
var options = {
title: 'Beneficiaries vs. Funding (50 projects)',
hAxis: {title: 'Beneficiaries', minValue: 0, maxValue: 100000},
vAxis: {title: 'Funding', minValue: 0, maxValue: 1000000},
legend: 'none'
};
var chart = new google.visualization.ScatterChart(document.getElementById('chart_div5'));
chart.draw(data, options);
}
</script>
</head>
<body>
<?php include("top_nav.php"); ?>
<div class="container">
<div class="span12">
<div class="span3" style="margin-left:0">
<?php if (isset($org)) { echo "Filter: Organisation Type = " . $org; } ?>
</div>
</div>
<div class="span12">
<h3>Funded Projects</h3>
<div class="span5">
<div id="chart_div" style="width: 500px; height: 300px;"></div>
</div>
<div class="span5">
<div id="chart_div2" style="width: 500px; height: 300px;"></div>
</div>
<!--<div class="span3">
<div id="chart_div3" style="width: 400px; height: 300px;"></div>
</div>-->
</div>
<div class="span12">
<div>
<!---->
<div class="metric-box">
<div class="title">Total Project Funding</div>
<div class="number"><?php echo "£" . round((array_sum($backend_values["GrantAmount"])/1000000),2) . "M"; ?></div>
</div>
<div class="metric-box">
<div class="title">Number of Projects</div>
<div class="number"><?php echo count($backend_values["GrantAmount"]); ?></div>
</div>
<div class="metric-box">
<div class="title">Mean<br/>Funding</div>
<div class="number"><?php echo "£" . round((array_sum($backend_values["GrantAmount"]) / count($backend_values["GrantAmount"])),0); ?></div>
</div>
<div class="metric-box">
<div class="title">Projects with Websites</div>
<div class="number"><?php echo count($backend_values["Website"]); ?></div>
</div>
<div class="metric-box">
<div class="title">Projects with Twitter</div>
<div class="number"><?php if (isset($backend_values["Twitter_ID"])) { echo count($backend_values["Twitter_ID"]); } else { echo "0"; } ?></div>
</div>
<div class="metric-box">
<div class="title">Project Beneficiaries</div>
<div class="number"><?php echo array_sum($backend_values["TotalBeneficiariesActual"]); ?></div>
</div>
</div>
</div>
<?php
if (!isset($org)) { //only show stage 2 data if $org filter is not set
?>
<div class="span12">
<div class="span5">
<div style="width: 500px; height: 300px;">
<img src="images/staff1.png";/>
</div>
</div>
<div class="span5">
<div style="width: 500px; height: 300px;">
<img src="images/staff2.png";/>
</div>
</div>
<!--<div class="span3">
<div id="chart_div3" style="width: 400px; height: 300px;"></div>
</div>-->
</div>
<?php } ?>
<hr>
<?php
if (!isset($org)) { //only show stage 2 data if $org filter is not set
?>
<div class="span12">
<h3>Applications Stage 2</h3>
<div class="span5">
<div id="chart_div4" style="width: 500px; height: 300px;"></div>
</div>
<div class="span5">
<div id="chart_div5" style="width: 500px; height: 300px;"></div>
</div>
<!--<div class="span3">
<div id="chart_div6" style="width: 400px; height: 300px;"></div>
</div>-->
</div>
<div class="span12">
<div>
<div class="metric-box">
<div class="title">Pending</div>
<div class="number"><?php echo $values["pending"]; ?></div>
</div>
<div class="metric-box">
<div class="title">Approved</div>
<div class="number"><?php echo $values["approved"]; ?></div>
</div>
<div class="metric-box">
<div class="title">In progress</div>
<div class="number"><?php echo $values["inprogress"]; ?></div>
</div>
<div class="metric-box">
<div class="title">Completed</div>
<div class="number"><?php echo $values["completed"]; ?></div>
</div>
<div class="metric-box">
<div class="title">Rejected</div>
<div class="number"><?php echo $values["rejected"]; ?></div>
</div>
<div class="metric-box">
<div class="title">All time </div>
<div class="number"><?php echo array_sum($values); ?></div>
</div>
</div>
</div>
<?php
if (!isset($org)) { //only show stage 2 data if $org filter is not set
?>
<div class="span12">
<img src="images/stage2.png";/>
</div>
<?php } ?>
<?php } else {
?>
<div class="span12">
<h3>Applications Stage 2</h3>
<p>We cannot apply the filter '<?php echo $org; ?>' to this data</p>
</div>
<?php } ?>
<hr>
<div class="span12">
<h3>Applications Stage 1</h3>
<div>
<div class="metric-box">
<div class="title">Pending</div>
<div class="number"><?php if(isset($stage1_values["pending"])) { echo $stage1_values["pending"]; } else { echo "0"; } ?></div>
</div>
<div class="metric-box">
<div class="title">Approved</div>
<div class="number"><?php echo $stage1_values["approved"]; ?></div>
</div>
<div class="metric-box">
<div class="title">In progress</div>
<div class="number"><?php echo $stage1_values["inprogress"]; ?></div>
</div>
<div class="metric-box">
<div class="title">Completed</div>
<div class="number"><?php echo $stage1_values["completed"]; ?></div>
</div>
<div class="metric-box">
<div class="title">Rejected</div>
<div class="number"><?php echo $stage1_values["rejected"]; ?></div>
</div>
<div class="metric-box">
<div class="title">All time </div>
<div class="number"><?php echo array_sum($stage1_values); ?></div>
</div>
</div>
</div>
<?php
if (!isset($org)) { //only show stage 2 data if $org filter is not set
?>
<div class="span12">
<img src="images/stage1.png";/>
</div>
<?php } ?>
</div> <!-- /container -->
<!-- Le javascript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<!--<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script>
<script src="assets/js/bootstrap.min.js"></script>-->
<!--<script src="assets/js/bootstrap-transition.js"></script>
<script src="assets/js/bootstrap-alert.js"></script>
<script src="assets/js/bootstrap-modal.js"></script>
<script src="assets/js/bootstrap-dropdown.js"></script>
<script src="assets/js/bootstrap-scrollspy.js"></script>
<script src="assets/js/bootstrap-tab.js"></script>
<script src="assets/js/bootstrap-tooltip.js"></script>
<script src="assets/js/bootstrap-popover.js"></script>
<script src="assets/js/bootstrap-button.js"></script>
<script src="assets/js/bootstrap-collapse.js"></script>
<script src="assets/js/bootstrap-carousel.js"></script>
<script src="assets/js/bootstrap-typeahead.js"></script>-->
<!--
<script type="text/javascript">
$('.dropdown-toggle').dropdown();
</script>
-->
</body>
</html>