-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstationEditor.php
130 lines (104 loc) · 2.49 KB
/
stationEditor.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
<?php
include ('config.php');
include ('init.php');
include ('include.php');
$eventId = $_GET['eventId'];
//get quantity of stations from event
$query = 'SELECT stations
FROM ' . $mysql_database_name . '.shootevent
WHERE id='. $eventId;
$result = dbquery($query);
$row = mysqli_fetch_assoc($result);
$stations = $row['stations'];
$i = 1;
//generate that amount of stations each time the page is loaded
//shootevent+stationNumber are UNIQUE, so repeated INSERTs are ignored
while ($i <= $stations){
$query = 'INSERT INTO `eventstation`
(`id`, `shootEventId`, `stationNumber`, `maxScore`, `tieBreakerPosition`, `stationDetail`)
VALUES (NULL, \''. $eventId .'\', \''. $i .'\', NULL, NULL, NULL);';
dbqueryl($query);
$i++;
};
?>
<!DOCTYPE html>
<html>
<head>
<title>Station Editor</title>
<?php
include 'header.php';
?>
<style type="text/css">
tr {
height:30px;
}
tr.erow td, tr.nrow td {
width:100px;
text-overflow: ellipsis;
white-space: nowrap;
overflow:hidden;
}
td.editing input {
width: inherit;
}
td.action, th.action {
width:120px;
}
th {
text-align: left;
}
.id, .shootEventId{
width:50px !important;
}
.stationNumber, .maxScore, .tieBreakerPosition{
width:90px !important;
}
.stationDetail {
width:150px !important;
}
</style>
</head>
<body>
<h1>Station Editor</h1>
<p> Editing Stations in the <b>
<?php
$query = 'SELECT eventType
FROM shootevent
WHERE id='. $eventId;
$result = dbquery($query);
$row = mysqli_fetch_assoc($result);
echo $row['eventType'];
?>
Event</b> of the <b>
<?php
$query = 'SELECT registeredshoot.shootName
FROM registeredshoot
JOIN shootevent
ON registeredshoot.id=shootevent.shootId
WHERE shootevent.id = ' . $eventId;
$result = dbquery($query);
$row = mysqli_fetch_array($result);
echo $row['shootName'];
?>
</b> Registered Shoot</p>
<div class="stationTable"></div>
</body>
<?php
include 'footer.php';
?>
<script type="text/javascript">
$(function() {
var eventsTable = new EditableTable({
db: '<?= $mysql_database_name ?>',
dbTable: 'eventstation',
columnHeaders: ['ID','Event ID','Station No.','Max Score','Tiebreaker','Singles','True Pairs','Report Pairs','Following Pairs','Station Details'],
uneditableColumns: ['id','shootEventId'],
element: $('.stationTable'),
});
eventsTable.loadTable(0,100,'shootEventId = <?= $eventId ?>');
$('#all').click(function(){
$('.erow').trigger('click');
});
});
</script>
</html>