Skip to content

Commit

Permalink
Updated blade to format
Browse files Browse the repository at this point in the history
Updated blade to format
  • Loading branch information
sebastiaanspeck committed Sep 25, 2018
1 parent 8d9846a commit 52033e9
Show file tree
Hide file tree
Showing 3 changed files with 118 additions and 71 deletions.
69 changes: 36 additions & 33 deletions resources/views/leagues.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,40 +3,43 @@
@section('content')
<div class = "container">

<h1> Leagues </h1>
@php
echo "<h1> Leagues </h1>";
@if(isset($leagues))
@if(count($leagues) >= 2)
<table class="table table-striped">
<thead>
<tr>
<th>League name</th>
<th>Country</th>
</tr>
</thead>
<tbody>
@foreach($leagues as $league)
<tr>
{{--<td><a href="{{action('SoccerAPI\SoccerAPIController@viewLeagueDetails', ['league_id' => $project['id']])}}"> {{$league->'name'}} </a></td>--}}
<td> {{$league->name}} </td>
@php
if($league->country->data->extra != null) {
$flag_code = strtolower($league->country->data->extra->iso);
echo "<td>" . $league->country->data->name . "&nbsp;&nbsp; <img src=\"flags/" . $flag_code . ".gif\"> </td>";
} elseif ($league->country->data->name == "Europe") {
echo "<td>" . $league->country->data->name . "&nbsp;&nbsp; <img src=\"flags/europeanunion.gif\"> </td>";
} else {
echo "<td>" . $league->country->data->name . "</td>";
}
@endphp
</tr>
@endforeach
</tbody>
</table>
@else
<p> {{ $leagues }}</p>
@endif
@endif
if(isset($leagues)) {
if(count($leagues) >= 1) {
echo "<table class='table table-striped table-light' width='100%'>";
echo "<thead>";
echo "<tr>";
echo "<th scope='col' width='50%'>League name</th>";
echo "<th scope='col' width='50%'>Country</th>";
echo "</tr>";
echo "</thead>";
echo "<tbody>";
foreach($leagues as $league) {
echo "<tr>";
echo "<td scope='row' width='50%'>" . $league->name . "</td>";
if($league->country->data->extra != null) {
$flag_code = strtolower($league->country->data->extra->iso);
echo "<td scope='row' width='50%'> " . $league->country->data->name . "&nbsp;&nbsp; <img src=\"flags/" . $flag_code . ".gif\"> </td>";
} elseif ($league->country->data->name == "Europe") {
echo "<td scope='row' width='50%'>" . $league->country->data->name . "&nbsp;&nbsp; <img src=\"flags/europeanunion.gif\"> </td>";
} else {
echo "<td scope='row' width='50%'>" . $league->country->data->name . "</td>";
}
echo "</tr>";
}
echo "</tbody>";
echo "</table>";
echo "<div>";
echo $leagues->links();
echo "</div>";
} else {
echo "<p> {{ $leagues }}</p>";
}
}
@endphp

</div>
@endsection
46 changes: 27 additions & 19 deletions resources/views/livescores_now.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,47 +4,55 @@
<div class = "container">

