Liga.php aus dem contents ordner
<?php
#######################
# Liga Modul #
# angepasst für Ilch #
# von Mairu #
# Content #
#######################
defined ('main') or die ( 'no direct access' );
$menue = array(
"Tabelle" => "table",
"Spiele" => "showmatches",
);
$auswahl = ($menu->get(1) == '' ? 'table' : $menu->get(1));
$title = $allgAr['title'].' :: Liga :: '.array_search($auswahl,$menue);
$hmenu = 'Liga <b> » </b> '.array_search($auswahl,$menue);
$design = new design ( $title , $hmenu );
$design->header();
echo '<table width="100%">';
foreach($menue as $eintrag =>$datei){
if ($datei == $auswahl) {
echo '<td align="center" bgcolor="#CC0000"><font size="1" face="Verdana" color="#FFFFFF"><b>';
echo $eintrag;
echo '</b></font></td>';
} else {
echo '<td align="center" bgcolor="#c0c0c0"><font size="1" face="Verdana" color="#FFFFFF"><b>';
echo '<a href="index.php?liga-'.$datei.'">'.$eintrag.'</a>';
echo '</b></font></td>';
}
}
echo '</tr></table>';
switch ($auswahl) {
case 'showmatches':
$stage = array();
$sql = db_query("SELECT DISTINCT stag FROM `prefix_liga_matches` ORDER BY stag");
while ($row = @db_fetch_object($sql)) $stage[] = $row->stag;
$anzst = count($stage);
$aktstag = @db_result(db_query("SELECT stag FROM `prefix_liga_matches` WHERE points1 IS NOT NULL ORDER BY stag DESC LIMIT 1"),0);
$aktstag = (is_numeric($aktstag)?$aktstag:1);
if ($anzst == 0) {
echo '<br /><center><h2>Es wurden noch keine Spiele eingetragen</h2></center><br />';
break;
}
if ($menu->get(2) == 'alle') $stag = 'alle';
else $stag = ($menu->getA(2) == 's' ? $menu->getE(2) : $aktstag);
echo "<center><h2>Spieltag: $stag</h2></center>";
?>
<br />
<div align="center">
<table width="99%" border="0" cellspacing="1" cellpadding="4" style="border-collapse: collapse" bordercolor="#FFFFFF">
<tr class="Chead" height="30" valign="middle">
<td width="25"><b><font size="1" face="Verdana" color="#FFFFFF">ST</font></b></td>
<td width="75"><b><font size="1" face="Verdana" color="#FFFFFF">Datum</font></b></td>
<td width="175"><b><font size="1" face="Verdana" color="#FFFFFF">Spieler A</font></b></td>
<td width="175"><b><font size="1" face="Verdana" color="#FFFFFF">Spieler B</font></b></td>
<td width="75"><b><font size="1" face="Verdana" color="#FFFFFF">Ergebnis</font></b></td>
<?php
$sql = db_query("SELECT a.id,a.tid1,a.tid2,a.stag,a.points1,a.points2,DATE_FORMAT(a.datum,'%d.%m.%Y') as datum,b.name as team1,c.name as team2
FROM `prefix_liga_matches` a
LEFT JOIN `prefix_user` b ON a.tid1 = b.id
LEFT JOIN `prefix_user` c ON a.tid2 = c.id
".($stag == 'alle'? '':"WHERE a.stag = $stag ")."
ORDER BY stag, datum DESC");
while ($ds = db_fetch_object($sql))
{
echo "<tr class=\"Cnorm\"><td align=\"center\">$ds->stag</td><td>$ds->datum</td><td><a href=\"index.php?user-details-$ds->tid1\">$ds->team1</a></td><td><a href=\"index.php?user-details-$ds->tid2\">$ds->team2</a></td><td align=\"center\">$ds->points1 : $ds->points2</td></tr>";
}
echo '</table></div><br /><center>[<a href="?liga-showmatches-alle">alle</a>|';
foreach ($stage as $key => $st) echo '<a href="?liga-showmatches-s'.$st.'">'.$st.'</a>'.($key+1 == $anzst ? '':'|');
echo ']</center>';
break;
case 'table':
?>
<center><br />
<table width="99%" border="0" cellspacing="1" cellpadding="4" style="border-collapse: collapse">
<tr class="Chead" height="30" valign="middle">
<td width="25"><b><font size="1" face="Verdana" color="#FFFFFF">Plz</font></b></td>
<td width="280"><b><font face="Verdana" size="1" color="#FFFFFF">Spielername</font></b></td>
<td width="30"><b><font size="1" face="Verdana" color="#FFFFFF">Sp.</font></b></td>
<td align="center" width="30"><b>
<font size="1" face="Verdana" color="#FFFFFF">S</font></b></td>
<td align="center" width="30"><b>
<font size="1" face="Verdana" color="#FFFFFF">U</font></b></td>
<td align="center" width="30"><b>
<font size="1" face="Verdana" color="#FFFFFF">N</font></b></td>
<td align="center" width="75"><b>
<font size="1" face="Verdana" color="#FFFFFF">Win/Loss</font></b></td>
<td width="30"><b><font size="1" face="Verdana" color="#FFFFFF">Pkt</font></b></td>
<?
$count = db_result(db_query("SELECT COUNT(*) FROM `prefix_liga_teams`"),0);
$sql = db_query("SELECT a.id,a.points,a.opoints,a.s,a.u,a.n,(a.s*3+a.u) as punkte,b.name FROM `prefix_liga_teams` a
LEFT JOIN `prefix_user` b ON a.id = b.id
ORDER BY punkte DESC, (points-opoints) DESC, points DESC");
while ($ds = db_fetch_object($sql))
{
$rank ++;
if ($rank == 1) $bg = 'bgcolor="green"';
elseif ($rank > $count - 3) $bg = 'bgcolor="red"';
else $bg = '';
echo "<tr $bg align=\"center\"$color><td><b>$rank</b></td><td align=\"left\"><b><a href=\"index.php?user-details-$ds->id\">$ds->name</a></b></td><td>".($ds->s+$ds->u+$ds->n)."</td><td>$ds->s</td><td>$ds->u</td><td>$ds->n</td><td>$ds->points : $ds->opoints</td><td><b>$ds->punkte</b></td></tr>\n";
}
echo '</table></center>';
break;
}
$design->footer();
?>
Edit von Sonic:
nächstes mal bitte im Code Tag wegen der übersichtlichkeit
Zuletzt modifiziert von Son!c am 06.11.2008 - 22:06:23