-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmanage.php
149 lines (108 loc) · 4.27 KB
/
manage.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
<?php
session_start();
$ADMIN_PAGE = true;
include_once './_INCLUDES/00_SETUP.php';
include_once './_INCLUDES/dbconnect.php';
if ($LOGGED_IN == true) {
$msg = "";
if(isset($_GET['err'])){
switch ($_GET['err']){
case 0:
$seriesid= $_GET['seriesId'];
$msg = "Series # " . $seriesid ." has been deleted.";
break;
default:
$msg = "";
break;
}
}
$showAll = null;
if(isset($_GET['showAll'])){
$showAll = true;
}
if($showAll)
$allseries = GetSeriesAndGames(false, 0, null);
else
$allseries = GetSeriesAndGames(false, 0, 25);
// User wants to update an existing series so gab all the series games and show in drop down box
//$allseries = GetSeriesAndGames(true,0, null);
$numSeries = mysqli_num_rows($allseries);
$seriesHtml = '<table class="hidden lined">';
while($row = mysqli_fetch_array($allseries)){
$gamesCompleteText = $row["TotalGames"];
$lastEntryTime = "";
$gamesNeededToWin = NeededWins($row["SeriesID"]);
if($row["SeriesWonBy"] != 0){
$lastEntryTime = "Series Completed " . GetDateFromSQL($row["DateCompleted"]);
$gamesCompleteText = "Series won by " . GetUserAlias($row["SeriesWonBy"]) . " " . $gamesNeededToWin ." games to " . $row["LoserNumGames"];
}else if($row["TotalGames"] == 0){
$lastEntryTime = "Series Created " . $row["DateCreated"];
$gamesCompleteText = "Series not yet started.";
}else{
if($row["TotalGames"] == 1)
$gamesCompleteText .= " game completed";
else
$gamesCompleteText .= " games completed";
$lastEntryTime = "Last Updated " . HumanTiming($row["LastEntryDate"]) . " ago";
}
$lastEntryTime .= "<br/>Bin:" . GetLeagueTableABV($row["LeagueID"]);
$seriesHtml .= '<tr class="">';
$seriesHtml .= '<td><button type="button" class="square" onclick="DeleteSeries(\'' .$row['SeriesID'].'\',\'' . $row["Name"] .'\')">X</button></td>';
$seriesHtml .= '<td class="c">' . $row['SeriesID'] .'</td>';
$seriesHtml .= '<td class=""><b>'.$row['Name'].'</b> - ' . $gamesCompleteText.'<br />';
$seriesHtml .= '<span class="note">'.$lastEntryTime. '</span><br />';
$seriesHtml .= '<!-- Series creator: matt -->';
$seriesHtml .= '</td>';
$seriesHtml .= '<td class="r"><button type="button" class="square" onclick="location.href=\'update.php?seriesId='. $row['SeriesID'].'\'">Select</button></td>';
$seriesHtml .= '</tr>';
}
$seriesHtml .= '</table>';
?><!DOCTYPE HTML>
<html>
<head>
<title>Manage Series</title>
<?php include_once './_INCLUDES/01_HEAD.php'; ?>
</head>
<body>
<div id="page">
<?php include_once './_INCLUDES/02_NAV.php'; ?>
<div id="main">
<?php include_once './_INCLUDES/03_LOGIN_INFO.php'; ?>
<h1>Exis</h1>
<h2>1. Create New Exi Series</h2>
<div style="color:red;"><?= $msg ?></div><br/><br/>
<table class="two-column">
<tr class="">
<td class=""><a href="./create.php" class="square-button">Create</a></td>
<td class="">Create a new series</td>
</tr>
</table>
<p><br /></p>
<h2>2. Update Existing Series</h2>
Total Series: <?= $numSeries ?></br>
<?= $seriesHtml ?>
<button type="button" onclick="javascript:location.href='manage.php?showAll=true'" style="margin-top: 10px;">Show All</button>
<!-- Example
<table class="hidden lined">
<tr class="">
<td><button type="button" class="square">X</button></td>
<td class="c">101</td>
<td class=""><b>TOR vs WPG</b> - <nobr>4 games completed</nobr><br />
<span class="note">Last Updated 3 minutes ago</span><br />
</td>
<td class="r"><button type="button" class="square" onclick="location.href='update.php?seriesId=95'">Select</button></td>
</tr>
</table>
End Example -->
</div>
</div><!-- end: #page -->
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.0/jquery.min.js"></script>
<script src="./js/default.js"></script>
</body>
</html>
<?php
}
else {
header('Location: index.php');
}
?>