$$if (%%sortkey%%allowed !EQUALS "N")$$
$$openfile clanlist_%%sortkey%%.html$$
$$include menu.include$$
<title>CoD2 Clan List</title>

<br>
<br>

$$loop row as clanrow index as clanrowindex select * from clan where clanindex in (select clanindex from view_player where clanindex>=0)$$
$$loop row as clanstats index as clanstatsindex select sum(rounds) as rounds,sum(score) as score,sum(skill) as skill,sum(duration) as duration, max(lastactiveround) as lastactiveround,sum(kills) as kills,sum(deaths) as deaths,sum(suicides) as suicides,max(longestkillstreak) as longestkillstreak,max(longestdeathstreak) as longestdeathstreak,max(longestteamkillstreak) as longestteamkillstreak,sum(teamwins) as teamwins, sum(teamkills) as teamkills, sum(teamlosses) as teamlosses from view_player where clanindex='%%clanrow.clanindex%%'$$
	
<table border=0 class=nameplate align=center>
<td width=298 height=50 background="general/nameplate.jpg">
<div align="center">$$if (clanrow.webaddress !EQUALS "")$$<a href="$$clanrow.webaddress$$">$$endif$$
$$colouredtext2html(clanrow.name)$$
$$if (clanrow.webaddress !EQUALS "")$$</a>$$endif$$</div></td>

</table>		
		
<br>

<table align=center border=0 cellspacing=0 class=style2 width=700px
$$if (clanrow.banner !EQUALS "")$$
<tr valign=middle align=center>
<td align=center colspan=6>
$$if (clanrow.webaddress !EQUALS "")$$<a href="$$clanrow.webaddress$$">$$endif$$
<img src="$$clanrow.banner$$">
$$if (clanrow.webaddress !EQUALS "")$$</a>$$endif$$
</td>
</tr>
$$endif$$

<tr align=left>
<th align=left height=27px>Rounds</th><td>$$clanstats.rounds$$</td>
<th align=left height=27px>Play Time</th><td>$$formatduration("%H:%M:%S",clanstats.duration)$$</td>
<th>&nbsp;</th><td>&nbsp;</td>
</tr>

<tr align=left>
<th height=27px>Score</th><td>$$formatfloat("%.0f",clanstats.score)$$</td>
<th height=27px>Skill</th><td>$$formatfloat("%.0f",clanstats.skill)$$</td>
<th>&nbsp;</th><td>&nbsp;</td>
</tr>

<tr align=left>
<th height=27px>Kills</th><td>$$clanstats.kills$$</td>
<th height=27px>Deaths</th><td>$$clanstats.deaths$$</td>
<th height=27px>Suicides</th><td>$$clanstats.suicides$$</td>
</tr>

<tr align=left>
<th height=27px>Kill Streak</th><td>$$clanstats.longestkillstreak$$</td>
<th height=27px>Death Streak</th><td>$$clanstats.longestdeathstreak$$</td>
<th>&nbsp;</th><td>&nbsp;</td>
</tr>

$$endloop clanstats$$

</table>


<table align=center cellspacing=0 border=0 class=style2 width=1024px>
<tr align=center>
<td height=24px></td>
</tr>



