-
Notifications
You must be signed in to change notification settings - Fork 2
/
spc-table.php
204 lines (191 loc) · 5.75 KB
/
spc-table.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
<?php
include_once __dir__ . "/ajax/PointsCenter.php";
$points_center = new \Slivka\PointsCenter();
$showall = isset($_GET['all']) ? $_GET['all'] == '1' : false;
$qtr = $points_center->getQuarter();
$quarters = $points_center->getQuarters();
$points_table = $points_center->getPointsTable($showall);
?>
<div class="row points-table-controls">
<div class="col-md-4">
<div class="alert alert-info points-table-info">
<p>Hover over names for info, click arrows to sort.</p>
<p><?php
echo "Showing " . count($points_table['events']) . " events. ";
if(count($points_table['events']) >= 20){
if(!$showall){
echo '<a href="./?all=1&qtr=' . $qtr . '"><strong>Show All</strong></a>';
}else{
echo '<a href="./?qtr=' . $qtr . '"><strong>Reset</strong></a>';
}
}
?></p>
</div>
<table class="legend">
<tr>
<td>Colors: </td>
<td class="green">Point</td>
<td class="blue">Committee</td>
<td class="gold">Helper</td>
<td class="red">None</td>
</tr>
</table>
</div>
<div class="col-md-8">
<div class="form-group">
<label for="nameFilter">Name</label>
<input type="text" class="form-control" id="nameFilter">
</div>
<div class="form-group">
<label for="genderFilter">Gender</label>
<select class="form-control" id="genderFilter">
<option value="">All</option>
<option value="m">M</option>
<option value="f">F</option>
</select>
</div>
<div class="form-group">
<label for="imFilter">IMs</label>
<select class="form-control" id="imFilter">
<option value="0">All</option>
<option value="1">No IMs</option>
<option value="2">Only IMs</option>
</select>
</div>
<div class="form-group">
<label for="committeeFilter">Committes:</label><br>
<select class="multiselect" multiple="multiple" id="committeeFilter" style="display: none;">
<option selected>Exec</option>
<option selected>Academic</option>
<option selected>Facilities</option>
<option selected>Faculty</option>
<option selected>IT</option>
<option selected>Philanthropy</option>
<option selected>Publications</option>
<option selected>Social</option>
<option selected value="CA">RA</option>
<option selected>Other</option>
</select>
<div class="btn-group placeholder">
<div class="btn btn-default">All selected (10) <b class="caret"></b></div>
</div>
</div>
<div class="form-group">
<div class="dropdown">
<a class="btn btn-default" data-toggle="dropdown" href="#">Quarter <b class="caret"></b></a>
<ul class="dropdown-menu" role="menu" aria-labelledby="dLabel">
<li><a href="./"><?= $quarters[0]['quarter'] ?></a></li>
<?php for($i=1; $i<count($quarters); $i++){ ?>
<li><a href="./?all=1&qtr=<?= $quarters[$i]['qtr'] ?>"><?= $quarters[$i]['quarter'] ?></a></li>
<?php } ?>
</ul>
</div>
</div>
<div class="form-group">
<a href="#stats" class="btn btn-default show-stats" data-toggle="modal">Stats</a>
</div>
</div>
</div>
<div class="points-table-wrapper">
<table id="table" class="points-table">
<thead>
<tr>
<th class="name"><div><div></div></div><span>Name</span></th>
<th style="display:none;"></th>
<?php for($i=0; $i<count($points_table['events']); $i++){ ?>
<th class="event">
<div class="slanted">
<span><?= substr($points_table['events'][$i]['event_name'],0,-11) ?></span>
</div>
<div class="sort-icon"></div>
</th>
<?php }
$totalsColumns = array("Events Total", "Helper Points", "IM Sports", "Standing Committees", "Other", "Total");
for($i=0; $i<count($totalsColumns); $i++){ ?>
<th class="total">
<div class="slanted">
<span><?= $totalsColumns[$i] ?></span>
</div>
<div class="sort-icon"></div>
</th>
<?php } ?>
<th class="end">
<div class="slanted"></div>
<div class="sort-icon"></div>
</th>
</tr>
</thead>
<tbody>
<?php
$odd = true;
$indent = "\t\t\t";
foreach($points_table['points_table'] AS $tr){
if(end($tr) == "0"){
continue;
}
if($odd){
$odd = false;
echo $indent . "<tr class=\"odd\">\n";
}else{
$odd = true;
echo $indent . "<tr class=\"even\">\n";
}
$rowcount = count($tr);
for($i=0; $i<$rowcount; $i++){
$td = $tr[$i];
echo $indent . "\t";
if($i == 0){
echo '<td class="name">';
}else if($i == 1){
echo '<td class="gender">';
}else if($i >= $rowcount - 6){
echo '<td class="totals">';
}else if($td == 1){
echo '<td class="green">';
}else if($td == 1.1 || $td == 0.1){
$td = floor($td);
echo '<td class="gold">';
}else if($td == 1.2 || $td == 0.2){
$td = floor($td);
echo '<td class="blue">';
}else{
echo '<td>';
}
echo $td . "</td>\n";
}
echo $indent . "\t<td class=\"end\"></td>\n" .
$indent . "</tr>\n";
}
?>
</tbody>
</table>
</div>
<?php include('credits.html'); ?>
<div id="stats" class="modal fade" role="dialog" >
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3>Statistics</h3>
</div>
<div class="modal-body">
<div class="row">
<div class="col-sm-4 col-sm-offset-2">
<table class="table table-striped" id="years">
<tr><th>Class Year</th><th>Avg Pts</th></tr>
</table>
</div>
<div class="col-sm-4">
<table class="table table-striped" id="suites">
<tr><th>Suite</th><th>Avg Pts</th></tr>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
<script type="text/javascript">
window.qtr = <?= (isset($qtr) ? $qtr : 'null') ?>;
window.points_table = '<?= wordwrap(addslashes(json_encode(array("events"=>$points_table['events'], "by_year"=>$points_table['by_year'], "by_suite"=>$points_table['by_suite']))),800," '+\n'")?>'
</script>