<?php
include("connect.php");
include("login_cookies.php");

$time = date("H:i:s d/m - Y");
?>
<strong>Statistik over crewets artikler:</strong> <i>(Brugere på prøve vises også)</i>
<br />
<table cellpadding="0" cellspacing="2" style="width:500px;">
<?php
$user_tjek = mysql_query("SELECT * FROM `pytox_community` WHERE `crew` LIKE '1'");

while($crew = mysql_fetch_array($user_tjek)) {

$user_query = mysql_query("SELECT * FROM `pytox_community` WHERE `bruger` LIKE '{$crew[bruger]}' LIMIT 1");

while($user = mysql_fetch_array($user_query)) {

$query = mysql_query("SELECT * FROM `pytox_artikler` WHERE `forfatter` LIKE '{$user[bruger]}' AND `show` LIKE '1' AND `udgivet` LIKE '1'");

$width = round(((mysql_num_rows($query)*200)/(mysql_num_rows($stat_artikler))));
$procent = round(((mysql_num_rows($query)*100)/(mysql_num_rows($stat_artikler))));
$maal = 100;
$nu[i_forhold_til_maal] = round((mysql_num_rows($stat_artikler)*100)/$maal);
$maal[i_forhold_til_nu] = round(($maal*100)/(mysql_num_rows($stat_artikler)));

print "  <tr>
   <td style=\"width:150px;\">".$crew[bruger].":</td><td style=\"width:350px;\"><img src=\"gfx/stat_endleft.jpg\" alt=\"\" /><img src=\"gfx/stat_midt.jpg\" alt=\"\" style=\"height:10px;width: ".$width."px;\" /><img src=\"gfx/stat_endright.jpg\" alt=\"\" /> (".$procent." % eller ".mysql_num_rows($query)." artikler)
   </td>
  </tr>
";

}
}
?>
 <tr>
  <td style="width:150px;height:10px;">
  </td>
  <td style="width:350px;height:10px;">
  </td>
 </tr>
 <tr>
  <td style="width:150px;border-top:1px solid #000;">
<strong>I alt:</strong>
  </td>
  <td style="width:350px;border-top:1px solid #000;">
<img src="gfx/stat_endleft.jpg" alt="" /><img src="gfx/stat_midt.jpg" alt="" style="height:10px;width:100px;" /><img src="gfx/stat_endright.jpg" alt="" /> (100 % eller <?php print mysql_num_rows($stat_artikler);?> artikler)
  </td>
 </tr>
 <tr>
  <td style="width:150px;">
<strong>Artikler i forhold til <?=$maal;?>, vores m&aring;l:</strong>
  </td>
  <td style="width:350px;border-top:1px solid #000;">
<?php
print "<img src=\"gfx/stat_endleft.jpg\" alt=\"\" /><img src=\"gfx/stat_midt.jpg\" alt=\"\" style=\"height:10px;width: ".$nu[i_forhold_til_maal]."px;\" /><img src=\"gfx/stat_endright.jpg\" alt=\"\" /> (".$nu[i_forhold_til_maal]." % eller ".mysql_num_rows($stat_artikler)." artikler)";
?>
  </td>
 </tr>
 <tr>
  <td style="width:150px;">
<strong>Vores m&aring;l:</strong>
  </td>
  <td style="width:350px;">
<?php
print "<img src=\"gfx/stat_endleft.jpg\" alt=\"\" /><img src=\"gfx/stat_midt.jpg\" alt=\"\" style=\"height:10px;width:".$maal."px;\" /><img src=\"gfx/stat_endright.jpg\" alt=\"\" /> (".$maal." artikler)";
?>
  </td>
 </tr>
</table>
<br />
<br />
<strong><i>Tak til alle for en god indsats!</i></strong>
<br />
<i>Hvis procenterne ikke går op, er det enten fordi at vi har spenderet et medlem fra crewet, eller at han selv gik.</i>
<br />
<i>I disse tilfælde se evt. under <a href="?site=Artikler&archive=true" title="Artikler">artiklerne</a></i>