Exemple #1
0
function show_setup_page()
{
    $teams_dropdown = make_teams_dropdown();
    echo <<<HEREDOC
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html
     PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  <head>
    <title></title>
    <link rel="stylesheet" href="../../../res/default.css" type="text/css" media="all" />
    <link rel="stylesheet" href="../../../res/lmt.css" type="text/css" media="all" />
    <link rel="stylesheet" href="../../../res/print.css" type="text/css" media="print" />
  </head>
  
  <body class="gutsEmbedSetup">
    <form method="get" action="{$_SERVER['REQUEST_URI']}">
      <table>
        <tr>
          <td>Team:</td>
          <td>
{$teams_dropdown}
          </td>
        </tr><tr>
          <td>Color:&nbsp;</td>
          <td>
            <select name="Color" style="width: 100px;">
              <option value="fff" style="background-color: #fff;">White</option>
              <option value="f66" style="background-color: #f66;">Red</option>
              <option value="fc9" style="background-color: #fc9;">Orange</option>
              <option value="ffc" style="background-color: #ffc;">Yellow</option>
              <option value="cf9" style="background-color: #cf9;">Green</option>
              <option value="9fc" style="background-color: #9fc;">Turquoise</option>
              <option value="9cf" style="background-color: #9cf;">Blue</option>
              <option value="ccf" style="background-color: #ccf;">Purple</option>
              <option value="fcf" style="background-color: #fcf;">Pink</option>
              <option value="630" style="background-color: #630;">Brown</option>
              <option value="000" style="background-color: #000;">Black</option>
              <option value="f6358a" style="background-color: #f6358a;">Dark Pink</option>
              <option value="eee" style="background-color: #eee;">Gray</option>
            </select>
          </td>
        </tr><tr>
          <td></td>
          <td><input type="submit" value="Select" /></td>
        </tr>
      </table>
    </form>
  </body>
</html>
HEREDOC;
    die;
}
Exemple #2
0
function display_individual($err, $selected_field)
{
    $row = DB::queryFirstRow('SELECT individuals.*, teams.name AS team_name, (SELECT name AS school_name FROM schools WHERE schools.school_id=teams.school) AS school_name' . ' FROM individuals LEFT JOIN teams ON individuals.team=teams.team_id' . ' WHERE id=%i', $_GET['ID']);
    $name = htmlentities($row['name']);
    $school = htmlentities($row['school_name']);
    if ($row['grade'] == '6') {
        $grade6_sel = ' selected="selected"';
    } else {
        if ($row['grade'] == '7') {
            $grade7_sel = ' selected="selected"';
        } else {
            if ($row['grade'] == '8') {
                $grade8_sel = ' selected="selected"';
            }
        }
    }
    $email = htmlentities($row['email']);
    if ($email != '') {
        $email_link = "\n              <div class=\"halfbreak\"></div>              <a href=\"mailto:{$email}\" rel=\"external\">Send Email</a>";
        $school = 'Unaffiliated';
    }
    $attendance = htmlentities($row['attendance']) ? 'Present' : 'Absent';
    $team_id = htmlentities($row['team']);
    $team_link = '<a href="Team?ID=' . $team_id . '">' . htmlentities($row['team_name']) . '</a>';
    if ($team_id == -1) {
        $team_link = '<span class="b">Not Assigned</span>';
    }
    $teams_dropdown = make_teams_dropdown($team_id);
    if ($school == '') {
        $school = 'None';
    }
    $individualround_checked = is_null($row['score_individual']) ? '' : ' checked="checked"';
    $individualround_score = htmlentities($row['score_individual']);
    $themeround_checked = is_null($row['score_theme']) ? '' : ' checked="checked"';
    $themeround_score = htmlentities($row['score_theme']);
    $row2 = DB::queryFirstRow(individual_composite('', 'WHERE id="' . mysqli_real_escape_string(DB::get(), $_GET['ID']) . '"'));
    $composite_score = $row2['score_composite'];
    if (is_null($composite_score)) {
        $composite_score = 'None';
    } else {
        $composite_score = htmlentities($composite_score);
    }
    if (!isset($scoring_warning)) {
        $scoring_warning = '';
    }
    if (!isset($grade7_sel)) {
        $grade7_sel = '';
    }
    if (!isset($grade8_sel)) {
        $grade8_sel = '';
    }
    if (!isset($email_link)) {
        $email_link = '';
    }
    if (!isset($scoring_freeze)) {
        $scoring_freeze = '';
    }
    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['lmtDataIndividualRoundScore'].hasValue.checked) {
          document.forms['lmtDataIndividualRoundScore'].score.disabled = false;
          if (isClick == 1)
            document.forms['lmtDataIndividualRoundScore'].score.focus();
        }
        else
          document.forms['lmtDataIndividualRoundScore'].score.disabled = true;
        
        
        if (document.forms['lmtDataThemeRoundScore'].hasValue.checked) {
          document.forms['lmtDataThemeRoundScore'].score.disabled = false;
          if (isClick == 2)
            document.forms['lmtDataThemeRoundScore'].score.focus();
        }
        else
          document.forms['lmtDataThemeRoundScore'].score.disabled = true;
      }
