Show all player leagues in 1 view, reduce nav Dropdown meny item count
This commit is contained in:
parent
02329d5c21
commit
c337916a3b
9 changed files with 93 additions and 47 deletions
|
|
@ -66,6 +66,12 @@ class LeaguesController extends Controller
|
|||
}
|
||||
|
||||
public function createLeagues($start_round_id, $round_count) {
|
||||
|
||||
$users=User::getActives();
|
||||
if (sizeof($users)==0){
|
||||
return view("leagues.no_users");
|
||||
}
|
||||
|
||||
League::createLeagues($start_round_id, $round_count);
|
||||
|
||||
Log::info("LeaguesController::createLeagues completed.");
|
||||
|
|
@ -103,18 +109,15 @@ class LeaguesController extends Controller
|
|||
return view ('leagues.matches', compact('season', 'matchesTotal','leagues','leagueNames','roundNames'));
|
||||
}
|
||||
|
||||
public static function showLeagueRanking($rank, $maxRoundId=-1) {
|
||||
public static function showLeagueRanking() {
|
||||
$season = Season::getCurrent();
|
||||
$leagues = array_reverse(League::getRanking($rank));
|
||||
//$leagues = array_reverse(League::getRanking($rank));
|
||||
$leagueNames = League::getNames();
|
||||
$userNames = User::getNames();
|
||||
|
||||
$leagueScores = League::getRanking($rank);
|
||||
|
||||
$totalRanking = League::getTotalRankingOverall(); // Nur für Auf/Abstiegsinfo benötigt.
|
||||
$rankInfo=array();
|
||||
|
||||
|
||||
foreach($totalRanking as $index => $entry) {
|
||||
$userId=$entry[0];
|
||||
$rankInfo[$userId]=$totalRanking[$index][4];
|
||||
|
|
@ -126,9 +129,12 @@ class LeaguesController extends Controller
|
|||
$cols[3]="lightgrey";
|
||||
$cols[4]="";
|
||||
|
||||
$leagueScores=array();
|
||||
foreach([1,2,3,4] as $rank) {
|
||||
$leagueScores[$rank] = League::getRanking($rank);
|
||||
}
|
||||
|
||||
|
||||
return view ('leagues.chart',compact('season','leagues', 'leagueNames', 'userNames','leagueScores','rankInfo','rank','cols'));
|
||||
return view ('leagues.chart',compact('season', 'leagueNames', 'userNames','leagueScores','rankInfo','rank','cols'));
|
||||
}
|
||||
|
||||
public static function showSingleUserMatches($userId) {
|
||||
|
|
|
|||
|
|
@ -49,11 +49,27 @@ class Season extends Model
|
|||
return $seasons[1];
|
||||
}
|
||||
|
||||
public static function hasQualifications($seasonId) {
|
||||
$leagues = League::where('season_id','=',$seasonId)->get();
|
||||
foreach($leagues as $league) {
|
||||
if ($league->rank == League::RANK_QUALIFICATION) return true;
|
||||
public static function hasQualifications($seasonId=-1) {
|
||||
return Season::hasLeagueType($seasonId,League::RANK_QUALIFICATION);
|
||||
}
|
||||
|
||||
public static function hasStandardLeague($seasonId=-1) {
|
||||
return Season::hasLeagueType($seasonId,League::RANK_LEAGUE1);
|
||||
}
|
||||
|
||||
public static function hasLeagueType($seasonId=-1, $ltype) {
|
||||
$season=null;
|
||||
if ($seasonId==-1) {
|
||||
$season = Season::getCurrent();
|
||||
if (!$season) return false;
|
||||
$seasonId=$season->id;
|
||||
}
|
||||
$leagues = League::where('season_id', '=', $seasonId)->get();
|
||||
foreach ($leagues as $league) {
|
||||
if ($league->rank == $ltype) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -402,6 +402,9 @@ class Tipp extends Model
|
|||
$totalDayWinPayout = 0;
|
||||
|
||||
$round_count=0;
|
||||
|
||||
error_log("Round ids: ".implode(",",$round_ids));
|
||||
|
||||
foreach ($round_ids as $round_id) {
|
||||
$round_count += 1;
|
||||
$totalDayWinPayout += $payouts["tagessieg"];
|
||||
|
|
@ -474,6 +477,9 @@ class Tipp extends Model
|
|||
}
|
||||
|
||||
$quotas=Quota::getQuotas($currentSeason->id);
|
||||
|
||||
error_log("Round-Count=".$round_count);
|
||||
|
||||
if ($round_count==$quotas["Runden"]) {
|
||||
// Ranking Payout ausschütten
|
||||
$payout_groups =array();
|
||||
|
|
@ -505,7 +511,7 @@ class Tipp extends Model
|
|||
|
||||
$single_payout = $rankPayout / $groupsize;
|
||||
foreach($payout_groups[$current_rank] as $user_id) {
|
||||
$key = $round_count."_".$user_id;
|
||||
$key = $lastRoundId."_".$user_id;
|
||||
$roundtipps[$key]["ranking_payout"] += $single_payout;
|
||||
}
|
||||
$current_rank=0;
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ class Match extends Model
|
|||
$currentSeason = Season::getCurrent();
|
||||
$leagues = League::where('season_id', '=', $currentSeason->id)->get();
|
||||
foreach ($leagues as $league) {
|
||||
|
||||
error_log("Match::createMatchups league_id=".$league->id);
|
||||
Log::info("Creating matchups for league_id=".$league->id);
|
||||
// Wenn es keine previous League gibt, dann ist $league->rank immer RANK_QUALIFICATION,
|
||||
// ansonsten ist es einer von RANK_LEAGUE1, RANK_LEAGUE2, RANK_LEAGUE3
|
||||
|
|
@ -41,6 +41,9 @@ class Match extends Model
|
|||
if ($league->rank <= League::RANK_QUALIFICATION) {
|
||||
|
||||
$rounds = Round::where('id','>=',$league->start_round_id)->get();
|
||||
|
||||
error_log("Match::createMatchups. start_round_id = ".$league->start_round_id);
|
||||
|
||||
$roundNr=1;
|
||||
$neededRoundCount = Match::getNumberOfNeededRounds($league->id);
|
||||
|
||||
|
|
|
|||
|
|
@ -25,11 +25,9 @@
|
|||
<a href="#" id="btn_league" onclick="toggleSelect('dropdown_league'); return false;" style="font-weight:normal; font-color: blue; font-size: 22px;">Spieler-Liga</a>
|
||||
<div id="dropdown_league" class="dropdown-content">
|
||||
<a style="font-weight:normal; font-color: blue; font-size: 22px;" href="/league_show_rounds">Spielplan</a>
|
||||
<a style="font-weight:normal; font-color: blue; font-size: 22px;" href="/league/show/rank=4/max_round_id=-1#playerid_{{Auth::user()->id}}">Quali-Tabellen</a>
|
||||
|
||||
<a style="font-weight:normal; font-color: blue; font-size: 22px;" href="/league/show/rank=1/max_round_id=-1#playerid_{{Auth::user()->id}}">Tabelle Liga 1</a>
|
||||
<a style="font-weight:normal; font-color: blue; font-size: 22px;" href="/league/show/rank=2/max_round_id=-1#playerid_{{Auth::user()->id}}">Tabelle Liga 2</a>
|
||||
<a style="font-weight:normal; font-color: blue; font-size: 22px;" href="/league/show/rank=3/max_round_id=-1#playerid_{{Auth::user()->id}}">Tabelle Liga 3</a>
|
||||
<a style="font-weight:normal; font-color: blue; font-size: 22px;" href="/league/show#playerid_{{Auth::user()->id}}">Tabellen</a>
|
||||
|
||||
</div>
|
||||
</label>
|
||||
|
||||
|
|
|
|||
|
|
@ -21,34 +21,36 @@
|
|||
</tr>
|
||||
</table>
|
||||
|
||||
@foreach($leagueScores as $leagueId => $playerTuples)
|
||||
<h2>{{ $leagueNames[$leagueId] }}</h2>
|
||||
@foreach($leagueScores as $rank => $_leagueScores)
|
||||
@foreach($_leagueScores as $leagueId => $playerTuples)
|
||||
<h2>{{ $leagueNames[$leagueId] }}</h2>
|
||||
|
||||
<table class="table-bordered col-lg-12">
|
||||
<tr class="table-bordered">
|
||||
<td class="table-bordered" style="width:50px;">Pos</td>
|
||||
<td class="table-bordered" style="width:150px;">Spieler</td>
|
||||
<td class="table-bordered" style="width:50px;">Punkte</td>
|
||||
<td class="table-bordered" style="width:150px;">Tordifferenz</td>
|
||||
<td class="table-bordered" style="width:150px;">Torverhältnis</td>
|
||||
<td class="table-bordered" style="width:150px;">Quali-Rang</td>
|
||||
</tr>
|
||||
|
||||
<!-- Start Matchgruppen-Loop-->
|
||||
@foreach($playerTuples as $pos => $player)
|
||||
<table class="table-bordered col-lg-12">
|
||||
<tr class="table-bordered">
|
||||
<td style="width:50px;background-color:{{ $cols[$rankInfo[$player[0]]] }}"> {{$pos+1}} </td>
|
||||
<td> <a name="playerid_{{$player[0]}}" class="{{ $player[0]==Auth::user()->id ? 'blink_text' : '' }}" href="/league/showSingleUserMatches/user_id={{$player[0]}}"> {{$userNames[$player[0]]}} </a> </td>
|
||||
<td> {{$player[1]}} </td>
|
||||
<td> {{$player[2]-$player[3]}} </td>
|
||||
<td> {{$player[2]}}:{{$player[3]}} </td>
|
||||
<td> {{$rankInfo[$player[0]]}} </td>
|
||||
<td class="table-bordered" style="width:50px;">Pos</td>
|
||||
<td class="table-bordered" style="width:150px;">Spieler</td>
|
||||
<td class="table-bordered" style="width:50px;">Punkte</td>
|
||||
<td class="table-bordered" style="width:150px;">Tordifferenz</td>
|
||||
<td class="table-bordered" style="width:150px;">Torverhältnis</td>
|
||||
|
||||
</tr>
|
||||
@endforeach
|
||||
|
||||
</table>
|
||||
<p> </p>
|
||||
<!-- Start Matchgruppen-Loop-->
|
||||
@foreach($playerTuples as $pos => $player)
|
||||
<tr class="table-bordered">
|
||||
<td style="width:50px;background-color:{{ $cols[$rankInfo[$player[0]]] }}"> {{$pos+1}} </td>
|
||||
<td> <a name="playerid_{{$player[0]}}" class="{{ $player[0]==Auth::user()->id ? 'blink_text' : '' }}" href="/league/showSingleUserMatches/user_id={{$player[0]}}"> {{$userNames[$player[0]]}} </a> </td>
|
||||
<td> {{$player[1]}} </td>
|
||||
<td> {{$player[2]-$player[3]}} </td>
|
||||
<td> {{$player[2]}}:{{$player[3]}} </td>
|
||||
|
||||
</tr>
|
||||
@endforeach
|
||||
|
||||
</table>
|
||||
<p> </p>
|
||||
|
||||
@endforeach
|
||||
@endforeach
|
||||
</div>
|
||||
</section>
|
||||
|
|
|
|||
20
pfosten/resources/views/leagues/no_users.blade.php
Normal file
20
pfosten/resources/views/leagues/no_users.blade.php
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
@extends('layouts.layout')
|
||||
|
||||
@section('content')
|
||||
<section class="jumbotron text-center">
|
||||
<div class="container">
|
||||
<h1 class="jumbotron-heading"></h1>
|
||||
<p class="lead text-muted" style="color:red;">Es gibt noch keinen aktiven Spieler, der als bezahlt eingetragen ist.</p>
|
||||
<div><p></p><p></p><p></p></div>
|
||||
|
||||
<div>
|
||||
<a href="/" class="btn btn-primary">Ok</a>
|
||||
</div>
|
||||
<div><p></p><p></p><p></p></div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</section>
|
||||
|
||||
@endsection
|
||||
|
|
@ -5,12 +5,7 @@
|
|||
<div class="container">
|
||||
|
||||
<label>{{ $activeSeason->name }}</label>
|
||||
<!--
|
||||
if (sizeof($rounds)<$round_count)
|
||||
<div><a href="/rounds/create" class="btn btn-primary" >Runde hinzufügen</a></div>
|
||||
<p> </p>
|
||||
endif
|
||||
-->
|
||||
|
||||
</div>
|
||||
|
||||
<div class="container">
|
||||
|
|
|
|||
|
|
@ -77,6 +77,6 @@ Route::get('/home', 'UsersController@main')->name('home');
|
|||
Route::get('/league_settings/season={season_id}','Leagues\LeaguesController@index');
|
||||
Route::get('/league_settings/create_league/start_round_id={start_round_id}/round_count={round_count}','Leagues\LeaguesController@createLeagues');
|
||||
Route::get('/league_show_rounds','Leagues\LeaguesController@showLeagueRounds');
|
||||
Route::get('/league/show/rank={rank}/max_round_id={maxRoundId}','Leagues\LeaguesController@showLeagueRanking');
|
||||
Route::get('/league/show','Leagues\LeaguesController@showLeagueRanking');
|
||||
|
||||
Route::get('/league/showSingleUserMatches/user_id={userId}','Leagues\LeaguesController@showSingleUserMatches');
|
||||
Loading…
Add table
Add a link
Reference in a new issue