include('defs.php');
function print_header() {
header('Content-Type: text/html; charset=UTF-8');
echo '
Registered teams for NCPC 2007
';
}
function print_footer() {
echo '
|
';
}
print_header();
$registrations = dbquery("SELECT * FROM teams");
$cunt = array(
// eliglibility
'nordic' => array('yes' => 0, 'no' => 0),
'bycountry' => array(),
'bysite' => array(),
);
foreach ($COUNTRIES as $ckey => $cval) {
$cunt['bycountry'][$ckey] = array('yes' => 0, 'no' => 0);
}
$sitereg = array();
foreach ($SCHOOLS_ALL as $sid) {
$cunt['bysite'][$sid] = array('yes' => 0, 'no' => 0);
$sitereg[$sid] = array();
}
foreach($registrations as $r) {
if ($r['Eliglible'] == 'yes') $sid = $r['AffiliationID'];
else $sid = $r['SiteID'];
$cunt['nordic'][$r['Eliglible']]++;
$cunt['bycountry'][$SCHOOLINFO[$sid]['country']][$r['Eliglible']]++;
$cunt['bysite'][$sid][$r['Eliglible']]++;
$sitereg[$sid][] = $r;
}
function num_all($arr) {
return $arr['yes'] + $arr['no'];
}
function print_stats($arr, $where) {
echo '
'.$where.' |
'.num_all($arr).' |
'.$arr['yes'].' |
';
}
echo '
Nordic Programming Championship
Go back to NCPC 2007 page.
ICPC
eliglible teams are listed under their affiliated site, while
other teams are listed at the site they compete at.
|
Total |
ICPC |
';
print_stats($cunt['nordic'], 'All countries');
foreach ($COUNTRIES as $ckey => $cval) {
if (num_all($cunt['bycountry'][$ckey])) {
print_stats($cunt['bycountry'][$ckey], $cval);
foreach ($SCHOOLS_BY_COUNTRY[$ckey] as $sid) {
if (num_all($cunt['bysite'][$sid])) {
if ($sid == 'chal') $short = 'Chalmers';
else $short = strtoupper($sid);
print_stats($cunt['bysite'][$sid],
' '.$short);
}
}
}
}
echo '
';
foreach ($COUNTRIES as $ckey => $cval) {
if (num_all($cunt['bycountry'][$ckey])) {
//echo '
//
//';
//echo '
//'. $cval .'
';
//print_stats2($cunt['bycountry'][$ckey]);
foreach ($SCHOOLS_BY_COUNTRY[$ckey] as $sid) {
if (num_all($cunt['bysite'][$sid])) {
echo "
{$SCHOOLINFO[$sid]['name']}
";
//print_stats2($cunt['bysite'][$sid]);
echo '
|
ICPC |
Team name |
Member 1 |
Member 2 |
Member 3 |
';
$cnt = 1;
foreach ($sitereg[$sid] as $n => $r) {
$tn = escapeHTML($r['TeamName']);
if ($tn == 'WE LOVE UNICODE') {
$tn = 'WE ☐ UNICODE';
}
echo '
'.$cnt++.' |
'.($r['Eliglible']=='yes'?'x':'').' |
'.$tn.' | ';
foreach (array(1,2,3) as $C) {
$nam = trim(escapeHTML($r['FirstMiddle'.$C]) . " " .
escapeHTML($r['LastName'.$C]));
if ($nam != '') {
echo "$nam | ";
}
}
echo "
";
}
echo "
";
}
}
}
}
print_footer();
?>