Esempio n. 1
0
         break;
     }
     $breadcrumbs->addElement($lang->get('my_tournaments'), makeURL($mod, array('mode' => 'mytournaments')));
     $smarty->assign('path', $template_dir . "/mytournaments.tpl");
     $smarty->assign('credits', $tCredit->getValues($login->currentUserId()));
     $mytournaments = makeTournamentList(getTournaments($login->currentUserId()), $login->currentUserId());
     if ($mytournaments) {
         $smarty->assign('tournaments', $mytournaments);
         // No Tournaments
     } else {
         $smarty->assign('no_tournaments', $lang->get("no_tournaments_registered"));
     }
     if ($mytournaments && count($mytournaments) > 0) {
         foreach ($mytournaments as $i => $tourn) {
             $mytournaments[$i]['url'] = makeURL($mod, array('tournamentid' => $tourn['tournamentid']));
             $mytournaments[$i]['color'] = makeListColor($tourn['state']);
         }
     }
     $smarty->assign('mytournaments', $mytournaments);
     break;
 case 'removetournament':
     if (!$right['add_remove_edit']) {
         break;
     }
     if (isset($_POST['yes'])) {
         $tournamentList->removeTournament($tournamentid);
         $notify->add($lang->get('tournament'), $lang->get('tournament_remove_done'));
     } else {
         $smarty->assign('path', $template_dir . "/removetournament.tpl");
         $smarty->assign('url_no', makeURL($mod, array('tournamentid' => $tournamentid)));
         //$tournament = $tournamentList->getTournament($tournamentid);
Esempio n. 2
0
function makeTournamentList($tournaments, $userid)
{
    if (count($tournaments) < 1) {
        return false;
    }
    $finalTournaments = array();
    foreach ($tournaments as $tournament) {
        $nextEnc = '';
        $ranking = '';
        switch ($tournament['state']) {
            // Inactive
            case 0:
                $url = $tournament['title'];
                break;
                // Joining
            // Joining
            case 1:
                $url = makeHTMLUrl($tournament['title'], makeUrl('tournament', array('tournamentid' => $tournament['tournamentid'])));
                break;
                // Running
            // Running
            case 2:
                $url = makeHTMLUrl($tournament['title'], makeUrl('tournament', array('tournamentid' => $tournament['tournamentid'], 'mode' => 'table')));
                $nextEnc = getNextEncounter($tournament, $userid);
                break;
                // Finished
            // Finished
            case 3:
                $url = makeHTMLUrl($tournament['title'], makeUrl('tournament', array('tournamentid' => $tournament['tournamentid'], 'mode' => 'table')));
                $tournament_obj = getTournamentObject($tournament);
                $ranking = $tournament_obj->ranking();
                break;
        }
        $finalTournaments[] = array('url' => $url, 'listcolor' => makeListColor($tournament['state']), 'nextencounter' => $nextEnc, 'state' => $tournament['state'], 'statename' => tournamentStateToString($tournament['state']), 'ranking' => $ranking, 'tournamentid' => $tournament['tournamentid'], 'title' => $tournament['title']);
    }
    return $finalTournaments;
}
Esempio n. 3
0
<?php

switch ($_GET['view']) {
    case 'overview':
        $tlist = $db->selectList('tournamentlist', '*', "`state`=1 OR `state`=2", "`state` ASC");
        if (count($tlist) > 0) {
            foreach ($tlist as $i => $t) {
                $tlist[$i]['state_str'] = tournamentStateToString($t['state']);
                $tlist[$i]['color'] = makeListColor($t['state']);
            }
        }
        $smarty->assign('tournamentList', $tlist);
        $smarty->assign('path', $template_dir . "/beamer/overview.tpl");
        break;
    case 'nextencounters':
        require_once "./mod/default/tournament/tournament.function.php";
        $smarty->assign('encounterList', getAllNextEncounters());
        $smarty->assign('path', $template_dir . "/beamer/nextencounters.tpl");
        break;
}