Exemplo n.º 1
0
<?php

include 'includes/header.php';
?>
<div class="col-sm-9  col-md-10">
<?php 
require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/modules/tournamentManagement/tournaments.php";
require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/modules/tournamentManagement/raffle.php";
?>
<script src="/includes/modules/tournamentManagement/generic.js"></script>
<?php 
if (isset($_GET['edit'])) {
    ?>
  <?php 
    $thisTournament = Tournament::find_by_tournamentid($_GET['edit']);
    $participants = unserialize($thisTournament->participants);
    $allUsers = User::find('all');
    $autocompleteUsers = array();
    foreach ($allUsers as $thisUser) {
        array_push($autocompleteUsers, $thisUser->loginname);
    }
    ?>
  <script>
    $(function() {
      var availableTags = ["<?php 
    echo implode('","', $autocompleteUsers);
    ?>
"]
      $( "#participant" ).autocomplete({
        source:  availableTags
      });
Exemplo n.º 2
0
//Finalize Tournament
if (isset($_GET['finalizeScores'])) {
    //Finalize the tournamet on challonge to get the final scores
    $params = array();
    $tournament = $challonge->finalizeTournament($_POST['tournamentIDFinalURL'], $params);
    $params = array("include_participants" => 1);
    $tournament = $challonge->getTournament($_POST['tournamentIDFinalURL'], $params);
    foreach ($tournament->participants->participant as $thisParticipant) {
        switch ((string) $thisParticipant->{'final-rank'}) {
            case '1':
                $assignedTickets = 4;
                break;
            case '2':
                $assignedTickets = 3;
                break;
            case '3':
                $assignedTickets = 2;
                break;
            default:
                $assignedTickets = 1;
                break;
        }
        $thisUser = User::find_by_username($thisParticipant->name);
        addTicket($thisUser->userid, $_POST['tournamentGame'], $assignedTickets);
    }
    $thisTournament = Tournament::find_by_tournamentid($_POST['tournamentIDFinal']);
    $thisTournament->status = '3';
    $thisTournament->complete = '1';
    $thisTournament->save();
    header("Location: " . $_SERVER['HTTP_REFERER']);
}