HEREDOC;
    if ($err != '') {
        $err = "\n        <div class=\"error\">{$err}</div><br />\n";
    }
    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($name);
    echo <<<HEREDOC
      <h1>Individual</h1>
      {$scoring_warning}
      <table>
        <tr>
          <td>Name:</td>
          <td>
            <form id="lmtDataIndividualName" method="post" action="{$_SERVER['REQUEST_URI']}"><div>
              <input type="text" name="name" size="25" maxlength="25" value="{$name}" />
              <input type="hidden" name="xsrf_token" value="{$_SESSION['xsrf_token']}" />
              <input type="submit" name="lmtDataIndividual_changeName" value="Change" />
            </div></form>
          </td>
        </tr><tr>
          <td>Grade:</td>
          <td>
            <form id="lmtDataIndividualGrade" method="post" action="{$_SERVER['REQUEST_URI']}"><div>
              <select name="grade">
                <option value="6"{$grade6_sel}>Sixth</option>
                <option value="7"{$grade7_sel}>Seventh</option>
                <option value="8"{$grade8_sel}>Eighth</option>
              </select>
              <input type="hidden" name="xsrf_token" value="{$_SESSION['xsrf_token']}" />
              <input type="submit" name="lmtDataIndividual_changeGrade" value="Change" />
            </div></form>
          </td>
        </tr><tr>
          <td>Email:</td>
          <td>
            <form id="lmtDataIndividualEmail" method="post" action="{$_SERVER['REQUEST_URI']}"><div>
              <input type="text" name="email" size="25" value="{$email}" />
              <input type="hidden" name="xsrf_token" value="{$_SESSION['xsrf_token']}" />
              <input type="submit" name="lmtDataIndividual_changeEmail" value="Change" />{$email_link}
            </div></form>
          </td>
        </tr><tr>
          <td>Attendance:</td>
          <td>
            <form id="lmtDataIndividualAttendance" method="post" action="{$_SERVER['REQUEST_URI']}"><div>
              <span class="b">{$attendance}</span>&nbsp;
              <input type="hidden" name="currentAttendance" value="{$attendance}" />
              <input type="hidden" name="xsrf_token" value="{$_SESSION['xsrf_token']}" />
              <input type="submit" name="lmtDataIndividual_changeAttendance" value="Change" />
            </div></form>
            <br />
          </td>
        </tr><tr>
          <td>Team:</td>
          <td>
            {$team_link}
            <div class="halfbreak"></div>
            <form id="lmtDataIndividualTeam" method="post" action="{$_SERVER['REQUEST_URI']}"><div>
{$teams_dropdown}
              <input type="hidden" name="xsrf_token" value="{$_SESSION['xsrf_token']}" />
              <input type="submit" name="lmtDataIndividual_changeTeam" value="Change" />
            </div></form>
          </td>
        </tr><tr>
          <td>School:</td>
          <td><span class="b">{$school}</span><br /><br /></td>
        </tr><tr>
          <td>Individual Round Score:</td>
          <td>
            <form id="lmtDataIndividualRoundScore" method="post" action="{$_SERVER['REQUEST_URI']}"><div>
              <input type="checkbox" name="hasValue" value="Yes" onchange="nullboxSetState(1);"{$individualround_checked}/>
              <input type="text" name="score" size="25" value="{$individualround_score}" />
              <input type="hidden" name="xsrf_token" value="{$_SESSION['xsrf_token']}" />
              <input type="submit" name="lmtDataIndividual_changeIndividualRound" value="Change" {$scoring_freeze}/>
            </div></form>
          </td>
        </tr><tr>
          <td>Theme Round Score:</td>
          <td>
            <form id="lmtDataThemeRoundScore" method="post" action="{$_SERVER['REQUEST_URI']}"><div>
              <input type="checkbox" name="hasValue" value="Yes" onchange="nullboxSetState(2);"{$themeround_checked}/>
              <input type="text" name="score" size="25" value="{$themeround_score}" />
              <input type="hidden" name="xsrf_token" value="{$_SESSION['xsrf_token']}" />
              <input type="submit" name="lmtDataIndividual_changeThemeRound" value="Change" {$scoring_freeze}/>
            </div></form>
          </td>
        </tr><tr>
          <td>Composite Score:</td>
          <td><span class="b">{$composite_score}</span><br /><br /></td>
        </tr><tr>
          <td>Delete:</td>
          <td>
            <form method="post" action="{$_SERVER['REQUEST_URI']}"><div>
              <input type="submit" name="lmtDataIndividual_delete" value="Delete Member" />
            </div></form>
          </td>
        </tr>
      </table>
HEREDOC;
    die;
}