-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.php
135 lines (98 loc) · 4.35 KB
/
index.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
<?php
session_start();
$ADMIN_PAGE = false;
include_once './_INCLUDES/00_SETUP.php';
include_once './_INCLUDES/dbconnect.php';
$showAll = null;
if(isset($_GET['showAll'])){
$showAll = true;
}
if($showAll)
$allseries = GetSeriesAndGames(false, 0, null);
else
$allseries = GetSeriesAndGames(false, 0, 10);
$seriesHtml = "";
$i = 0;
while($row = mysqli_fetch_array($allseries)){
$leagueid = $row["LeagueID"];
$leagueName = GetLeagueTableABV($leagueid);
$gamesCompleteText = "";
$lastEntryTime = "";
$homeTeamPlayer = GetUserAlias($row["HomeUserID"]);
$awayTeamPlayer = GetUserAlias($row["AwayUserID"]);
$stanleyClass = "";
$bestofNum = NumGamesPerSeries($row["SeriesID"]);
if($row["SeriesWonBy"] != 0){
$gamesNeededToWin = NeededWins($row["SeriesID"]);
// got rid of player ID
//$homeTeam .= " (" . GetTeamABVById($row["HomeTeamID"]) . ")";
//$awayTeam .= " (" . GetTeamABVById($row["AwayTeamID"]) . ")";
$homeTeam = " " . GetTeamABVById($row["HomeTeamID"], $leagueid);
$awayTeam = " " . GetTeamABVById($row["AwayTeamID"], $leagueid);
//$homeTeam .= "<br/><span class='note'>Best of " . $bestofNum . "</span>";
//echo "Num:" . $numGames;
$totalGames = $gamesNeededToWin + $row["LoserNumGames"];
$lastEntryTime = "Series Completed " . $row["DateCompleted"];
if($row["SeriesWonBy"] == $row["HomeUserID"]){
$loser = GetUserAlias($row["AwayUserID"]);
}else{
$loser = GetUserAlias($row["HomeUserID"]);
}
// ***
$gamesCompleteText = GetUserAlias($row["SeriesWonBy"]) . " wins in ".$totalGames." vs " . $loser;
//$gamesCompleteText .= '<br /><span class="note">(' . $homeTeamPlayer . ' v ' . $awayTeamPlayer . ')</span>';
$stanleyClass = "stanley";
}else if($row["TotalGames"] == 0){
$lastEntryTime = "Series Created " . $row["DateCreated"];
//$gamesCompleteText = "Series not yet started.";
}else{
$homeTeam = " " . GetTeamABVById($row["HomeTeamID"], $leagueid);
$awayTeam = " " . GetTeamABVById($row["AwayTeamID"], $leagueid);
$gamesCompleteText .= $homeTeamPlayer . ' vs ' . $awayTeamPlayer;
$gamesCompleteText .= " In progress (" .$row["TotalGames"]. " gms)";
$lastEntryTime = "Last Updated " . HumanTiming($row["LastEntryDate"]) . " ago";
}
$seriesHtml .= '<tr';
if($i % 2 == 0){
$seriesHtml .= " class='stripe'";
}
//Format the Date
$formattedEntryDate = GetDateFromSQL($row["LastEntryDate"]);
$seriesHtml .= '>';
$seriesHtml .= '<td class="c">'.$row['SeriesID'].'</td>';
$seriesHtml .= '<td class="l"><div class="logo small inline ' . $awayTeam . '"></div><div style="display:inline;">vs</div><div class="logo small inline '.$homeTeam.'"></div></td>';
$seriesHtml .= '<td class="td-top">'.$gamesCompleteText.'<br />';
$seriesHtml .= '<span class="note">Best of ' . $bestofNum . '<br/>Updated ' . $formattedEntryDate. '<br/>Bin: ' . $leagueName . '</span></td>';
$seriesHtml .= '<td class="c"><button type="button" class="square" onclick="location.href=\'resultsSeries.php?seriesId='. $row['SeriesID'].'\'">Select</button>';
if($LOGGED_IN == true)
if($_SESSION['userId'] == $row["HomeUserID"] || $_SESSION['userId'] == $row["AwayUserID"])
$seriesHtml .= '<br/><button type="button" style="margin-top: 10px;" class="square" onclick="location.href=\'update.php?seriesId='. $row['SeriesID'].'\'"> Edit </button></td>';
$seriesHtml .= '</tr>';
$i++;
}
?><!DOCTYPE HTML>
<html>
<head>
<title>NHL94Rocks Game Saver</title>
<?php include_once './_INCLUDES/01_HEAD.php'; ?>
</head>
<body>
<div id="page">
<?php include_once './_INCLUDES/02_NAV.php'; ?>
<div id="main">
<h1>Lastest Scores</h1>
<table class="standard">
<tr class="heading">
<td class="c"><span class="note">series</span><br />#</td>
<td class="l">Teams</td>
<td class="l">Status / Update</td>
<td class="l"> </td>
</tr>
<?= $seriesHtml ?>
</table>
</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>