Ejemplo n.º 1
0
function show_page()
{
    score_guts();
    cancel_templateify();
    header('X-LMT-Guts-Data: 42');
    //:)
    ?>
<meta http-equiv="refresh" content="7">
<script src="https://code.jquery.com/jquery-2.1.3.min.js"></script>
<style type="text/css">
body{
	font-family:"Georgia";
}

.box{
	vertical-align:top;
	border: solid 2px #000;
	border-radius: 10px;
	height: 50px;
	width: 270px;
	display: inline-block;
	margin: 5px;
	padding: 10px;
	text-align:left;
	display:none;
}
.box .place{
	font-size: 1.4em;
}
.box .team{
	font-weight: bold;
	font-size: 1.2em;
}
.box .school{
	font-size: 0.8em;
}
.box .score{
	float: right;
	font-size: 2.3em;
	position:relative;
	top:-30px;
}
.box .set{
	
}

h1{
 font-size: 3.2em;
 position:relative;
 top:-30px;
	margin-bottom: -10px;
}
h1 img{
	position:relative;
	top:30px;
}
h1 #timer{
	width: 400px;
	min-height: 1.2em;
	border: solid 1px #000;
	display: inline-block;
}
.suspense{
	font-size: 3em;
}
</style>
<script>
console.log((new Date()).getTime());
function formatSeconds(secs){
	var h = Math.floor(secs / (60*60));
	var m = Math.floor((secs % 3600) / 60);
	var s = Math.floor(secs % 60);
	h=h.toString();
	m=m.toString();
	s=s.toString();
	while(h.length < 2) h = "0"+h;
	while(m.length < 2) m = "0"+m;
	while(s.length < 2) s = "0"+s;
	
	return h+":"+m+":"+s;
}
var targetTime = 1460180400 + 90 * 60 + 12 * 60 * 60 + 10 * 60 + 60 + 60 + 2 * 60;
function updateTime(){
	var currTime = (new Date()).getTime()/1000;
	if(targetTime - currTime > 90*60){
		timerOut(formatSeconds(targetTime-currTime-90*60)+" <small style='display:block;font-size:0.4em;'>before start</small>");
	}
	if(targetTime - currTime <= 90*60){
		timerOut(formatSeconds(targetTime-currTime));
	}
	if(targetTime - currTime <= 0){
		timerOut("END!");
	}
	if(targetTime - currTime <=300){
		$(".box").fadeOut();
		$(".suspense").fadeIn();
	}
	else{
		$(".box").css("display","inline-block");
		$(".suspense").hide();
	}
	
	setTimeout(updateTime,300);
}
function timerOut(a){
	document.getElementById("timer").innerHTML=a;
}
</script>
<center>

<h1>
<img src="../../../../res/lmt/header.png" alt="LMT" width="525" height="110">
Guts Round
<span id="timer">(timer here)</span>
</h1>

<div class="suspense"><br><br><br>Boxes hidden for awards ceremony suspense. ;)</div>

<?php 
    $result = DB::queryRaw('SELECT name, guts_ans_a, (SELECT name FROM schools WHERE schools.school_id=teams.school) AS school_name, ' . '(SELECT MAX(problem_set) FROM guts WHERE team=team_id) AS current_problem, score_guts FROM teams WHERE deleted="0" ORDER BY score_guts DESC');
    $n = 1;
    $row = mysqli_fetch_assoc($result);
    while ($row) {
        $place = htmlentities($n++);
        $team = htmlentities($row['name']);
        $school = htmlentities($row['school_name']);
        if ($school == '') {
            $school = 'Individuals';
        }
        $score = htmlentities($row['score_guts']);
        $curr = htmlentities($row['current_problem']);
        if ($curr == '') {
            $curr = '0';
        }
        if (!is_null($row['guts_ans_a'])) {
            $curr = '12';
        }
        ?>
<div class="box">
	<span class="place">[<?php 
        echo $place;
        ?>
]</span>
	<span class="team"><?php 
        echo $team;
        ?>
</span>
	<span class="set">(<?php 
        echo $curr;
        ?>
/12)</span><br>
	<span class="school"><?php 
        echo $school;
        ?>
</span>
	<span class="score"><?php 
        echo $score;
        ?>
</span>
</div>
<?php 
        $row = mysqli_fetch_assoc($result);
    }
    ?>
