<?php

ini_set("display_startup_errors", 1);
ini_set("display_errors", 1);
include_once "class.olympicPage.inc";
// every page relies on the platformPage, in this case the olympicPage
$page = new olympicPage();
$page->mustBeUser("login.php");
// presentation layer. actually an html page
$page->setDefaultPage("judge.tpl");
// first we get the schedule of the assigned round.
$round_id = 1;
$scheduleround = $page->getRoundSchedule($round_id);
//  var_dump(count($scheduleround));
for ($i = 0; count($scheduleround) > $i; $i++) {
    $players[$scheduleround[$i]['player_id']] = $scheduleround[$i]['surname'];
}
// first get the players of this session_id in sequence how it is scheduled.
if (count($players) == 0) {
    if ($_GET['alternative']) {
        $page->m_smarty->assign("message", "The selected round is already judged, please choose another...");
    }
    $page->m_smarty->assign("noplayers", "true");
    $page->addItem("DropDown", "roundname", "in_template");
    $page->m_items['roundname']->changeOnSubmit();
    $page->m_items['roundname']->setValues($page->getRounds());
    $page->m_items['roundname']->startEmpty("------");
    $page->m_items['roundname']->addValidation("IsInt");
    $page->m_items['roundname']->m_validationrule->setErrorMessage("Please select a round");
} else {
    $page->addItem("InputFieldNoEdit", "roundname", "in_template");