@php
echo "<h1> Livescores In-play - " . date("Y-m-d") . "</h1>";
echo "<h1> Livescores in-play - " . date("Y-m-d") . "</h1>";
if(isset($livescores)) {
if(count($livescores) >= 2) {
if(count($livescores) >= 1) {
if(count($livescores) == 100) {
echo "<p style='color:red'> We only show the first 100 results. The data shown might now be complete. We try to fix this in a later version. </p>";
}
$last_league_id = 0;
foreach($livescores as $livescore) {
if(in_array($livescore->time->status, array('NS', 'FT', 'FT_PEN', 'CANCL', 'POSTP', 'INT', 'ABAN', 'SUSP', 'AWARDED', 'DELAYED', 'TBA', 'WO', 'AU'))) {
continue;
}
$league = $livescore->league->data;
$homeTeam = $livescore->localTeam->data;
$awayTeam = $livescore->visitorTeam->data;
if($livescore->league_id == $last_league_id) {
echo "<tr>";
echo "<td>" . $homeTeam->name . "</td>";
echo "<td>" . $awayTeam->name . "</td>";
echo "<td>" . $livescore->scores->ft_score . "</td>";
echo "<td>" . $livescore->time->starting_at->date_time . "</td>";
echo "<td scope='row'>" . $homeTeam->name . "</td>";
echo "<td scope='row'>" . $awayTeam->name . "</td>";
echo "<td scope='row'>" . $livescore->scores->localteam_score . " - " . $livescore->scores->visitorteam_score . "</td>";
echo "<td scope='row'>" . date('Y-m-d H:i', strtotime($livescore->time->starting_at->date_time)) . "</td>";
echo "<td scope='row'><a href='#'>Details</a></td>"; //link to details page (fixtures/{id})
echo "</tr>";
} else {
echo "<table class='table table-responsive' width='100%'>";
echo "<table class='table table-striped table-light' width='100%'>";
echo "<br><h3>" . $league->name . "</h3>"; // add link to league-details page
echo "<col style='width:25%'>";
echo "<col style='width:25%'>";
echo "<col style='width:25%'>";
echo "<col style='width:25%'>";
echo "<thead>";
echo "<tr>";
echo "<th>Home team</th>";
echo "<th>Away team</th>";
echo "<th>Result</th>";
echo "<th>Date and time</th>";
echo "<th scope='col' width='35%'>Home team</th>";
echo "<th scope='col' width='35%'>Away team</th>";
echo "<th scope='col' width='10%'>Score</th>";
echo "<th scope='col' width='15%'>Date and time</th>";
echo "<th scope='col' width='5%'>Details</th>";
echo "</tr>";
echo "</thead>";
echo "<tbody>";
echo "<tr>";
echo "<td>" . $homeTeam->name . "</td>";
echo "<td>" . $awayTeam->name . "</td>";
echo "<td>" . $livescore->scores->ft_score . "</td>";
echo "<td>" . $livescore->time->starting_at->date_time . "</td>";
echo "<td scope='row'>" . $homeTeam->name . "</td>";
echo "<td scope='row'>" . $awayTeam->name . "</td>";
echo "<td scope='row'>" . $livescore->scores->localteam_score . " - " . $livescore->scores->visitorteam_score . "</td>";
echo "<td scope='row'>" . date('Y-m-d H:i', strtotime($livescore->time->starting_at->date_time)) . "</td>";
echo "<td scope='row'><a href='#'>Details</a></td>"; //link to details page (fixtures/{id})
echo "<tr>";
}
$last_league_id = $livescore->league_id;
}
if($last_league_id == 0) {
echo "<p> No livescores in-play right now.</p>";
}
} else {
echo "<p> No livescores in-play right now.</p>";
}
Expand Down
74 changes: 55 additions & 19 deletions resources/views/livescores_today.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,41 +7,77 @@
echo "<h1> Livescores - " . date("Y-m-d") . "</h1>";
if(isset($livescores)) {
if(count($livescores) >= 2) {
if(count($livescores) >= 1 && gettype($livescores) == 'array') {
if(count($livescores) == 100) {
echo "<p style='color:red'> We only show the first 100 results. The data shown might now be complete. We try to fix this in a later version. </p>";
}
$last_league_id = 0;
foreach($livescores as $livescore) {
if(in_array($livescore->time->status, array('LIVE', 'HT', 'ET', 'PEN_LIVE', 'AET', 'BREAK', 'AU'))) {
continue;
}
$league = $livescore->league->data;
$homeTeam = $livescore->localTeam->data;
$awayTeam = $livescore->visitorTeam->data;
if($livescore->scores->localteam_score > $livescore->scores->visitorteam_score && $livescore->time->status == 'FT') {
$winningTeam = $homeTeam->name;
} elseif ($livescore->scores->localteam_score == $livescore->scores->visitorteam_score && $livescore->time->status == 'FT'){
$winningTeam = 'draw';
} elseif ($livescore->scores->localteam_score < $livescore->scores->visitorteam_score && $livescore->time->status == 'FT') {
$winningTeam = $awayTeam->name;
} else {
$winningTeam = 'TBD';
}
if($livescore->league_id == $last_league_id) {
echo "<tr>";
echo "<td>" . $homeTeam->name . "</td>";
echo "<td>" . $awayTeam->name . "</td>";
echo "<td>" . $livescore->scores->ft_score . "</td>";
echo "<td>" . $livescore->time->starting_at->date_time . "</td>";
if($winningTeam == $homeTeam->name) {
echo "<td scope='row' style='color:green'>" . $homeTeam->name . "</td>";
echo "<td scope='row' style='color:red'>" . $awayTeam->name . "</td>";
} elseif($winningTeam == $awayTeam->name) {
echo "<td scope='row' style='color:red'>" . $homeTeam->name . "</td>";
echo "<td scope='row' style='color:green'>" . $awayTeam->name . "</td>";
} elseif($winningTeam == 'draw') {
echo "<td scope='row' style='color:orange'>" . $homeTeam->name . "</td>";
echo "<td scope='row' style='color:orange'>" . $awayTeam->name . "</td>";
} else {
echo "<td scope='row'>" . $homeTeam->name . "</td>";
echo "<td scope='row'>" . $awayTeam->name . "</td>";
}
echo "<td scope='row'>" . $livescore->scores->localteam_score . " - " . $livescore->scores->visitorteam_score . "</td>";
echo "<td scope='row'>" . date('Y-m-d H:i', strtotime($livescore->time->starting_at->date_time)) . "</td>";
echo "<td scope='row'><a href='#'>Details</a></td>"; //link to details page (fixtures/{id})
echo "</tr>";
} else {
echo "<table class='table table-responsive' width='100%'>";
echo "<table class='table table-striped table-light' width='100%'>";
echo "<br><h3>" . $league->name . "</h3>"; // add link to league-details page
echo "<col style='width:25%'>";
echo "<col style='width:25%'>";
echo "<col style='width:25%'>";
echo "<col style='width:25%'>";
echo "<thead>";
echo "<tr>";
echo "<th>Home team</th>";
echo "<th>Away team</th>";
echo "<th>Result</th>";
echo "<th>Date and time</th>";
echo "<th scope='col' width='35%'>Home team</th>";
echo "<th scope='col' width='35%'>Away team</th>";
echo "<th scope='col' width='10%'>Score</th>";
echo "<th scope='col' width='15%'>Date and time</th>";
echo "<th scope='col' width='5%'>Details</th>";
echo "</tr>";
echo "</thead>";
echo "<tbody>";
echo "<tr>";
echo "<td>" . $homeTeam->name . "</td>";
echo "<td>" . $awayTeam->name . "</td>";
echo "<td>" . $livescore->scores->ft_score . "</td>";
echo "<td>" . $livescore->time->starting_at->date_time . "</td>";
echo "<tr>";
if($winningTeam == $homeTeam->name) {
echo "<td scope='row' style='color:green'>" . $homeTeam->name . "</td>";
echo "<td scope='row' style='color:red'>" . $awayTeam->name . "</td>";
} elseif($winningTeam == $awayTeam->name) {
echo "<td scope='row' style='color:red'>" . $homeTeam->name . "</td>";
echo "<td scope='row' style='color:green'>" . $awayTeam->name . "</td>";
} elseif($winningTeam == 'draw') {
echo "<td scope='row' style='color:orange'>" . $homeTeam->name . "</td>";
echo "<td scope='row' style='color:orange'>" . $awayTeam->name . "</td>";
} else {
echo "<td scope='row'>" . $homeTeam->name . "</td>";
echo "<td scope='row'>" . $awayTeam->name . "</td>";
}
echo "<td scope='row'>" . $livescore->scores->localteam_score . " - " . $livescore->scores->visitorteam_score . "</td>";
echo "<td scope='row'>" . date('Y-m-d H:i', strtotime($livescore->time->starting_at->date_time)) . "</td>";
echo "<td scope='row'><a href='#'>Details</a></td>"; //link to details page (fixtures/{id})
echo "</tr>";
}
$last_league_id = $livescore->league_id;
}
Expand Down

0 comments on commit 52033e9

Please sign in to comment.