Пример #1
0
function getAllGames()
{
    $sql = "select * FROM games";
    $regions = getAllRegions();
    $teams = getTeamsArray();
    try {
        $db = getConnection();
        $stmt = $db->prepare($sql);
        $stmt->execute();
        $games = $stmt->fetchAll(PDO::FETCH_OBJ);
        foreach ($games as $game) {
            //Récup infos teams
            $game->region = $regions[$game->region]->name;
            $game->blue = $teams[$game->blue]->name;
            $game->red = $teams[$game->red]->name;
            $game->winner = $game->winner == 1 ? $game->blue : $game->red;
            //Récup compos
            $game->blue_compo = getCompo($game->blue_compo);
            $game->red_compo = getCompo($game->red_compo);
            //Récup bans
            $game->blue_bans = getBans($game->blue_bans);
            $game->red_bans = getBans($game->red_bans);
        }
        return $games;
    } catch (PDOException $e) {
        return null;
    }
}
Пример #2
0
function getTeamsOptionsForLeague($league)
{
    require 'variables.php';
    $teamsInstance = getTeamsArray();
    $resultString = "";
    $sql = "SELECT * FROM {$leaguestable} where league = '{$league}' order by player";
    $result = mysql_query($sql);
    while ($row = mysql_fetch_array($result)) {
        $team = $row['team'];
        $player = $row['player'];
        $teamName = getTeamNameForId($team);
        $resultString .= '<option value="' . $team . '">' . $player . ' (' . $teamName . ')</option>';
    }
    return $resultString;
}
Пример #3
0
<?php

// the rules and information page
header("Cache-Control: no-cache");
header("Pragma: no-cache");
$page = "games";
$subpage = "categories";
require './variables.php';
require './variablesdb.php';
require './functions.php';
require './top.php';
$teamsInstance = getTeamsArray();
$catGlobal = getCategoriesArray();
?>

<?php 
echo getOuterBoxTop($subNavText . getRaquo() . getSubNavigation($subpage, null), "");
?>
<table>
<?
	foreach ($catGlobal as $category => $catCurrent) {
		// $category = key($catGlobal);
		// echo  "<!-- cat: ".$category." -->";
		$teams = array();
		foreach ($teamsInstance as $rowArray) {
			if ($rowArray[3] == $category) {
				// put scope, id, name
				$teams[] = array($rowArray[2], $rowArray[0], $rowArray[1], $rowArray[5], $rowArray[4]);  
				// echo "<!--".$rowArray[2].".". $rowArray[0].".". $rowArray[1].".". $rowArray[4].".".$rowArray[5]."-->";
			}
		}