-
-
Notifications
You must be signed in to change notification settings - Fork 69
/
_stats_heatmap.php
118 lines (107 loc) · 5.46 KB
/
_stats_heatmap.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
<script type="text/javascript">
function generateHeatmap() {
$("#generateButton").attr("disabled","disabled");
var type = $("#eventType").val();
$.post("<?php echo url_for("matchs_heatmap_data", $match); ?>",
{ type: type, rounds : $("#eventRounds").val(), sides : $("#eventSide").val(), players: $("#eventPlayers").val() },
function(data) {
processData(data.points);
$("#generateButton").removeAttr("disabled");
}, "json");
}
function processData(points) {
if (heatmap) {
heatmap.clear();
for(var i in points) {
point = points[i];
heatmap.store.addDataPoint(point.x, point.y);
};
}
}
var heatmap;
window.onload = function(){
heatmap = h337.create(
{
"element": document.getElementById("heatmapArea"),
"radius" : 11,
"opacity": 40,
"visible": true,
"gradient" : { 0.45: "rgb(0,0,255)", 0.55: "rgb(0,255,255)", 0.65: "rgb(0,255,0)", 0.95: "yellow", 1: "rgb(255,0,0)"}
}
);
};
</script>
<div class="container-fluid">
<div class="row-fluid">
<div class="span8">
<div class="modal" style="position:relative; top:auto; left:auto; margin:0 auto 20px; z-index:1; width: auto;max-width:100%;">
<div class="modal-header">
<h3><?php echo __("Heatmap"); ?></h3>
</div>
<div class="modal-body" style="max-height: 0%; text-align: center;">
<div id="heatmapArea" style="border: 5px solid black; border-radius: 10px; position:relative; background-image: url(<?php echo image_path($class_heatmap->getMapImage(), true); ?>); width: <?php echo $class_heatmap->getResX(); ?>px; height: <?php echo $class_heatmap->getResY(); ?>px;">
</div>
</div>
</div>
</div>
<div class="span4">
<div class="modal" style="position:relative; top:auto; left:auto; margin:0 auto 20px; z-index:1; width: auto;max-width:100%;">
<div class="modal-header">
<h3><?php echo __("Configuration"); ?></h3>
</div>
<div class="modal-body" style="max-height: 0%;">
<div class="form-horizontal">
<div class="control-group">
<label class="control-label"><?php echo __("Event"); ?></label>
<div class="controls">
<select id="eventType">
<option value="kill" selected>Kill</option>
<option value="hegrenade">HE grenade</option>
<option value="flashbang">Flash</option>
<option value="smokegrenade">Smoke</option>
<option value="molotv">Molotov</option>
<option value="decoy">Decoy</option>
<option value="allstuff"><?php echo __("All Events"); ?></option>
</select>
</div>
</div>
<div class="control-group">
<label class="control-label"><?php echo __("Rounds"); ?></label>
<div class="controls">
<select id="eventRounds" multiple="true">
<?php foreach ($match->getRoundSummaries() as $round): ?>
<option value="<?php echo $round->getRoundId(); ?>"><?php echo __("Round"); ?> #<?php echo $round->getRoundId(); ?></option>
<?php endforeach; ?>
</select>
</div>
</div>
<div class="control-group">
<label class="control-label"><?php echo __("Side"); ?></label>
<div class="controls">
<select id="eventSide">
<option value="all"><?php echo __("Both Sides"); ?></option>
<option value="ct"><?php echo __("Side CT"); ?></option>
<option value="t"><?php echo __("Side T"); ?>/option>
</select>
</div>
</div>
<div class="control-group">
<label class="control-label"><?php echo __("Players"); ?></label>
<div class="controls">
<select id="eventPlayers" multiple="true">
<?php foreach ($match->getPlayers() as $player): ?>
<?php if ($player->getTeam() == "other") continue; ?>s
<option value="<?php echo $player->getId(); ?>"><?php echo $player->getPseudo(); ?></option>
<?php endforeach; ?>
</select>
</div>
</div>
</div>
</div>
<div class="modal-footer">
<button class="btn btn-primary" onclick="generateHeatmap();" id="generateButton"><?php echo __("Generate Heatmap"); ?></button>
</div>
</div>
</div>
</div>
</div>