|
include("include/fg_ligajahr.php");
include("include/fg_zuschauerstatistik.php");
$sql="select l.ligatypid,j.ligajahrende,obervereinid,teamklassetypid,if(neutral=0,wo,-1) as won,sum(spiele) as spiele,sum(zuschauer) as zuschauer
from fg_tmp_obervereinligastatistik as o
left join fg_ligajahr as j on o.ligajahrid=j.ligajahrid
left join fg_liga as l on j.ligaid=l.ligaid
where l.ligatypid=".$ligatyp." and obervereinid=".$oberverein." and teamklassetypid=".$teamklasse." and j.ligajahrende=".$spieljahr."
group by l.ligatypid,j.ligajahrende,obervereinid,teamklassetypid,won";
$dbresult = $db->Execute($sql);
while ($dbr = $dbresult->FetchRow())
{
$list['wo']=$dbr['won'];
$list['spiele']=$dbr['spiele'];
$list['zuschauer']=$dbr['zuschauer'];
$list['schnitt']=$dbr['zuschauer']/$dbr['spiele'];
if($dbr['won']==0)
{
$ret=zuschauerheim($db,$oberverein,$teamklasse,$ligatyp,$spieljahr);
$list['zuschauertop']=$ret['top'];
$list['zuschauerflop']=$ret['flop'];
}
elseif($dbr['won']==1)
{
$ret=zuschauergast($db,$oberverein,$teamklasse,$ligatyp,$spieljahr);
$list['zuschauertop']=$ret['top'];
$list['zuschauerflop']=$ret['flop'];
}
else
{
$ret=zuschauerneutral($db,$oberverein,$teamklasse,$ligatyp,$spieljahr);
$list['zuschauertop']=$ret['top'];
$list['zuschauerflop']=$ret['flop'];
}
$smarty->assign('nodelist',$list);
echo $smarty->fetch('fg_zuschauerstatistik.tpl');
unset($list);
}
?>
|