function display_scores($dbh)
{
    # Get event ID number, which must look like an integer
    $event_id = script_param("event_id");
    if (!ctype_digit($event_id)) {
        die("Bad event ID\n");
    }
    # Select scores for the given event
    $stmt = "\n    SELECT\n      student.student_id, student.name, grade_event.date,\n      score.score AS score, grade_event.category\n    FROM student\n      INNER JOIN grade_event\n      LEFT JOIN score ON student.student_id = score.student_id\n                      AND grade_event.event_id = score.event_id\n    WHERE grade_event.event_id = ?\n    ORDER BY student.name";
    $sth = $dbh->prepare($stmt);
    $sth->execute(array($event_id));
    # fetch the rows into an array so we know how many there are
    $rows = $sth->fetchAll();
    if (count($rows) == 0) {
        die("No information was found for the selected event\n");
    }
    printf("<form method=\"post\" action=\"%s?action=%d&event_id=%d\">\n", script_name(), ENTER_SCORES, $event_id);
    # print scores as an HTML table
    for ($row_num = 0; $row_num < count($rows); $row_num++) {
        $row = $rows[$row_num];
        # Print event info and table heading preceding the first row
        if ($row_num == 0) {
            printf("Event ID: %d, Event date: %s, Event category: %s\n", $event_id, $row["date"], $row["category"]);
            print "<br /><br />\n";
            print "<table border=\"1\">\n";
            print "<tr>\n";
            display_cell("th", "Name");
            display_cell("th", "Score");
            print "</tr>\n";
        }
        print "<tr>\n";
        display_cell("td", $row["name"]);
        $col_val = sprintf("<input type=\"text\" name=\"score[%d]\"", $row["student_id"]);
        $col_val .= sprintf(" value=\"%d\" size=\"5\" /><br />\n", $row["score"]);
        display_cell("td", $col_val, FALSE);
        print "</tr>\n";
    }
    print "</table>\n";
    print "<br />\n";
    print "<input type=\"submit\" name=\"submit\" value=\"Submit\" />\n";
    print "</form>\n";
}
Example #2
0
if (0 && empty($gHistory['DB'])) {
    print start_page($gamenames[$_GET['game']] . ' Game Data Offline');
    print 'The ' . $_GET['game'] . ' database is currently unavailable. Please check back shortly.';
    print end_page();
    return;
}
$gOutput = OutputFormat::getInstance($_GET['format']);
$gOutput->set_start_functions('start_page', 'end_page');
if (!empty($_GET['history'])) {
    display_history();
} elseif (!empty($_GET['more'])) {
    display_more_search($_GET['search']);
} elseif (!empty($_GET['search'])) {
    display_search($_GET['search']);
} elseif (isset($_GET['formid']) || isset($_GET['ordid']) || isset($_GET['edid'])) {
    display_cell($_GET['formid'], $_GET['edid'], $_GET['ordid']);
} elseif (isset($_GET['script']) || isset($_GET['sid'])) {
    display_script($_GET['script'], $_GET['sid']);
} elseif (isset($_GET['stats'])) {
    display_rectype_stats($_GET['rec']);
} elseif (isset($_GET['rec'])) {
    display_rectype($_GET['rec']);
} else {
    display_main();
}
function process_get()
{
    global $gamenames;
    $format = NULL;
    if (isset($_GET['format'])) {
        $format = strtolower($_GET['format']);