<script>
$(function(){
updateTime();
});
</script>
<?php 
}
Ejemplo n.º 2
0
function show_page()
{
    if (scoring_is_enabled()) {
        $message = '<div class="error">Score entry is still enabled! Disable it <a href="../Scoring/Refrigerator">here</a>.</div><br />';
    }
    lmt_page_header('Top Scorers');
    echo <<<HEREDOC
      <h1>Top Scorers</h1>
      {$message}
      <div class="text-centered b">
        <span class="noPrint">
          <a href="Full">Full Results</a>&nbsp;&nbsp;
          <a href="Print">Scores for Coaches</a>
          <br /><br />
        </span>
        <span class="red">Reminder: Do not copy data locally!</span><br />
        Ties are listed in random order.
        <br /><br />
      </div>
      
      <h2>Top 5 Individuals by Individual Round</h2>
      <table class="contrasting">
        <tr>
          <th>Place</th>
          <th>Name</th>
          <th>School</th>
          <th>Individual Round</th>
        </tr>
HEREDOC;
    score_guts();
    // INDIVIDUAL ROUND
    $query = 'SELECT id, individuals.name AS name, (SELECT name FROM schools WHERE school_id=teams.school) AS school_name, ' . 'RAND() AS rand, score_individual FROM individuals LEFT JOIN teams ON team=teams.team_id WHERE individuals.deleted="0" AND attendance="1" ORDER BY score_individual DESC, rand';
    $result = DB::queryRaw($query);
    $row = mysqli_fetch_assoc($result);
    $place = 0;
    $num = 0;
    $last_score = null;
    while ($row) {
        $num++;
        if ($row['score_individual'] != $last_score) {
            $place = $num;
        }
        $last_score = $row['score_individual'];
        if ($place > 5) {
            break;
        }
        $id = htmlentities($row['id']);
        $name = htmlentities($row['name']);
        $school = htmlentities($row['school_name']);
        if ($school == '') {
            $school = '<span class="i">None</span>';
        }
        $score_individual = htmlentities($row['score_individual']);
        echo <<<HEREDOC
        <tr>
          <td>{$place}</td>
          <td><a href="../Data/Individual?ID={$id}">{$name}</a></td>
          <td>{$school}</td>
          <td class="b">{$score_individual}</td>
        </tr>
HEREDOC;
        $row = mysqli_fetch_assoc($result);
    }
    echo "      </table>\n";
    // Theme ROUND
    echo <<<HEREDOC
      <h2>Top 5 Individuals by Theme Round</h2>
      <table class="contrasting">
        <tr>
          <th>Place</th>
          <th>Name</th>
          <th>School</th>
          <th>Theme Round</th>
        </tr>
HEREDOC;
    $query = 'SELECT id, individuals.name AS name, (SELECT name FROM schools WHERE school_id=teams.school) AS school_name, ' . 'RAND() AS rand, score_theme FROM individuals LEFT JOIN teams ON team=teams.team_id WHERE individuals.deleted="0" AND attendance="1" ORDER BY score_theme DESC, rand';
    $result = DB::queryRaw($query);
    $row = mysqli_fetch_assoc($result);
    $place = 0;
    $num = 0;
    $last_score = null;
    while ($row) {
        $num++;
        if ($row['score_theme'] != $last_score) {
            $place = $num;
        }
        $last_score = $row['score_theme'];
        if ($place > 5) {
            break;
        }
        $id = htmlentities($row['id']);
        $name = htmlentities($row['name']);
        $school = htmlentities($row['school_name']);
        if ($school == '') {
            $school = '<span class="i">None</span>';
        }
        $score_theme = htmlentities($row['score_theme']);
        echo <<<HEREDOC
        <tr>
          <td>{$place}</td>
          <td><a href="../Data/Individual?ID={$id}">{$name}</a></td>
          <td>{$school}</td>
          <td class="b">{$score_theme}</td>
        </tr>
HEREDOC;
        $row = mysqli_fetch_assoc($result);
    }
    echo "      </table>\n";
    // INDIVIDUAL COMPOSITE
    echo <<<HEREDOC
      <h2>Top 10 Individuals by Composite</h2>
      <table class="contrasting">
        <tr>
          <th>Place</th>
          <th>Name</th>
          <th>School</th>
          <th>Composite</th>
        </tr>
HEREDOC;
    $query = individual_composite('id, individuals.name AS name, (SELECT name FROM schools WHERE school_id=teams.school) AS school_name, ' . 'RAND() AS rand,', 'LEFT JOIN teams ON team=teams.team_id WHERE individuals.deleted="0" AND attendance="1" ORDER BY score_composite DESC, rand');
    $result = DB::queryRaw($query);
    $row = mysqli_fetch_assoc($result);
    $place = 0;
    $num = 0;
    $last_score = null;
    while ($row) {
        $num++;
        if ($row['score_composite'] != $last_score) {
            $place = $num;
        }
        $last_score = $row['score_composite'];
        if ($place > 10) {
            break;
        }
        $id = htmlentities($row['id']);
        $name = htmlentities($row['name']);
        $school = htmlentities($row['school_name']);
        if ($school == '') {
            $school = '<span class="i">None</span>';
        }
        $score_composite = htmlentities($row['score_composite']);
        echo <<<HEREDOC
        <tr>
          <td>{$place}</td>
          <td><a href="../Data/Individual?ID={$id}">{$name}</a></td>
          <td>{$school}</td>
          <td class="b">{$score_composite}</td>
        </tr>
HEREDOC;
        $row = mysqli_fetch_assoc($result);
    }
    echo "      </table>\n";
    // TEAM ROUND
    echo <<<HEREDOC
      <h2>Top 5 Teams by Team Round</h2>
      <table class="contrasting">
        <tr>
          <th>Place</th>
          <th>Team Name</th>
          <th>Team Round</th>
        </tr>
HEREDOC;
    $query = 'SELECT team_id, name, IFNULL(score_team_short, 0) + IFNULL(score_team_long, 0) AS score_team, RAND() AS rand FROM teams WHERE deleted="0" ORDER BY score_team DESC, rand';
    $result = DB::queryRaw($query);
    $row = mysqli_fetch_assoc($result);
    $place = 0;
    $num = 0;
    $last_score = null;
    while ($row) {
        $num++;
        if ($row['score_team'] != $last_score) {
            $place = $num;
        }
        $last_score = $row['score_team'];
        if ($place > 5) {
            break;
        }
        $id = htmlentities($row['team_id']);
        $name = htmlentities($row['name']);
        $score_team = htmlentities($row['score_team']);
        if (is_null($row['score_team'])) {
            $score_team = '<span class="i">None</span>';
        }
        echo <<<HEREDOC
        <tr>
          <td>{$place}</td>
          <td><a href="../Data/Team?ID={$id}">{$name}</a></td>
          <td class="b">{$score_team}</td>
        </tr>
HEREDOC;
        $row = mysqli_fetch_assoc($result);
    }
    echo "      </table>\n";
    // GUTS ROUND
    echo <<<HEREDOC
      <h2>Top 5 Teams by Guts Round</h2>
      <table class="contrasting">
        <tr>
          <th>Place</th>
          <th>Team Name</th>
          <th>Guts Round</th>
        </tr>
HEREDOC;
    $query = 'SELECT team_id, name, score_guts, RAND() AS rand FROM teams WHERE deleted="0" ORDER BY score_guts DESC, rand';
    $result = DB::queryRaw($query);
    $row = mysqli_fetch_assoc($result);
    $place = 0;
    $num = 0;
    $last_score = null;
    while ($row) {
        $num++;
        if ($row['score_guts'] != $last_score) {
            $place = $num;
        }
        $last_score = $row['score_guts'];
        if ($place > 5) {
            break;
        }
        $id = htmlentities($row['team_id']);
        $name = htmlentities($row['name']);
        $score_guts = htmlentities($row['score_guts']);
        if (is_null($row['score_guts'])) {
            $score_guts = '<span class="i">None</span>';
        }
        echo <<<HEREDOC
        <tr>
          <td>{$place}</td>
          <td><a href="../Data/Team?ID={$id}">{$name}</a></td>
          <td class="b">{$score_guts}</td>
        </tr>
HEREDOC;
        $row = mysqli_fetch_assoc($result);
    }
    echo "      </table>\n";
    // TEAM COMPOSITE
    echo <<<HEREDOC
      <h2>Top 5 Teams by Composite</h2>
      <table class="contrasting">
        <tr>
          <th>Place</th>
          <th>Team Name</th>
          <th>Team Round</th>
          <th>Guts Round</th>
          <th>Composite</th>
        </tr>
HEREDOC;
    $query = team_composite('team_id, name, IFNULL(score_team_short, 0) + IFNULL(score_team_long, 0) AS score_team, score_guts, RAND() AS rand,', 'WHERE deleted="0" ORDER BY team_composite DESC, rand');
    $result = DB::queryRaw($query);
    $row = mysqli_fetch_assoc($result);
    $place = 0;
    $num = 0;
    $last_score = null;
    while ($row) {
        $num++;
        if ($row['team_composite'] != $last_score) {
            $place = $num;
        }
        $last_score = $row['team_composite'];
        if ($place > 5) {
            break;
        }
        $id = htmlentities($row['team_id']);
        $name = htmlentities($row['name']);
        $score_team = htmlentities($row['score_team']);
        $score_guts = htmlentities($row['score_guts']);
        $score_composite = htmlentities($row['team_composite']);
        if (is_null($row['score_team'])) {
            $score_team = '<span class="i">None</span>';
        }
        if (is_null($row['score_guts'])) {
            $score_guts = '<span class="i">None</span>';
        }
        echo <<<HEREDOC
        <tr>
          <td>{$place}</td>
          <td><a href="../Data/Team?ID={$id}">{$name}</a></td>
          <td>{$score_team}</td>
          <td>{$score_guts}</td>
          <td class="b">{$score_composite}</td>
        </tr>
HEREDOC;
        $row = mysqli_fetch_assoc($result);
    }
    echo "      </table>\n";
    die;
}
Ejemplo n.º 3
0
function show_page()
{
    global $EXPORT_STR;
    //$EXPORT_STR=true makes it return a string of all the code. (and not echo anything)
    if (!$EXPORT_STR) {
        lmt_page_header('Export');
        echo <<<HEREDOC
<h1>Export</h1>

HEREDOC;
    }
    $code = '<h3>Results</h3>';
    score_guts();
    // INDIVIDUAL ROUND
    $indiv_query = 'SELECT individuals.name AS name, (SELECT name FROM schools WHERE school_id=teams.school) AS school_name, IFNULL(%l,0) AS score FROM (individuals LEFT JOIN teams ON team=teams.team_id) WHERE individuals.deleted="0" AND teams.deleted="0" AND individuals.attendance="1" ORDER BY score DESC, RAND()';
    $rankings = array(array('Top Individuals in Individual Round', str_replace('%l', 'score_individual', $indiv_query), 10), array('Top Individuals in Theme Round', str_replace('%l', 'score_theme', $indiv_query), 10), array('Top Individuals Overall', str_replace('%l', '(score_individual + score_theme)', $indiv_query), 10));
    foreach ($rankings as $rankparams) {
        $title = $rankparams[0];
        $query = $rankparams[1];
        $maxrank = $rankparams[2];
        $code .= '<h4>' . htmlentities($title) . '</h4>' . "\n" . '<table class="contrasting"><tr><th>Place</th><th>Name</th><th>School</th><th>Score</th></tr>';
        $result = DB::query($query);
        $prev_score = NULL;
        //Null never equals anything.
        foreach ($result as $ind => $row) {
            $name = htmlentities($row['name']);
            $school = htmlentities($row['school_name']);
            if ($school == '') {
                $school = '<span class="i">None</span>';
            }
            $score = intval($row['score']);
            //Finding the rank
            if ($prev_score != $score) {
                $prev_rank = $rank = $ind + 1;
            }
            //If score is below, set it to the actual ranking.
            //If it's tied, leave the ranking as it was.
            $prev_score = $score;
            //update previous score.
            if ($rank > $maxrank) {
                break;
            }
            //Only specified number of top places.
            $code .= "  <tr>\n    <td>{$rank}</td>\n    <td>{$name}</td>\n    <td>{$school}</td>\n    <td>{$score}</td>\n  </tr>\n";
        }
        $code .= "</table>\n";
    }
    //selecting individuals' name, school, individual score, from individuals left-joined with teams
    // TEAM ROUND
    $code .= '<h4>Top Teams in Team Round</h4><table class="contrasting"><tr><th>Place</th><th>Team</th><th>School</th><th>Score</th></tr>';
    $query = 'SELECT team_id, name, IFNULL(score_team_short, 0) + IFNULL(score_team_long, 0) AS score_team, (SELECT name FROM schools WHERE schools.school_id=teams.school) AS school_name, RAND() AS rand FROM teams WHERE deleted="0" ORDER BY score_team DESC, rand';
    $result = DB::queryRaw($query);
    $row = mysqli_fetch_assoc($result);
    $place = 1;
    $num = 0;
    $last_score = null;
    while ($row) {
        $num++;
        if ($row['score_team'] != $last_score) {
            $place = $num;
        }
        $last_score = $row['score_team'];
        if ($place > 10) {
            break;
        }
        $id = htmlentities($row['team_id']);
        $name = htmlentities($row['name']);
        $school_name = htmlentities($row['school_name']);
        $score_team = htmlentities($row['score_team']);
        if (is_null($row['score_team'])) {
            $score_team = '<span class="i">None</span>';
        }
        $code .= <<<HEREDOC
  <tr>
    <td>{$place}</td>
    <td>{$name}</td>
    <td>{$school_name}</td>
    <td>{$score_team}</td>
  </tr>

HEREDOC;
        $row = mysqli_fetch_assoc($result);
    }
    $code .= "</table>\n";
    // GUTS ROUND
    $code .= <<<HEREDOC
<h4>Top Teams in Guts Round</h4>
<table class="contrasting">
  <tr>
    <th>Place</th>
    <th>Team</th>
    <th>School</th>
    <th>Score</th>
  </tr>

HEREDOC;
    $query = 'SELECT team_id, name, score_guts, (SELECT name FROM schools WHERE schools.school_id=teams.school) AS school_name, RAND() AS rand FROM teams WHERE deleted="0" ORDER BY score_guts DESC, rand';
    $result = DB::queryRaw($query);
    $row = mysqli_fetch_assoc($result);
    $place = 0;
    $num = 0;
    $last_score = null;
    while ($row) {
        $num++;
        if ($row['score_guts'] != $last_score) {
            $place = $num;
        }
        $last_score = $row['score_guts'];
        if ($place > 10) {
            break;
        }
        $id = htmlentities($row['team_id']);
        $name = htmlentities($row['name']);
        $school_name = htmlentities($row['school_name']);
        $score_guts = htmlentities($row['score_guts']);
        if (is_null($row['score_guts'])) {
            $score_guts = '<span class="i">None</span>';
        }
        $code .= <<<HEREDOC
  <tr>
    <td>{$place}</td>
    <td>{$name}</td>
    <td>{$school_name}</td>
    <td>{$score_guts}</td>
  </tr>

HEREDOC;
        $row = mysqli_fetch_assoc($result);
    }
    $code .= "</table>\n";
    // TEAM COMPOSITE
    $code .= <<<HEREDOC
<h4>Top Teams Overall</h4>
<table class="contrasting">
  <tr>
    <th>Place</th>
    <th>Team</th>
    <th>School</th>
    <th>Score</th>
  </tr>

HEREDOC;
    $query = team_composite('team_id, name, IFNULL(score_team_short, 0) + IFNULL(score_team_long, 0) AS score_team, score_guts, RAND() AS rand, (SELECT name FROM schools WHERE schools.school_id=teams.school) AS school_name,', 'WHERE deleted="0" ORDER BY team_composite DESC, rand');
    $result = DB::queryRaw($query);
    $row = mysqli_fetch_assoc($result);
    $place = 0;
    $num = 0;
    $last_score = null;
    while ($row) {
        $num++;
        if ($row['team_composite'] != $last_score) {
            $place = $num;
        }
        $last_score = $row['team_composite'];
        if ($place > 10) {
            break;
        }
        $id = htmlentities($row['team_id']);
        $name = htmlentities($row['name']);
        $score_team = htmlentities($row['score_team']);
        $score_guts = htmlentities($row['score_guts']);
        $score_composite = htmlentities($row['team_composite']);
        $school_name = htmlentities($row['school_name']);
        if (is_null($row['score_team'])) {
            $score_team = '<span class="i">None</span>';
        }
        if (is_null($row['score_guts'])) {
            $score_guts = '<span class="i">None</span>';
        }
        $code .= <<<HEREDOC
  <tr>
    <td>{$place}</td>
    <td>{$name}</td>
    <td>{$school_name}</td>
    <td>{$score_composite}</td>
  </tr>

HEREDOC;
        $row = mysqli_fetch_assoc($result);
    }
    $code .= "</table>\n";
    if ($EXPORT_STR) {
        return $code;
    } else {
        echo "Exported results (to paste into website page):<br><textarea cols='100' rows='10' onclick='this.setSelectionRange(0, this.value.length)'>" . str_replace(' ', '&nbsp;', htmlentities($code)) . "</textarea>{$code}";
    }
}
Ejemplo n.º 4
0
function show_page()
{
    lmt_page_header('Scoring Verification');
    echo <<<HEREDOC
      <h1>Scoring Verification</h1>
      
      <div class="text-centered b noprint">
        <span>
          <a href="../Results/Print">Print Score Sheets</a>
          <br /><br />
        </span>
      </div>
\t  
      <table class="contrasting">
        <tr>
          <th>ID</th>
          <th>Team Name</th>
          <th>Individual Sum</th>
          <th>Theme Sum</th>
\t\t  <th>Team Short</th>
\t\t  <th>Team Long</th>
        </tr>
HEREDOC;
    score_guts();
    // INDIVIDUAL
    $sum_indiv = '(SELECT SUM(score_individual) FROM individuals WHERE team=teams.team_id AND deleted="0") AS sum_indiv';
    $sum_theme = '(SELECT SUM(score_theme) FROM individuals WHERE team=teams.team_id AND deleted="0") AS sum_theme';
    $query = "SELECT team_id, name, {$sum_indiv}, {$sum_theme}, score_team_short, score_team_long FROM teams WHERE deleted=\"0\" ORDER BY team_id";
    $result = DB::queryRaw($query);
    $row = mysqli_fetch_assoc($result);
    while ($row) {
        $team_id = htmlentities($row['team_id']);
        $name = htmlentities($row['name']);
        $sum_indiv = htmlentities($row['sum_indiv']);
        $sum_theme = htmlentities($row['sum_theme']);
        $team_short = htmlentities($row['score_team_short']);
        $team_long = htmlentities($row['score_team_long']);
        if (is_null($row['sum_indiv'])) {
            $sum_indiv = '<span class="i">None</span>';
        }
        if (is_null($row['sum_theme'])) {
            $sum_theme = '<span class="i">None</span>';
        }
        if (is_null($row['score_team_short'])) {
            $team_short = '<span class="i">None</span>';
        }
        if (is_null($row['score_team_long'])) {
            $team_long = '<span class="i">None</span>';
        }
        echo <<<HEREDOC
        <tr>
          <td>{$team_id}</td>
          <td><a href="../Data/Team?ID={$team_id}">{$name}</a></td>
          <td>{$sum_indiv}</td>
          <td>{$sum_theme}</td>
          <td>{$team_short}</td>
          <td>{$team_long}</td>
        </tr>
HEREDOC;
        $row = mysqli_fetch_assoc($result);
    }
    echo "      </table>\n";
    die;
}
Ejemplo n.º 5
0
function display_team($err, $selected_field)
{
    score_guts();
    $row = DB::queryFirstRow('SELECT teams.*, schools.name AS school_name, schools.coach_email FROM teams LEFT JOIN schools ON teams.school=schools.school_id' . ' WHERE team_id="' . mysqli_real_escape_string(DB::get(), $_GET['ID']) . '"');
    $team_name = htmlentities($row['name']);
    $school_name = htmlentities($row['school_name']);
    $school_id = htmlentities($row['school']);
    $coach_email = '<a href="mailto:' . htmlentities($row['coach_email']) . '" rel="external">' . htmlentities($row['coach_email']) . '</a>';
    if ($school_id == '-1') {
        $school_link = '<span class="b">Individuals</span>';
        $coach_email = '<span class="b">None</span>';
    } else {
        $school_link = '<a href="School?ID=' . $school_id . '">' . $school_name . '</a>';
    }
    $schools_dropdown = make_schools_dropdown($school_id);
    $members_list = make_members_list();
    $teamround_short_checked = is_null($row['score_team_short']) ? '' : ' checked="checked"';
    $teamround_short_score = htmlentities($row['score_team_short']);
    $teamround_long_checked = is_null($row['score_team_long']) ? '' : ' checked="checked"';
    $teamround_long_score = htmlentities($row['score_team_long']);
    $row2 = DB::queryFirstRow(team_composite('', 'WHERE team_id="' . mysqli_real_escape_string(DB::get(), $_GET['ID']) . '"'));
    $composite_score = $row2['team_composite'];
    if (is_null($composite_score)) {
        $composite_score = 'None';
    } else {
        $composite_score = htmlentities($composite_score);
    }
    global $body_onload;
    $body_onload = $selected_field . 'nullboxSetState(-1);externalLinks();';
    global $use_rel_external_script;
    $use_rel_external_script = true;
    global $javascript;
    $javascript = <<<HEREDOC
      function nullboxSetState(isClick) {
        if (document.forms['lmtDataTeamRoundShortScore'].teamRoundShortHasValue.checked) {
          document.forms['lmtDataTeamRoundShortScore'].teamRoundShortScore.disabled = false;
          if (isClick == 1)
            document.forms['lmtDataTeamRoundShortScore'].teamRoundShortScore.focus();
        }
        else
          document.forms['lmtDataTeamRoundShortScore'].teamRoundShortScore.disabled = true;
        
        if (document.forms['lmtDataTeamRoundLongScore'].teamRoundLongHasValue.checked) {
          document.forms['lmtDataTeamRoundLongScore'].teamRoundLongScore.disabled = false;
          if (isClick == 2)
            document.forms['lmtDataTeamRoundLongScore'].teamRoundLongScore.focus();
        }
        else
          document.forms['lmtDataTeamRoundLongScore'].teamRoundLongScore.disabled = true;
      }
HEREDOC;
    if ($err != '') {
        $err = "\n        <div class=\"error\">{$err}</div><br />\n";
    }
    $id = htmlentities($_GET['ID']);
    if (!scoring_is_enabled()) {
        $scoring_warning = "\n      " . '<div class="text-centered">Note: Scoring has been frozen, so results may not be changed.</div><br /><br />';
        $scoring_freeze = 'disabled="disabled" ';
    }
    lmt_page_header($team_name);
    echo <<<HEREDOC
      <h1>Team</h1>
      {$scoring_warning}
      <table>
        <tr>
          <td>Team Name:</td>
          <td>
            <form id="lmtDataTeamName" method="post" action="{$_SERVER['REQUEST_URI']}"><div>
              <input type="text" name="team_name" size="25" maxlength="25" value="{$team_name}" />
              <input type="hidden" name="xsrf_token" value="{$_SESSION['xsrf_token']}" />
              <input type="submit" name="lmtDataTeam_changeName" value="Change" />
            </div></form>
            <br />
          </td>
        </tr><tr>
          <td>School:</td>
          <td>
            {$school_link}
            <div class="halfbreak"></div>
            <form id="lmtDataTeamSchool" method="post" action="{$_SERVER['REQUEST_URI']}"><div>
{$schools_dropdown}
              <input type="hidden" name="xsrf_token" value="{$_SESSION['xsrf_token']}" />
              <input type="submit" name="lmtDataTeam_changeSchool" value="Change" />
            </div></form>
          </td>
        </tr><tr>
          <td>Coach's Email:</td>
          <td>{$coach_email}<br /><br /></td>
        </tr><tr>
          <td>Team Round Short Score:</td>
          <td>
            <form id="lmtDataTeamRoundShortScore" method="post" action="{$_SERVER['REQUEST_URI']}"><div>
              <input type="checkbox" name="teamRoundShortHasValue" value="Yes" onchange="nullboxSetState(1);"{$teamround_short_checked}/>
              <input type="text" name="teamRoundShortScore" size="25" value="{$teamround_short_score}" />
              <input type="hidden" name="xsrf_token" value="{$_SESSION['xsrf_token']}" />
              <input type="submit" name="lmtDataTeam_changeTeamRoundShort" value="Change" {$scoring_freeze}/>
            </div></form>
          </td>
        </tr><tr>
          <td>Team Round Long Score:</td>
          <td>
            <form id="lmtDataTeamRoundLongScore" method="post" action="{$_SERVER['REQUEST_URI']}"><div>
              <input type="checkbox" name="teamRoundLongHasValue" value="Yes" onchange="nullboxSetState(2);"{$teamround_long_checked}/>
              <input type="text" name="teamRoundLongScore" size="25" value="{$teamround_long_score}" />
              <input type="hidden" name="xsrf_token" value="{$_SESSION['xsrf_token']}" />
              <input type="submit" name="lmtDataTeam_changeTeamRoundLong" value="Change" {$scoring_freeze}/>
            </div></form>
          </td>
        </tr><tr>
          <td>Guts Round Score:</td>
          <td><a href="../Guts/Full?ID={$id}">View &amp; Edit</a></td>
        </tr><tr>
          <td>Composite Score:</td>
          <td><span class="b">{$composite_score}</span><br /><br /></td>
        </tr><tr>
          <td>Members:</td>
          <td>
{$members_list}              <br />
          </td>
        </tr><tr>
          <td>Delete:</td>
          <td>
            <form method="post" action="{$_SERVER['REQUEST_URI']}"><div>
              <input type="submit" name="lmtDataTeam_delete" value="Delete Team &amp; Members" />
            </div></form>
          </td>
        </tr>
      </table>
HEREDOC;
    die;
}