-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstationCardPageNew.php
More file actions
234 lines (205 loc) · 6.31 KB
/
stationCardPageNew.php
File metadata and controls
234 lines (205 loc) · 6.31 KB
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
<html>
<head>
<title>MP Scheduler</title>
<link href="https://fonts.googleapis.com/css?family=Roboto+Slab:300|Slabo+27px" rel="stylesheet">
<link rel="stylesheet" type="text/css" href="stationCardPage.css">
<link rel="stylesheet" type="text/css" href="frontPage.css">
<link rel="stylesheet" type="text/css" href="common.css">
<link rel="stylesheet" type="text/css" href="schedulePage.css">
<!-- TODO: all of the above css should be combined into 2 files, one common and one just for this page -->
</head>
<body>
<?php
include'headerLogo.php';
session_start();
?>
<header>
<h1 id="title">Station Cards</h1>
</header>
<main id="main">
<button id="studentCardButton" class="buttons"><a href="studentsCardPageNew.php">Create Student Cards</a></button>
<button id="printButton" class="buttons"><a href="javascript:window.print()">Print</a></button>
<div id="tableHolder"></div>
</main>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
<script src="https://cdn.datatables.net/1.10.16/js/jquery.dataTables.min.js"></script>
<script src="studentsCardPage.js"></script>
<script>
console.log(document.cookie);
var games = {
div1:["Calla", "Shape-up", "Kings & Quads", "Hex-A-Gone", "Star Track"],
div2:["Fiar", "Sum Dominoes & Dice", "Quatro Sinko", "Par 55", "Ramrod"],
div3:["Fab-A-Diffy", "Stars & Bars", "Contig 60", "Queens & Guards", "Juggle"],
div4:["Fraction Pinball", "Pent Em' In", "Prime Gold", "Remainder Islands", "Frac Fact"]
};
var student = ("<?php echo $_SESSION['students'] ?>");
var studentNames1 = student.split(",");
var counter = 1;
for (var i = 0; i < studentNames1.length; i++) {
if (studentNames1[i] == "") {
studentNames1 = studentNames1.filter(e => e !== "");
}
}
for (var i = counter; i > 0; i++) {
if (studentNames1.length % 2 === 0) {
break;
} else {
studentNames1.push("Extra Player");
}
}
console.log(student);
console.log(studentNames1);
var monitor = ("<?php echo $_SESSION['monitors'] ?>");
var monitorNamesStart = monitor.split(",");
var monitorNames = [];
for (var i = 0; i < studentNames1.length/2; i++) {
monitorNames.push(monitorNamesStart[i])
}
for (var i = 0; i < monitorNames.length; i++) {
if (monitorNames[i] == "") {
monitorNames = monitorNames.filter(e => e !== "");
}
}
for (var i = counter; i > 0; i++) {
if (studentNames1.length / 2 === monitorNames.length) {
break;
} else {
monitorNames.push("Extra Monitor "+i);
}
}
console.log(monitor);
console.log(monitorNames);
var division = ("<?php echo $_SESSION['division'] ?>");
console.log(division);
var getGames = games[division];
console.log(getGames);
var opponent1 = [];
var opponent2 = [];
//round 2
var studentNames1Length = studentNames1.length;
var studentNames2 = [studentNames1[0],studentNames1[studentNames1Length-1]];
for (var i = 1; i < studentNames1Length-1; i++) {
studentNames2.push(studentNames1[i]);
}
//round 3
var studentNames2Length = studentNames2.length;
var studentNames3 = [studentNames2[0],studentNames2[studentNames2Length-1]];
for (var i = 1; i < studentNames2Length-1; i++) {
studentNames3.push(studentNames2[i]);
}
//round 4
var studentNames3Length = studentNames3.length;
var studentNames4 = [studentNames3[0],studentNames3[studentNames3Length-1]];
for (var i = 1; i < studentNames3Length-1; i++) {
studentNames4.push(studentNames3[i]);
}
//round 5
var studentNames4Length = studentNames4.length;
var studentNames5 = [studentNames4[0],studentNames4[studentNames4Length-1]];
for (var i = 1; i < studentNames4Length-1; i++) {
studentNames5.push(studentNames4[i]);
}
var NumOfStations = studentNames1.length/2;
for (var s = 0; s < NumOfStations; s++) {
var opponent1index = s;
var opponent2index = studentNames1.length-s-1;
var stationNum = s+1;
table=[];
table+='<h2>';
table+='Station '+stationNum;
table+='</h2>';
table+='<table id="stationCards" class="sortable" border="0" cellspacing="0" cellpadding="0">';
table+='<thead><th id="round">Round</th><th id="opponent1">Opponent 1</th><th id="opponent2">Opponent 2</th><th id="monitor">Monitor</th><th id="game">Game</th></tr></thead><tbody>';
table+='<tr>';
table+='<td>';
table+='1';
table+='</td>';
table+='<td>';
table+=studentNames1[opponent1index];
table+='</td>';
table+='<td>';
table+=studentNames1[opponent2index];
table+='</td>';
table+='<td>';
table+=monitorNames[s];
table+='</td>';
table+='<td>';
table+=getGames[0];
table+='</td>';
table+='</tr>';
table+='<tr>';
table+='<td>';
table+='2';
table+='</td>';
table+='<td>';
table+=studentNames2[opponent1index];
table+='</td>';
table+='<td>';
table+=studentNames2[opponent2index];
table+='</td>';
table+='<td>';
table+=monitorNames[s];
table+='</td>';
table+='<td>';
table+=getGames[1];
table+='</td>';
table+='</tr>';
table+='<tr>';
table+='<td>';
table+='3';
table+='</td>';
table+='<td>';
table+=studentNames3[opponent1index];
table+='</td>';
table+='<td>';
table+=studentNames3[opponent2index];
table+='</td>';
table+='<td>';
table+=monitorNames[s];
table+='</td>';
table+='<td>';
table+=getGames[2];
table+='</td>';
table+='</tr>';
table+='<tr>';
table+='<td>';
table+='4';
table+='</td>';
table+='<td>';
table+=studentNames4[opponent1index];
table+='</td>';
table+='<td>';
table+=studentNames4[opponent2index];
table+='</td>';
table+='<td>';
table+=monitorNames[s];
table+='</td>';
table+='<td>';
table+=getGames[3];
table+='</td>';
table+='</tr>';
table+='<tr>';
table+='<td>';
table+='5';
table+='</td>';
table+='<td>';
table+=studentNames5[opponent1index];
table+='</td>';
table+='<td>';
table+=studentNames5[opponent2index];
table+='</td>';
table+='<td>';
table+=monitorNames[s];
table+='</td>';
table+='<td>';
table+=getGames[4];
table+='</td>';
table+='</tr>';
table+='</tbody>';
table+='</table>';
console.log(table);
$("#tableHolder").append(table);
}
</script>
</body>
</html>