forked from RetroAchievements/RAWeb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgameSearch.php
170 lines (125 loc) · 3.91 KB
/
gameSearch.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
<?php
require_once('db.inc.php');
RA_ReadCookieCredentials( $user, $points, $truePoints, $unreadMessageCount, $permissions );
$maxCount = 50;
$consoleList = getConsoleList();
$consoleList[0] = 'All Consoles';
ksort( $consoleList ); // Bump 'All Consoles' to the top
$count = seekGET( 'c', $maxCount );
$offset = seekGET( 'o', 0 );
$method = seekGET( 'p', 0 );
settype( $method, 'integer' );
$consoleID = seekGET( 'i', 0 );
settype( $consoleID, 'integer' );
$gameData = getGameListSearch( $offset, $count, $method, $consoleID );
//var_dump( $gameData );
$pageTitle = "Game Search";
$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'>";
echo "<b>$pageTitle</b>"; // NB. This will be a stub page
echo "</div>";
echo "<div class='detaillist'>";
echo "<h3 class='longheader'>$pageTitle</h3>";
echo "<p>Showing: games by largest RetroRatio:</p>";
echo "<p>Filter: ";
foreach( $consoleList as $nextConsoleID => $nextConsoleName )
{
if( $nextConsoleID > 0 )
echo " | ";
if( $nextConsoleID == $consoleID )
echo "<b>$nextConsoleName</b>";
else
echo "<a href='gameSearch.php?o=0&p=$method&i=$nextConsoleID'>$nextConsoleName</a>";
}
echo "</p>";
// echo "Show: | ";
// if( $method==0 ) echo "by number of awards given";
// else echo "<a href='/popularGames.php?p=0'>by number of awards given</a>";
// echo " | ";
// if( $method==1 ) echo "by unique members played ";
// else echo "<a href='/popularGames.php?p=1'>by unique members played</a> ";
// echo " | ";
echo "<table><tbody>";
echo "<th>Rank</th>";
echo "<th>Game</th>";
echo "<th>Genre</th>";
echo "<th>Publisher</th>";
echo "<th>Developer</th>";
echo "<th>Total Retro Ratio</th>";
//$countCol = ( $method == 0 ) ? "Awards Given" : "Played By";
//echo "<th>$countCol</th>";
$count = 0;
foreach( $gameData as $gameEntry )
{
$count++;
$gameID = $gameEntry['ID'];
$gameTitle = $gameEntry['Title'];
$gameForumTopicID = $gameEntry['ForumTopicID'];
$gameFlags = $gameEntry['Flags'];
$gameIcon = $gameEntry['ImageIcon'];
$gamePublisher = $gameEntry['Publisher'];
$gameDeveloper = $gameEntry['Developer'];
$gameGenre = $gameEntry['Genre'];
$gameReleased = $gameEntry['Released'];
$gameTA = $gameEntry['TotalTruePoints'];
$consoleName = $gameEntry['ConsoleName'];
//$numRecords = $gameEntry['NumRecords'];
echo "<tr>";
echo "<td>";
echo ($count)+($offset);
echo "</td>";
echo "<td style='min-width:30%'>";
echo GetGameAndTooltipDiv( $gameID, $gameTitle, $gameIcon, $consoleName );
echo "</td>";
echo "<td>";
echo "$gameGenre";
echo "</td>";
echo "<td>";
echo "$gamePublisher";
echo "</td>";
echo "<td>";
echo "$gameDeveloper";
echo "</td>";
echo "<td>";
echo "$gameTA";
echo "</td>";
echo "</tr>";
}
echo "</tbody></table>";
echo "</div>";
echo "<div class='rightalign row'>";
if( $offset > 0 )
{
$prevOffset = $offset - $maxCount;
echo "<a href='/gameSearch.php?o=$prevOffset&p=$method&i=$consoleID'>< Previous $maxCount</a> - ";
}
if( $count == $maxCount )
{
// Max number fetched, i.e. there are more. Can goto next 25.
$nextOffset = $offset + $maxCount;
echo "<a href='/gameSearch.php?o=$nextOffset&p=$method&i=$consoleID'>Next $maxCount ></a>";
}
echo "</div>";
?>
<br/>
</div>
<div id='rightcontainer'>
<?php RenderRecentlyUploadedComponent( 10 ); ?>
</div>
</div>
<?php RenderFooter(); ?>
</body>
</html>