Exemplo n.º 1
0
// +-----------------------------------+
$token = $_REQUEST['token'];
$event_id = $_REQUEST['event_id'];
$tour_id = $_REQUEST['tour_id'];
if (!($token && $event_id && $tour_id)) {
    $success = "0";
    $msg = "Incomplete Parameters";
    $data = array();
} else {
    // +-----------------------------------+
    // + STEP 3: perform operations		   +
    // +-----------------------------------+
    $user_id = Users::getUserId($token);
    if ($user_id) {
        $team_count = Tournament::getTeamCount($tour_id, $event_id);
        $court_count = Tournament::getCourtCount($tour_id, $event_id);
        $tour_type = Tournament::getTourType($tour_id);
        $players = array();
        $courts = array();
        for ($x = 1; $x <= $team_count; $x++) {
            array_push($players, 'T' . $x);
        }
        shuffle($players);
        $count = count($players);
        //players_count
        for ($x = 1; $x <= $court_count; $x++) {
            array_push($courts, 'C' . $x);
        }
        $start_date = Scheduling::getStartTime($tour_id);
        $winner_bracket = 'W';
        $loser_bracket = 'L';