League Settings View
This commit is contained in:
parent
7bfba61602
commit
96101cb05d
6 changed files with 146 additions and 15 deletions
53
pfosten/app/Http/Controllers/Leagues/LeagueController.php
Normal file
53
pfosten/app/Http/Controllers/Leagues/LeagueController.php
Normal file
|
|
@ -0,0 +1,53 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers\Leagues;
|
||||||
|
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use App\Http\Controllers\Leagues;
|
||||||
|
|
||||||
|
use Auth;
|
||||||
|
use App\Season;
|
||||||
|
use App\Round;
|
||||||
|
use App\leagues\League;
|
||||||
|
|
||||||
|
class LeagueController extends Controller
|
||||||
|
{
|
||||||
|
public function index($season_id) {
|
||||||
|
|
||||||
|
if (Auth::guest()) { return redirect("/"); }
|
||||||
|
if (!Auth::user()->admin) { return redirect("/"); }
|
||||||
|
|
||||||
|
$season = Season::where('id','=',$season_id)->first();
|
||||||
|
$rounds = Round::where('season_id','=',$season_id)->orderBy('id')->get();
|
||||||
|
|
||||||
|
$league = League::where('season_id','=',$season_id)->first();
|
||||||
|
|
||||||
|
$start_round_name="Einstellen";
|
||||||
|
$start_round_id=-1;
|
||||||
|
if ($league) {
|
||||||
|
if ($league->start_round_id) {
|
||||||
|
$startRound = Round::where('id','=',$league->start_round_id)->first();
|
||||||
|
$start_round_name = $startRound->name;
|
||||||
|
$start_round_id = $startRound->id;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$startRound=array();
|
||||||
|
$startRound['id'] = $start_round_id;
|
||||||
|
$startRound['name'] = $start_round_name;
|
||||||
|
|
||||||
|
// Fetch existing leagues
|
||||||
|
|
||||||
|
// No leagues: Create Qualification League or Standard League System (including matches)
|
||||||
|
// necessary input: start_round(_id), round_count
|
||||||
|
|
||||||
|
// Delete all leagues & matches
|
||||||
|
|
||||||
|
//
|
||||||
|
|
||||||
|
|
||||||
|
return view('leagues.index', compact('season','rounds','startRound'));
|
||||||
|
}
|
||||||
|
}
|
||||||
17
pfosten/app/Http/Controllers/Leagues/MatchController.php
Normal file
17
pfosten/app/Http/Controllers/Leagues/MatchController.php
Normal file
|
|
@ -0,0 +1,17 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers\Leagues;
|
||||||
|
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use App\Http\Controllers\Leagues;
|
||||||
|
|
||||||
|
use Auth;
|
||||||
|
use App\Season;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class MatchController extends Controller
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
14
pfosten/app/leagues/League.php
Normal file
14
pfosten/app/leagues/League.php
Normal file
|
|
@ -0,0 +1,14 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\leagues;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class League extends Model
|
||||||
|
{
|
||||||
|
protected $table ='leagues';
|
||||||
|
protected $fillable = [
|
||||||
|
'id','season_id','rank','subrank','start_round_id','name'
|
||||||
|
];
|
||||||
|
//
|
||||||
|
}
|
||||||
14
pfosten/app/leagues/Match.php
Normal file
14
pfosten/app/leagues/Match.php
Normal file
|
|
@ -0,0 +1,14 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\leagues;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class Match extends Model
|
||||||
|
{
|
||||||
|
protected $table ='leagues_matches';
|
||||||
|
protected $fillable = [
|
||||||
|
'id','league_id','user1_id','user2_idsubrank','start_round_id','name'
|
||||||
|
];
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
@extends('layouts.layout')
|
@extends('layouts.layout')
|
||||||
|
|
||||||
@section('content')
|
@section('content')
|
||||||
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
|
|
||||||
|
|
||||||
<section class="jumbotron text-center">
|
<section class="jumbotron text-center">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
|
|
@ -11,28 +10,28 @@
|
||||||
<p> </p>
|
<p> </p>
|
||||||
|
|
||||||
<h3>Startrunde:</h3>
|
<h3>Startrunde:</h3>
|
||||||
<form>
|
<div>
|
||||||
|
|
||||||
<div class="dropdown">
|
<div class="dropdown" id="dropdown1">
|
||||||
<button onclick="toggleDropdown('dropdown_startround'); return false;" class="dropbtn">{{$startRound['name']}}</button>
|
<button id="btn_startround" onclick="toggleDropdown('dropdown_startround'); return false;" class="dropbtn">{{$startRound['name']}}</button>
|
||||||
<div id="dropdown_startround" class="dropdown-content">
|
<div id="dropdown_startround" class="dropdown-content">
|
||||||
@foreach($rounds as $round)
|
@foreach($rounds as $round)
|
||||||
<a onclick="false;" href="/league_settings/set_start_round/roundid_{{ $round->id }}">{{ $round->name }}</a>
|
<a onclick="setStartRound('{{$round->name}}',{{$round->id}});return false;" >{{ $round->name }}</a>
|
||||||
@endforeach
|
@endforeach
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<h3>Anzahl Runden:</h3>
|
<h3>Anzahl Runden:</h3>
|
||||||
<input></input>
|
<input id="input_round_count"></input>
|
||||||
|
|
||||||
<h3>Liga-Modus</h3>
|
<h3>Liga-Modus</h3>
|
||||||
|
|
||||||
<div class="dropdown">
|
<div class="dropdown">
|
||||||
<button onclick="toggleDropdown('dropdown_leaguemode'); return false;" class="dropbtn">Modus einstellen</button>
|
<button id="btn_leaguemode" onclick="toggleDropdown('dropdown_leaguemode'); return false;" class="dropbtn">Modus einstellen</button>
|
||||||
<div id="dropdown_leaguemode" class="dropdown-content">
|
<div id="dropdown_leaguemode" class="dropdown-content">
|
||||||
<a onclick="false;" href="">Qualifikation</a>
|
<a onclick="selectLeagueMode('Qualifikation'); return false;" href="">Qualifikation</a>
|
||||||
<a onclick="false;" href="">Liga-Spiel</a>
|
<a onclick="selectLeagueMode('Liga-Spiel'); return false;" href="">Liga-Spiel</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
@ -41,10 +40,10 @@
|
||||||
|
|
||||||
|
|
||||||
<div >
|
<div >
|
||||||
<button class="btn btn-primary">Liga neu erzeugen</button>
|
<button onclick="createLeague(); return false;" class="btn btn-primary">Liga neu erzeugen</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</form>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -57,10 +56,32 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
|
function createLeague() {
|
||||||
|
console.log("create League");
|
||||||
|
//alert($global_selected_round_id);
|
||||||
|
|
||||||
|
var round_count=document.getElementById("input_round_count").value;
|
||||||
|
var lonk = '/league_settings/create_league?start_round_id='+global_start_round_id+"&round_count="+round_count+"&mode="+global_league_mode;
|
||||||
|
//window.location=link;
|
||||||
|
alert(lonk);
|
||||||
|
console.log(lonk);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function selectLeagueMode($modename) {
|
||||||
|
document.getElementById("btn_leaguemode").innerHTML=$modename;
|
||||||
|
global_league_mode=$modename;
|
||||||
|
}
|
||||||
|
|
||||||
|
function setStartRound($roundname, $round_id) {
|
||||||
|
document.getElementById("btn_startround").innerHTML=$roundname;
|
||||||
|
//alert($round_id);
|
||||||
|
global_start_round_id = $round_id;
|
||||||
|
console.log("Setting global_statr_round_id="+$round_id)
|
||||||
|
}
|
||||||
|
|
||||||
// When the user clicks on the button,toggle between hiding and showing the dropdown content
|
// When the user clicks on the button,toggle between hiding and showing the dropdown content
|
||||||
function toggleDropdown($elementName) {
|
function toggleDropdown($elementName) {
|
||||||
document.getElementById($elementName).classList.toggle("show");
|
document.getElementById($elementName).classList.toggle("show");
|
||||||
|
|
@ -80,7 +101,6 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
event.cancelBubble=true;
|
event.cancelBubble=true;
|
||||||
event.cancel();
|
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
||||||
13
pfosten/search.py
Executable file
13
pfosten/search.py
Executable file
|
|
@ -0,0 +1,13 @@
|
||||||
|
#!/usr/bin/python
|
||||||
|
import sys
|
||||||
|
import os
|
||||||
|
|
||||||
|
|
||||||
|
if len(sys.argv)<2:
|
||||||
|
print "\nUsage: ./search.py <pattern>\n"
|
||||||
|
sys.exit()
|
||||||
|
sys.exit()
|
||||||
|
|
||||||
|
param =sys.argv[1]
|
||||||
|
|
||||||
|
os.system("""grep #PATTERN -R *|grep -v vendor|grep -v node_modules|grep -v database|grep -v ".sql"|grep -v "yarn.lock"|grep -v "composer.lock"|grep -v ".log"|grep -v ".min.js"|grep -v "public/js/app.js"|grep -v "public/bower"|grep -v "package-lock.json"|grep -v "storage/framework/views"|grep -v "resources/assets/sass/"|grep -v "Binary file" """.replace('#PATTERN',param))
|
||||||
Loading…
Add table
Add a link
Reference in a new issue