forked from RetroAchievements/RAWeb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgameList.php
210 lines (164 loc) · 7.32 KB
/
gameList.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
205
206
207
208
209
210
<?php
require_once('db.inc.php');
$consoleList = getConsoleList();
$consoleIDInput = seekGET( 'c', 0 );
settype( $consoleIDInput, 'integer' );
$showCompleteGames = seekGET( 'f', 0 ); // 0 = no filter, 1 = only complete, 2 = only incomplete
settype( $showCompleteGames, 'integer' );
$sortBy = seekGET( 's', 0 );
$gamesCount = getGamesListWithNumAchievements( $consoleIDInput, $gamesList, $sortBy );
//echo $gamesCount;
$requestedConsole = "";
if( $consoleIDInput !== 0 )
{
$requestedConsole = " " . $consoleList[ $consoleIDInput ];
}
RA_ReadCookieCredentials( $user, $points, $truePoints, $unreadMessageCount, $permissions );
$pageTitle = "Supported Games" . $requestedConsole;
$errorCode = seekGET( 'e' );
RenderDocType();
?>
<head>
<?php RenderSharedHeader( $user ); ?>
<?php RenderTitleTag( $pageTitle, $user ); ?>
<?php RenderGoogleTracking(); ?>
</head>
<body>
<?php RenderTitleBar( $user, $points, $truePoints, $unreadMessageCount, $errorCode ); ?>
<?php RenderToolbar( $user, $permissions ); ?>
<div id="mainpage">
<div id="leftcontainer">
<?php
echo "<div class=\"navpath\">";
if( $requestedConsole == "" )
{
echo "<b>All Games</b>";
}
else //if( $requestedConsole != "" )
{
echo "<a href=\"/gameList.php\">All Games</a>";
echo " » <b>$requestedConsole games</b></a>";
}
echo "</div>";
echo "<div class='largelist'>";
// Output all console lists fetched
foreach( $consoleList as $consoleID => $consoleName )
{
if( $consoleIDInput == 0 || $consoleIDInput == $consoleID )
{
// Cut out empty consoles:
$dataExists = FALSE;
foreach( $gamesList as $gameEntry )
{
if( $gameEntry[ 'ConsoleID' ] == $consoleID )
{
$dataExists = TRUE;
break;
}
}
if( $dataExists == FALSE )
continue;
//
echo "<h3 class='longheader'>$consoleName games with achievements:</h3>";
if( $showCompleteGames == 0 )
echo "<h4>All games</h4>";
else if( $showCompleteGames == 1 )
echo "<h4>Complete games</h4>";
else if( $showCompleteGames == 2 )
echo "<h4>Incomplete games</h4>";
if( $showCompleteGames != 0 )
echo "<a href='/gameList.php?c=$consoleIDInput&f=0&s=$sortBy'>Show All</a> | ";
else
echo "Show All | ";
if( $showCompleteGames != 1 )
echo "<a href='/gameList.php?c=$consoleIDInput&f=1&s=$sortBy'>Show Complete Only</a> | ";
else
echo "Show Complete Only | ";
if( $showCompleteGames != 2 )
echo "<a href='/gameList.php?c=$consoleIDInput&f=2&s=$sortBy'>Show Incomplete Only</a>";
else
echo "Show Incomplete Only";
echo "<table class='smalltable'><tbody>";
$sort1 = ($sortBy == 1) ? 11 : 1;
$sort2 = ($sortBy == 2) ? 12 : 2;
$sort3 = ($sortBy == 3) ? 13 : 3;
$sort4 = ($sortBy == 4) ? 14 : 4;
echo "<tr>";
echo "<th><a href='/gameList.php?s=$sort1&c=$consoleIDInput'>Title</a></th>";
echo "<th class='smallthtitle'><a href='/gameList.php?s=$sort2&c=$consoleIDInput'>Num Achieve-ments</a></th>";
echo "<th class='smallthtitle'><a href='/gameList.php?s=$sort3&c=$consoleIDInput'>Points Available</a></th>";
echo "<th class='smallthtitle'><a href='/gameList.php?s=$sort4&c=$consoleIDInput'>Leader-boards Available</a></th>";
echo "</tr>";
$gameCount = 0;
$pointsTally = 0;
$achievementsTally = 0;
$truePointsTally = 0;
$MaxGamePoints = 400;
foreach( $gamesList as $gameEntry )
{
if( $gameEntry[ 'ConsoleID' ] == $consoleID )
{
$title = $gameEntry[ 'Title' ];
$gameID = $gameEntry[ 'ID' ];
$maxPoints = $gameEntry[ 'MaxPointsAvailable' ];
$totalTrueRatio = $gameEntry[ 'TotalTruePoints' ];
$numAchievements = $gameEntry[ 'NumAchievements' ];
$numLBs = $gameEntry[ 'NumLBs' ];
$gameIcon = $gameEntry[ 'GameIcon' ];
if( $showCompleteGames == 1 && $maxPoints < $MaxGamePoints )
continue;
if( $showCompleteGames == 2 && $maxPoints >= $MaxGamePoints )
continue;
echo "<tr>";
echo "<td>";
echo GetGameAndTooltipDiv( $gameID, $title, $gameIcon, NULL );
echo "</td>";
echo "<td>$numAchievements</td>";
echo "<td>$maxPoints <span class='TrueRatio'>($totalTrueRatio)</span></td>";
if( $numLBs > 0 )
echo "<td><a href=\"game/$gameID\">$numLBs</a></td>";
else
echo "<td>-</td>";
echo "</tr>";
$pointsTally += $maxPoints;
$achievementsTally += $numAchievements;
$truePointsTally += $totalTrueRatio;
}
}
// Totals:
echo "<tr>";
echo "<td><b>Totals:</b></td>";
echo "<td><b>$achievementsTally</b></td>";
echo "<td><b>$pointsTally</b><span class='TrueRatio'> ($truePointsTally)</span></td>";
echo "<td></td>";
echo "</tr>";
echo "</tbody></table>";
}
}
/* if( $consoleIDInput !== 0 )
{
echo "<br/>";
echo "<a href=\"/gameList.php\">View all consoles...</a><br/>";
} */
echo "</div>";
?>
<br/>
</div>
<div id='rightcontainer'>
<?php
if( $user == NULL )
{
RenderTutorialComponent();
}
RenderScoreLeaderboardComponent( $user, $points, FALSE );
if( $user !== NULL )
{
RenderScoreLeaderboardComponent( $user, $points, TRUE );
}
RenderRecentlyUploadedComponent( 10 );
?>
</div>
</div>
<?php RenderFooter(); ?>
</body>
</html>