small fixes on top10 clan + added a method to read out the clans that are capable of clan-fights!

main
hecht 13 years ago
parent 7e06965ea6
commit 646090ae7a

@ -18,23 +18,29 @@ $wahl = $_GET['wahl'];
if ($wahl == 'geld') {
$wahl_x = 'Geld';
} elseif ($wahl == 'siege' OR $wahl == 'niederlagen' OR $wahl == 'unentschieden') {
$wahl_y = 'Elo';
} elseif ($wahl == 'siege' OR $wahl == 'niederlagen') {
$wahl_x= 'Siege';
$wahl_y= 'Niederlagen';
$wahl_z= 'Unentschieden';
$wahl_z = 'Elo';
} elseif ($wahl == 'elo'){
$wahl_x= 'Siege';
$wahl_y= 'Niederlagen';
$wahl_z = 'Elo';
} else {
$wahl = 'siege';
$wahl_x= 'Siege';
$wahl_y= 'Niederlagen';
$wahl_z= 'Unentschieden';
$wahl_z = 'Elo';
}
$char_s = mysql_query('SELECT i.siege, i.leader, i.niederlagen, i.unentschieden, i.geld, i.clanname, i.id, u.nickname, (Select count(*) from user u1 where clan = i.id) as member, (Select 10 - count(*) from user u2 where clan = i.id and ((i.leader is null || i.leader != u2.id) and (i.co_leader is null ||i.co_leader != u2.id))) as freeslots, (select sum(spende) as summe from user_clan where clanid = i.id) as summe FROM clan i LEFT JOIN user u ON(i.leader=u.id) ORDER BY i.'.$wahl.' DESC LIMIT 50');
$sql = 'SELECT i.siege, i.leader, i.niederlagen, i.geld, i.clanname, i.id, u.nickname, (Select count(*) from user u1 where clan = i.id) as member, (Select 10 - count(*) from user u2 where clan = i.id and ((i.leader is null || i.leader != u2.id) and (i.co_leader is null ||i.co_leader != u2.id))) as freeslots, (select sum(spende) as summe from user_clan where clanid = i.id) as summe, elo FROM clan i LEFT JOIN user u ON(i.leader=u.id) ORDER BY i.'.$wahl.' DESC LIMIT 50';
//echo $sql . '<br>';
$char_s = mysql_query($sql);
?>
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%" height="1">
<!-- MSTableType="layout" -->
<tr><th colspan="6">Diese Seite befindet sich gerade im Umbau, daher k&ouml;nnen ein paar Fehler auftreten!</th></tr>
<tr>
<td valign="middle" colspan="3">
<p align="center">
@ -42,10 +48,17 @@ $char_s = mysql_query('SELECT i.siege, i.leader, i.niederlagen, i.unentschieden,
<input type="hidden" name="as" value="clan/c_ranglist" />
<input type="hidden" name="char_name" value="<?php echo $char_name; ?>" />
<select id="input" name="wahl">
<option value="siege">Siege
<option value="unentschieden">Unentschieden
<option value="niederlagen">Niederlagen
<option value="geld">Geld
<?php
$choices = array('elo', 'siege', 'niederlagen', 'geld');
$choice_labels = array('ELO-Wertung', 'Siege', 'Niederlagen', 'Geld');
for($i = 0; $i< count($choices); $i++) {
$selected = '';
if($wahl == $choices[$i]) {
$selected = ' selected="selected"';
}
echo '<option value="'.$choices[$i].'"'.$selected.'>'.$choice_labels[$i].'</option>'. PHP_EOL;
}
?>
</select>&nbsp;&nbsp;&nbsp;
<input id="input" type=submit value="ordnen" />
</form>
@ -63,11 +76,12 @@ $char_s = mysql_query('SELECT i.siege, i.leader, i.niederlagen, i.unentschieden,
<?php
if ($wahl != 'geld') {
echo '<th valign="middle" height="25">'.$wahl_x.'</th>';
echo '<th valign="middle" height="25">'.$wahl_z.'</th>';
echo '<th valign="middle" height="25">'.$wahl_y.'</th>';
echo '<th valign="middle" height="25">'.$wahl_z.'</th>';
} else {
echo '<th valign="middle" height="25">'.$wahl_x.' Aktuell</th>';
echo '<th validn="middle" height="25">'.$wahl_x.' &#8721;</th>';
echo '<th valign="middle" height="25">'.$wahl_z.'</th>';
}
?>
</tr>
@ -86,8 +100,8 @@ while($row = mysql_fetch_assoc($char_s)) {
echo '<th valign="middle" height="25" bgcolor="'.$cols[$x].'" align="center">'.displayMoney($row['summe']).'</th>';
} else {
echo '<th valign="middle" height="25" bgcolor="'.$cols[$x].'" align="center">'.displayCount($row[strtolower($wahl_x)]).'</th>';
echo '<th valign="middle" height="25" bgcolor="'.$cols[$x].'" align="center">'.displayCount($row[strtolower($wahl_z)]).'</th>';
echo '<th valign="middle" height="25" bgcolor="'.$cols[$x].'" align="center">'.displayCount($row[strtolower($wahl_y)]).'</th>';
echo '<th valign="middle" height="25" bgcolor="'.$cols[$x].'" align="center">'.displayCount($row[strtolower($wahl_z)]).'</th>';
}
echo '</tr>'."\n";

@ -198,6 +198,7 @@ function getAllClans() {
}
return $clans;
}
function joinClan($user, $clanid){
// last chance to lock the clan if in the old situation it was having to few members ;)
isClanLocked($clanid); // we only require the calculation not the result!

@ -669,4 +669,15 @@ function battle($event_id, array $char1, array $char2, $attack_set, $startTimest
}
function getClanFightCapableClanIds() {
$clan_info = getAllClans();
$ids = array();
foreach ($clan_info as $clan) {
if(!isClanLocked($clan['id'])) {
$ids[] = $clan['id'];
}
}
return $ids;
}
?>

Loading…
Cancel
Save