forked from kestasjk/webDiplomacy
-
Notifications
You must be signed in to change notification settings - Fork 13
/
halloffame.php
executable file
·172 lines (137 loc) · 5.62 KB
/
halloffame.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
<?php
/*
Copyright (C) 2004-2010 Kestas J. Kuliukas
This file is part of webDiplomacy.
webDiplomacy is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
webDiplomacy is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with webDiplomacy. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* Hall of fame; the top 100 webDip scorers
*
* @package Base
* @subpackage Game
*/
require_once('header.php');
libHTML::starthtml();
print libHTML::pageTitle(l_t('Hall of fame'),l_t('The webDiplomacy hall of fame; the 100 highest ranking players on this server.'));
print '<p align="center"><img src="'.l_s('images/points/stack.png').'" alt=" " title="'.l_t('webDiplomacy points').'" /></p>';
print '<p></p>';
print '<button class="SearchCollapsible">All Time</button>';
print'<div class="advancedSearchContent">';
if ( $User->type['User'] && $User->points > 100 )
{
list($position) = $DB->sql_row("SELECT COUNT(id)+1 FROM wD_Users WHERE points > ".$User->points);
$players = $Misc->RankingPlayers;
print '<p class = "hof">'.l_t('You are ranked %s out of %s players with over 100%s','<a href="#me" class="light">#'.$position.'</a>',$players,libHTML::points()).
l_t('. For more stats on your ranking, visit <a class="light" href="profile.php?userID='.$User->id.'">your profile</a>.').'</p>';
}
$i=1;
$crashed = $DB->sql_tabl("SELECT id, username, points FROM wD_Users order BY points DESC LIMIT 100 ");
print "<TABLE class='hof'>";
print "<tr>";
print '<th class= "hof">Points/Rank</th>';
print '<th class= "hof">User</th>';
print "</tr>";
$showMe = 1;
while ( list($id, $username, $points) = $DB->tabl_row($crashed) )
{
print ' <tr class="hof">
<td class="hof"> '.number_format($points).' '.libHTML::points().' - #'.$i.' </td>';
if ($User->username == $username)
{
print '<td class="hof"><a class="hof-self" href="profile.php?userID='.$id.'">'.$username.'</a></td> ';
$showMe = 0;
}
else
{
print '<td class="hof"><a href="profile.php?userID='.$id.'">'.$username.'</a></td> ';
}
print' </tr>';
$i++;
}
if ( $User->type['User'] && $User->points > 100 and $showMe == 1 )
{
print ' <tr class="hof">
<td class="hof">...</td>
<td class="hof">...</td>
</tr>';
print ' <tr class="hof">
<td class="hof"> '.number_format($User->points).' '.libHTML::points().' - <a name="me"></a>#'.$position.' </td>
<td class="hof hof-self"><strong><em>'.$User->username.'</em></strong></td>
</tr>';
}
print '</table>';
print '</div>';
print '</br></br>';
print '<button class="SearchCollapsible">Active (Last 6 Months)</button>';
print'<div class="advancedSearchContent"></br>';
$sixMonths = time() - 15552000;
if ( $User->type['User'] && $User->points > 100 && $User->timeLastSessionEnded > $sixMonths)
{
list($position) = $DB->sql_row("SELECT COUNT(id)+1 FROM wD_Users WHERE points > ".$User->points." AND timeLastSessionEnded > ".$sixMonths);
list($playersSixMonths) = $DB->sql_row("SELECT COUNT(1) FROM wD_Users WHERE points > 100 AND timeLastSessionEnded > ".$sixMonths);
print '<p class = "hof">'.l_t('You are ranked %s out of %s players with over 100%s who have been active in the last six months','<a href="#me" class="light">#'.$position.'</a>',$playersSixMonths,libHTML::points()).
l_t('. For more stats on your ranking visit <a class="light" href="profile.php?userID='.$User->id.'">your profile</a>.').'</p>';
}
$i=1;
$crashed = $DB->sql_tabl("SELECT id, username, points FROM wD_Users WHERE timeLastSessionEnded > ".$sixMonths." order BY points DESC LIMIT 100 ");
print "<TABLE class='hof'>";
print "<tr>";
print '<th class= "hof">Points/Rank</th>';
print '<th class= "hof">User</th>';
print "</tr>";
$showMe = 1;
while ( list($id, $username, $points) = $DB->tabl_row($crashed) )
{
print ' <tr class="hof">
<td class="hof"> '.number_format($points).' '.libHTML::points().' - #'.$i.' </td>';
if ($User->username == $username)
{
print '<td class="hof"><a class="hof-self" href="profile.php?userID='.$id.'">'.$username.'</a></td> ';
$showMe = 0;
}
else
{
print '<td class="hof"><a href="profile.php?userID='.$id.'">'.$username.'</a></td> ';
}
print' </tr>';
$i++;
}
if ( $User->type['User'] && $User->points > 100 && $User->timeLastSessionEnded > $sixMonths and $showMe == 1 )
{
print ' <tr class="hof">
<td class="hof">...</td>
<td class="hof">...</td>
</tr>';
print ' <tr class="hof">
<td class="hof"> '.number_format($User->points).' '.libHTML::points().' - <a name="me"></a>#'.$position.' </td>
<td class="hof hof-self"><strong><em>'.$User->username.'</em></strong></td>
</tr>';
}
print '</table>';
print '</div>';
print '</div>';
?>
<script>
var coll = document.getElementsByClassName("SearchCollapsible");
var searchCounter;
for (searchCounter = 0; searchCounter < coll.length; searchCounter++) {
coll[searchCounter].addEventListener("click", function() {
this.classList.toggle("active");
var content = this.nextElementSibling;
if (content.style.display === "block") { content.style.display = "none"; }
else { content.style.display = "block"; }
});
}
</script>
<?php
libHTML::footer();
?>