Simple visualization of data from input JSON
1. Show All teams image
2. Bronze match available and we show it
3. Bronze match available in list but we need correction for Final match
$file = 'https://raw.githubusercontent.com/openfootball/world-cup.json/master/2014/worldcup.json';
$json = file_get_contents($file);
$obj = json_decode($json);
$teams_d = array();
$teams_h = array();
$teams_a = array();
foreach($obj->rounds as $matchdays){
foreach($matchdays->matches as $match){
if(isset($match->knockout)){
if($match->knockout == true){
$teams_h["name"] = $match->team1->name;
$teams_h["score"] = $match->score1;
$teams_h["et_score"] = $match->score1et;
$teams_h["pt_score"] = $match->score1p;
$teams_a["name"] = $match->team2->name;
$teams_a["score"] = $match->score2;
$teams_a["et_score"] = $match->score2et;
$teams_a["pt_score"] = $match->score2p;
$teams_d[] = $teams_h;
$teams_d[] = $teams_a;
}
}
}
}
$settings = array('image'=>true, 'bronze'=>true, 'nobronze' =>true);
$brackets = new Visualizer($teams_d, $settings);
echo $brackets->RenderFromData();