Added leaderboard.php
This commit is contained in:
parent
3830ab8e0f
commit
201782a7cd
@ -15,8 +15,8 @@
|
||||
<orderEntry type="module" module-name="Mineplex.Core.Common" />
|
||||
<orderEntry type="module" module-name="Mineplex.ServerData" />
|
||||
<orderEntry type="library" name="craftbukkit" level="project" />
|
||||
<orderEntry type="library" name="jooq" level="project" />
|
||||
<orderEntry type="module" module-name="Mineplex.Database" />
|
||||
<orderEntry type="library" name="jooq" level="project" />
|
||||
</component>
|
||||
</module>
|
||||
|
||||
|
@ -11,7 +11,7 @@ package mineplex.database.tables;
|
||||
@java.lang.SuppressWarnings({ "all", "unchecked", "rawtypes" })
|
||||
public class TournamentLeaderboard extends org.jooq.impl.TableImpl<mineplex.database.tables.records.TournamentLeaderboard> implements java.io.Serializable, java.lang.Cloneable {
|
||||
|
||||
private static final long serialVersionUID = -2050960225;
|
||||
private static final long serialVersionUID = 1795216465;
|
||||
|
||||
/**
|
||||
* The singleton instance of <code>Account.tournamentLeaderboard</code>
|
||||
@ -57,9 +57,9 @@ public class TournamentLeaderboard extends org.jooq.impl.TableImpl<mineplex.data
|
||||
public final org.jooq.TableField<mineplex.database.tables.records.TournamentLeaderboard, java.lang.Integer> total = createField("total", org.jooq.impl.SQLDataType.INTEGER.nullable(false).defaulted(true), this, "");
|
||||
|
||||
/**
|
||||
* The column <code>Account.tournamentLeaderboard.ratio</code>.
|
||||
* The column <code>Account.tournamentLeaderboard.score</code>.
|
||||
*/
|
||||
public final org.jooq.TableField<mineplex.database.tables.records.TournamentLeaderboard, java.lang.Double> ratio = createField("ratio", org.jooq.impl.SQLDataType.FLOAT, this, "");
|
||||
public final org.jooq.TableField<mineplex.database.tables.records.TournamentLeaderboard, java.lang.Double> score = createField("score", org.jooq.impl.SQLDataType.DOUBLE, this, "");
|
||||
|
||||
/**
|
||||
* Create a <code>Account.tournamentLeaderboard</code> table reference
|
||||
|
@ -11,7 +11,7 @@ package mineplex.database.tables.records;
|
||||
@java.lang.SuppressWarnings({ "all", "unchecked", "rawtypes" })
|
||||
public class TournamentLeaderboard extends org.jooq.impl.UpdatableRecordImpl<mineplex.database.tables.records.TournamentLeaderboard> implements java.io.Serializable, java.lang.Cloneable, org.jooq.Record7<java.lang.Integer, java.lang.Integer, java.lang.Integer, java.lang.Integer, java.lang.Integer, java.lang.Integer, java.lang.Double> {
|
||||
|
||||
private static final long serialVersionUID = -1193236965;
|
||||
private static final long serialVersionUID = 1130073862;
|
||||
|
||||
/**
|
||||
* Setter for <code>Account.tournamentLeaderboard.id</code>.
|
||||
@ -98,16 +98,16 @@ public class TournamentLeaderboard extends org.jooq.impl.UpdatableRecordImpl<min
|
||||
}
|
||||
|
||||
/**
|
||||
* Setter for <code>Account.tournamentLeaderboard.ratio</code>.
|
||||
* Setter for <code>Account.tournamentLeaderboard.score</code>.
|
||||
*/
|
||||
public void setRatio(java.lang.Double value) {
|
||||
public void setScore(java.lang.Double value) {
|
||||
setValue(6, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for <code>Account.tournamentLeaderboard.ratio</code>.
|
||||
* Getter for <code>Account.tournamentLeaderboard.score</code>.
|
||||
*/
|
||||
public java.lang.Double getRatio() {
|
||||
public java.lang.Double getScore() {
|
||||
return (java.lang.Double) getValue(6);
|
||||
}
|
||||
|
||||
@ -196,7 +196,7 @@ public class TournamentLeaderboard extends org.jooq.impl.UpdatableRecordImpl<min
|
||||
*/
|
||||
@Override
|
||||
public org.jooq.Field<java.lang.Double> field7() {
|
||||
return mineplex.database.tables.TournamentLeaderboard.tournamentLeaderboard.ratio;
|
||||
return mineplex.database.tables.TournamentLeaderboard.tournamentLeaderboard.score;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -252,7 +252,7 @@ public class TournamentLeaderboard extends org.jooq.impl.UpdatableRecordImpl<min
|
||||
*/
|
||||
@Override
|
||||
public java.lang.Double value7() {
|
||||
return getRatio();
|
||||
return getScore();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -314,7 +314,7 @@ public class TournamentLeaderboard extends org.jooq.impl.UpdatableRecordImpl<min
|
||||
*/
|
||||
@Override
|
||||
public TournamentLeaderboard value7(java.lang.Double value) {
|
||||
setRatio(value);
|
||||
setScore(value);
|
||||
return this;
|
||||
}
|
||||
|
||||
@ -340,7 +340,7 @@ public class TournamentLeaderboard extends org.jooq.impl.UpdatableRecordImpl<min
|
||||
/**
|
||||
* Create a detached, initialised TournamentLeaderboard
|
||||
*/
|
||||
public TournamentLeaderboard(java.lang.Integer id, java.lang.Integer tournamentId, java.lang.Integer accountId, java.lang.Integer gameId, java.lang.Integer wins, java.lang.Integer total, java.lang.Double ratio) {
|
||||
public TournamentLeaderboard(java.lang.Integer id, java.lang.Integer tournamentId, java.lang.Integer accountId, java.lang.Integer gameId, java.lang.Integer wins, java.lang.Integer total, java.lang.Double score) {
|
||||
super(mineplex.database.tables.TournamentLeaderboard.tournamentLeaderboard);
|
||||
|
||||
setValue(0, id);
|
||||
@ -349,6 +349,6 @@ public class TournamentLeaderboard extends org.jooq.impl.UpdatableRecordImpl<min
|
||||
setValue(3, gameId);
|
||||
setValue(4, wins);
|
||||
setValue(5, total);
|
||||
setValue(6, ratio);
|
||||
setValue(6, score);
|
||||
}
|
||||
}
|
||||
|
125
Webpages/leaderboard.php
Normal file
125
Webpages/leaderboard.php
Normal file
@ -0,0 +1,125 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>The Fall Invitational Leaderboard</title>
|
||||
<meta http-equiv="refresh" content="30">
|
||||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
|
||||
<style type="text/css">
|
||||
.table td.center, .table th.center {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.panel-heading {
|
||||
text-align: center;
|
||||
font-size: 18pt;
|
||||
font-weight: bold;
|
||||
color: orange!important;
|
||||
background-color: #333!important;
|
||||
border-color: #333!important;
|
||||
}
|
||||
|
||||
.panel-primary {
|
||||
border-color: #333!important;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="jumbotron" style="text-align: center">
|
||||
<div class="container" style="text-align: center">
|
||||
<img src="mineplex.png" alt="Mineplex"/>
|
||||
<h1>The Fall Invitational</h1>
|
||||
<h2>Tournament Leaderboard</h2>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<hr/>
|
||||
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
|
||||
<?php
|
||||
|
||||
$tournamentTypes = array('Super Smash Mobs', 'Survival Games', 'Mixed Arcade');
|
||||
|
||||
$con = mysqli_connect('db.mineplex.com', 'root', 'tAbechAk3wR7tuTh', 'Account');
|
||||
|
||||
for ($i = 0; $i < count($tournamentTypes); $i++)
|
||||
{
|
||||
?>
|
||||
<div class="col-md-4">
|
||||
<div class="panel panel-primary">
|
||||
<div class="panel-heading"><?php echo $tournamentTypes[$i] ?></div>
|
||||
<div class="table-responsive">
|
||||
<table class="table">
|
||||
<col style="width: 15%">
|
||||
<col style="width: 40%">
|
||||
<col style="width: 15%">
|
||||
<col style="width: 15%">
|
||||
<col style="width: 15%">
|
||||
<tr>
|
||||
<th class="center">Rank</th>
|
||||
<th>Player</th>
|
||||
<th class="center">Wins</th>
|
||||
<th class="center">Losses</th>
|
||||
<th class="center">Score*</th>
|
||||
</tr>
|
||||
<?php
|
||||
|
||||
$query = <<<QUERY
|
||||
SELECT name, wins, total, score
|
||||
FROM tournamentLeaderboard
|
||||
JOIN accounts ON accounts.id = accountId
|
||||
WHERE tournamentId = 0
|
||||
AND gameId = $i
|
||||
AND score IS NOT NULL
|
||||
ORDER BY score DESC, name ASC
|
||||
LIMIT 50;
|
||||
QUERY;
|
||||
|
||||
$result = mysqli_query($con, $query);
|
||||
|
||||
$index = 1;
|
||||
$rank = 1;
|
||||
$lastScore = null;
|
||||
|
||||
while($row = mysqli_fetch_array($result))
|
||||
{
|
||||
$score = $row['score'];
|
||||
|
||||
if ($score != $lastScore)
|
||||
{
|
||||
$rank = $index;
|
||||
}
|
||||
|
||||
?>
|
||||
<tr>
|
||||
<td class="center"><?php echo $rank ?></td>
|
||||
<td><?php echo $row['name'] ?></td>
|
||||
<td class="center"><?php echo $row['wins'] ?></td>
|
||||
<td class="center"><?php echo ($row['total'] - $row['wins']) ?></td>
|
||||
<td class="center"><?php echo round($score*100, 3) ?></td>
|
||||
</tr>
|
||||
<?php
|
||||
|
||||
$index++;
|
||||
$lastScore = $score;
|
||||
}
|
||||
|
||||
?>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
|
||||
mysqli_close($con);
|
||||
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
<p style="text-align: center; font-style: italic">*Score = 100 × Wins × (Wins / Total)<sup>3</sup></p>
|
||||
<hr/>
|
||||
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue
Block a user