<td>
<table align=center border=0 cellspacing=1 class=style2 width=1024px>
<tr>
<th width=15px>#</th>	
<th width=180px>Member</th>
$$if (killsallowed !EQUALS "N")$$<th width=40px><a href="clanlist_kills.html">Kills</a></th>$$endif$$
$$if (deathsallowed !EQUALS "N")$$<th><a href="clanlist_deaths.html">Deaths</a></th>$$endif$$
$$if (ratioallowed !EQUALS "N")$$<th width=40px><a href="clanlist_ratio.html">Ratio</a></th>$$endif$$
$$if (teamkillsallowed !EQUALS "N")$$<th><a href="clanlist_kills.html">Team<br>Kills</a></th>$$endif$$
$$if (suicidesallowed !EQUALS "N")$$<th><a href="clanlist_suicides.html">Suicides</a></th>$$endif$$
$$if (skillweightedallowed !EQUALS "N")$$<th><a href="clanlist_skillweighted.html">Skill<br>Weighted</a></th>$$endif$$
$$if (scoreweightedallowed !EQUALS "N")$$<th><a href="clanlist_scoreweighted.html">Score<br>Weighted</a></th>$$endif$$
$$if (skillallowed !EQUALS "N")$$<th><a href="clanlist_skill.html">Skill</a></th>$$endif$$
$$if (scoreallowed !EQUALS "N")$$<th><a href="clanlist_score.html">Score</a></th>$$endif$$
$$if (longestkillstreakallowed !EQUALS "N")$$<th><a href="clanlist_longestkillstreak.html">Kill<br>Streak</a></th>$$endif$$
$$if (longestdeathstreakallowed !EQUALS "N")$$<th><a href="clanlist_longestdeathstreak.html">Death<br>Streak</a></th>$$endif$$
$$if (roundsallowed !EQUALS "N")$$<th><a href="clanlist_rounds.html">Rounds</a></th>$$endif$$
$$if (durationallowed !EQUALS "N")$$<th><a href="clanlist_duration.html">Time<br>Played</a></th>$$endif$$
<th width=80px>Role</th>
</tr>
$$playerdisplaydropped="N"$$
$$loop row as player index as playerindex select *,coalesce(cast(kills as float)/cast(deaths as float),kills) as ratio from view_player where clanindex='%%clanrow.clanindex%%' order by %%sortkey%% desc$$
$$playerdataplayerindex=player.playerindex$$
$$playerdisplayname=player.name$$
$$tablename="playerdataxfire"$$$$include playerprofilecomponent.include$$
$$tablename="playerdataclanrole"$$$$include playerprofilecomponent.include$$
<tr onMouseover="changeto(event, '494848')" onMouseout="changeback(event, '2f2f2f')" align=center>
<th align=center height=27px>$$playerindex$$</th>
<td align=left><b>$$include playerdisplay.include$$</b></td>
$$if (killsallowed !EQUALS "N")$$<td>$$player.kills$$</td>$$endif$$
$$if (deathsallowed !EQUALS "N")$$<td>$$player.deaths$$</td>$$endif$$
$$if (ratioallowed !EQUALS "N")$$<td>$$formatfloat("%.2f",player.ratio)$$</td>$$endif$$
$$if (teamkillsallowed !EQUALS "N")$$<td>$$player.teamkills$$</td>$$endif$$
$$if (suicidesallowed !EQUALS "N")$$<td>$$player.suicides$$</td>$$endif$$
$$if (skillweightedallowed !EQUALS "N")$$<td>$$formatfloat("%.2f",player.skillweighted)$$</td>$$endif$$
$$if (scoreweightedallowed !EQUALS "N")$$<td>$$formatfloat("%.2f",player.scoreweighted)$$</td>$$endif$$
$$if (skillallowed !EQUALS "N")$$<td>$$formatfloat("%.0f",player.skill)$$</td>$$endif$$
$$if (scoreallowed !EQUALS "N")$$<td>$$formatfloat("%.0f",player.score)$$</td>$$endif$$
$$if (longestkillstreakallowed !EQUALS "N")$$<td>$$player.longestkillstreak$$</td>$$endif$$
$$if (longestdeathstreakallowed !EQUALS "N")$$<td>$$player.longestdeathstreak$$</td>$$endif$$
$$if (roundsallowed !EQUALS "N")$$<td>$$player.rounds$$</td>$$endif$$
$$if (durationallowed !EQUALS "N")$$<td>$$formatduration("%H:%M:%S",player.duration)$$</td>$$endif$$
$$if (playerdataclanrole !EQUALS "")$$<td>$$playerdataclanrole$$</td>
$$else$$<td>&nbsp;</td>$$endif$$
</tr>
$$endloop$$

</table>
</th>
</tr>
</table>
<br>
<br>
<br>
$$endloop clanrow$$
$$closefile$$
$$endif$$
