Compare commits
2 Commits
master
...
feature/pa
Author | SHA1 | Date | |
---|---|---|---|
|
61de35ed4f | ||
9c353cc6e5 |
@ -200,7 +200,9 @@ if (isset($SESS) && !(empty($SESS->values["connected"]) && empty($SESS->values['
|
||||
case "alliances":
|
||||
include("game/alliance.php");
|
||||
break;
|
||||
|
||||
case "classement":
|
||||
include("server/classement.php");
|
||||
break;
|
||||
case "rename":
|
||||
include("game/rename.php");
|
||||
break;
|
||||
|
29
onyx2/include/Class/serveur.php
Normal file
29
onyx2/include/Class/serveur.php
Normal file
@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
class Serveur
|
||||
{
|
||||
|
||||
/**
|
||||
* Constructeur
|
||||
*
|
||||
* @return void
|
||||
* @access public
|
||||
*/
|
||||
public function Serveur()
|
||||
{
|
||||
return ;
|
||||
}
|
||||
|
||||
public function classement($race = "all")
|
||||
{
|
||||
global $table_user;
|
||||
$bdd = new BDD();
|
||||
$get_race = "";
|
||||
if ($race === "humain" || $race === "covenant") {
|
||||
$get_race = "WHERE race = '$race'";
|
||||
}
|
||||
$classement = $bdd->query("SELECT id, pseudo, place_points, points, race FROM $table_user $get_race ORDER BY place_points ASC LIMIT 100;");
|
||||
$bdd->deconnexion();
|
||||
return $classement;
|
||||
}
|
||||
}
|
19
onyx2/include/server/classement.php
Normal file
19
onyx2/include/server/classement.php
Normal file
@ -0,0 +1,19 @@
|
||||
<?php
|
||||
if (!defined('ONYX')) {
|
||||
exit;
|
||||
}
|
||||
$titre = 'Classement';
|
||||
$page = $p;
|
||||
|
||||
//Récupération et vérification de la race voulue ou définition d'une race par défaut
|
||||
if (empty($_GET['r']) || (gpc('r') != 'humain' && gpc('r') != 'covenant')) {
|
||||
$_GET['r'] = "global";
|
||||
}
|
||||
$race = gpc('r');
|
||||
|
||||
require_once("Class/serveur.php");
|
||||
$serveur = new Serveur();
|
||||
$classement = $serveur->classement($race);
|
||||
$template->assign('joueurs', $classement);
|
||||
$template->assign('user', $planete->id_user);
|
||||
$template->assign('raceAff', $race);
|
22
onyx2/tpl/game/classement.tpl
Normal file
22
onyx2/tpl/game/classement.tpl
Normal file
@ -0,0 +1,22 @@
|
||||
{include file='game/header.tpl'}
|
||||
<h2>Classement</h2>
|
||||
|
||||
Race : <a href="{$menu.classement}">Global</a> - <a href="{$menu.classement}&r=humain">Humains</a> - <a href="{$menu.classement}&r=covenant">Covenants</a>
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<th>Rang</th>
|
||||
<th>Pseudo</th>
|
||||
<th>Race</th>
|
||||
<th>Points</th>
|
||||
</tr>
|
||||
{foreach from=$joueurs item=joueur}
|
||||
<tr {if $joueur.id == $user}style="font-weight:bold;"{/if}>
|
||||
<th>#{$joueur.place_points}</th>
|
||||
<td>{$joueur.pseudo}</td>
|
||||
<td>{$joueur.race}</td>
|
||||
<td>{$joueur.points}</td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
</table>
|
||||
{include file='game/footer.tpl'}
|
Loading…
Reference in New Issue
Block a user