} //------------------------------------------------------- var T_COMP_ID = 0; var T_TIME = 1; var T_MOVES = 2; var T_MULTI = 3; var T_SUBMIT = 4; var T_AVERAGE = 0; var T_MEAN = 1; var T_BEST = 2; var T_TIMELIMIT_HH = <?php echo timelimitNum($timelimit); ?> ; function letter(e) { var evt = e ? e : event; var chrCode = 0; if (evt.charCode!=null) chrCode = evt.charCode; else if (evt.which!=null) chrCode = evt.which; else if (evt.keyCode!=null) chrCode = evt.keyCode; if (chrCode==0) return ""; return String.fromCharCode(chrCode); }
function printEvent($event, &$coltimewidth, $print_headers=true,$_cat_id=NULL,$_round=NULL,$comp_id=NULL) { global $cid, $showmode, $regstable, $compstable, $timestable, $eventstable; // if ($event) global $cat_id, $round; else { $cat_id = $_cat_id; $round = $_round; $event = cased_mysql_fetch_array(strict_query("SELECT * FROM $eventstable WHERE id=?",array($cat_id))); } // $category = strict_query("SELECT * FROM categories WHERE id=?",array($cat_id)); $timetype = cased_mysql_result($category,0,"timetype"); if ($timetype==1) $coltimewidth = 60; elseif ($timetype==2) $coltimewidth = 30; else $coltimewidth = 100; // $format = strict_query("SELECT * FROM formats WHERE id=".$event["r".$round."_format"]); $times = cased_mysql_result($format,0,"times"); $avgtype = cased_mysql_result($format,0,"avgtype"); if (cased_mysql_result($category,0,"canhavetimelimit") && $round==1) { $timelimit = $event["timelimit"]; if($timelimit) $timelimit = substr("000:00.00",0,9-strlen($timelimit)).$timelimit; if (!timelimitNum($timelimit)) $timelimit = ""; } else $timelimit = ""; // $nrounds = 4; while ($nrounds>1 && !$event["r$nrounds"]) $nrounds--; // // Do we know who proceeded? if ($round < $nrounds && $event["r".($round+1)."_open"]) { $resultac = strict_query("SELECT comp_id FROM $regstable WHERE cat_id=? AND round=?", array($cat_id,$round+1)); $actuallyClassified = array(); while ($rowac=cased_mysql_fetch_array($resultac)) $actuallyClassified[$rowac["comp_id"]] = true; $rowac = null; $resultac = null; } else $actuallyClassified = null; // // $cat_st = cased_mysql_result($category,0,"name")." - round ".$round; $cat_st = cased_mysql_result($category,0,"name")." - ".roundString($round,$nrounds,(cased_mysql_result($category,0,"canhavetimelimit") && $round==1 && $timelimit)); if ($timelimit) $cat_st .= " - cutoff ".formatTime($timelimit,1); if (!$comp_id && !$showmode) echo "<div style='margin:0 0 6px 0;'>$cat_st</div>"; // scores table - begin if ($print_headers) { if ($comp_id) echo "<br>"; echo "<table class=TH cellspacing=0 border=0>"; echo "<tr><th class=col_cl>#</th>"; if (!$comp_id) echo "<th style='width:200px;text-align:left;'>name</th><th style='width:101px;text-align:left;'>country</th>"; else echo "<th style='width:301px;text-align:left;'>event / round</th>"; for ($x=1;$x<=$times;$x++) echo "<th style='width:".($coltimewidth+1)."px;'>t$x</td>"; switch($avgtype) { case 0: echo "<th style='width:".($coltimewidth)."px;'>average</th>"; break; case 1: echo "<th style='width:".($coltimewidth)."px;'>mean</th>"; break; } echo "<th style='width:".($coltimewidth)."px;'>best</th>"; echo "</tr></table>"; // echo "<table class=TD cellspacing=0 border=0>"; } // $query = "SELECT $regstable.*, $compstable.name, $timestable.t1, $timestable.t2, $timestable.t3, $timestable.t4, $timestable.t5, $timestable.average, $timestable.best, countries.name AS cname FROM $regstable ". "LEFT OUTER JOIN $timestable ON ($regstable.cat_id=$timestable.cat_id AND $regstable.round=$timestable.round AND $regstable.comp_id=$timestable.comp_id) ". "JOIN $compstable ON ($regstable.comp_id=$compstable.id) ". "JOIN countries ON (countries.id=$compstable.country_id) ". "WHERE $regstable.cat_id=? AND $regstable.round=? ORDER BY $timestable.t1 IS NULL, $timestable.average='', $timestable.average, $timestable.best, $compstable.name"; $list = strict_query($query,array($cat_id,$round)); if (!$actuallyClassified) $qualified = ( $round<4 && $event["r".($round+1)] ? $event["r".($round+1)."_groupsize"] : 3 ); $classification = 0; $count = 0; $lasta = ""; $lastb = ""; while ($row=cased_mysql_fetch_array($list)) { $count++; if (!$row["t1"]) $classification = ""; elseif ($row["average"]!=$lasta || ($timetype!=3 && $row["best"]!=$lastb)) { $classification = $count; $lasta = $row["average"]; $lastb = $row["best"]; } if (!$actuallyClassified) if ($qualified > 0) // Elegible to proceed? { if ($row["best"] > "A") $qualified = -1; } if (!$comp_id || $row["comp_id"]==$comp_id) { echo ($comp_id || $count % 2)?"<tr class=row_even>":"<tr class=row_odd>"; echo "<td class=col_cl"; if ($actuallyClassified) { if (array_key_exists($row["comp_id"],$actuallyClassified)) echo " style='background-color:#CCFF00;'"; } else { if ($classification && $classification<=$qualified) echo " style='background-color:#CCFF00;'"; } echo "><b>$classification</b></td>"; if (!$comp_id) echo "<td><div class=col_nm><a href='live.php?cid=$cid&compid=".$row["comp_id"]."'>" .$row["name"]. "</a></div></td><td><div class=col_ct>" .$row["cname"]. "</div></td>"; else echo "<td><div class=col_ct style='width:300px'><a href='live.php?cid=$cid&cat=$cat_id&rnd=$round'>$cat_st</a></div></td>"; for ($x=1;$x<=$times;$x++) if (!$comp_id) echo "<td class=col_tm>".formatTime($row["t$x"],$timetype)."</td>"; else echo "<td class=col_tm style='width:".$coltimewidth."px;'>".formatTime($row["t$x"],$timetype)."</td>"; if ($avgtype!=2) echo "<td style='width:".$coltimewidth."px;'><b>".formatTime($row["average"],$timetype)."</b></td>"; echo "<td style='width:".$coltimewidth."px;'>".($avgtype==2?"<b>":"") .formatTime($row["best"],$timetype). ($avgtype==2?"</b>":"")."</td>"; echo "</tr>"; } } if (!$comp_id) echo "</table><br>"; // score table -end }
// echo "<td>"; echo "<table cellspacing=0 border=0 class=nested><tr valign=top><td style='width:58px;'><img border=0 src='img/corner".$event["abbr"].".jpg'>"; if (!$event["r1_open"]) echo "<br> <a style='cursor:pointer;' title='remove event' onclick='if (confirm(\"Are you sure you want to remove the event?\")) callPage(\"delevent.php?id=". $event["id"] ."\");'><img border=0 src='img/del.gif'></a>"; echo "</td><td style='width:100%;'><div class=header>".$event["name"]."</div>"; echo "<DIV style='margin-left:10px;'>"; $round = 1; $rnd = "r1"; while($round <= 4 && $event[$rnd]) { $nextrnd = "r".($round+1); echo "<b>".roundString($round,$nrounds,($event["canhavetimelimit"] && $round==1 && $event["timelimit"]))."</b> "; // combined if ($event["canhavetimelimit"] && $round==1) { $st = (timelimitNum($event["timelimit"])?"cutoff ".formatTimelimit($event["timelimit"]):"no cutoff"); if ($round <= $last_rwt) echo "-<span onclick='alert(\"Change not allowed: this round already has results\");'> $st </span>"; else { echo "-<span id=" . $rnd."_".$event["id"] . "_1 style='cursor:pointer;' onclick='setTimeLimit(\"" . $rnd."_".$event["id"] . "_1\",\"" . $event["id"] . "\", \""; if (isset($events)) echo substr($events["timelimit"],1); echo "\");' title='click to change'> $st </span>"; } } // format if ($round <= $last_rwt) echo "-<span onclick='alert(\"Change not allowed: this round already has results\");'> " .$fmts[(int)$event[$rnd."_format"]-1]. " </span>"; else { echo "-<span id=" . $rnd."_".$event["id"] . "_2 style='cursor:pointer;' onclick='switchDataEvents(\"" . $rnd."_".$event["id"] . "_2\",\"" . $event["id"] . "\",\"" . $rnd . "_format\");' title='click to switch'> " . $fmts[(int)$event[$rnd."_format"]-1] . " </span>";