<?php define( 'SAISON', '{{ page.saison }}' ); define( 'SAISON_NOW', '{{ page.saison_now }}' ); include_once('functions/db_connect.php'); include_once('functions/db_methods.php'); $csv=$_POST['csv']; $secret=''; if( !empty($csv) ){ $secret=$_POST['secret']; $user=db_checkSecret($secret); if( $user ){ $C=preg_split('/ /',$csv); if( trim($C[0]) == 'runde,spieltag,T,H,A,TH,TA,MID' ){ foreach( $C as $i=>$v ){ if( $i > 0 ) db_addErgebnisse(SAISON.','.$v,$secret); } } else if( trim($C[0]) == 'MatchID,L,Pos,SpielerID,Spieler,Z+,Z-,T,A,Bk' ) { foreach( $C as $i=>$v ){ if( $i > 0 ) db_addStatistik($v,$secret); } } else if( trim($C[0]) == 'TeamID,N,SpielerID,Attr,Spieler,Alter,Pos,S,T,A,Z+,Z-,Zd,Mw' ){ foreach( $C as $i=>$v ){ if( $i > 0 ) db_addSpieler($v,$secret); } } } } ?> <!DOCTYPE html> <html> <head> <link rel="stylesheet" href="assets/css/all.min.css"> <link rel="stylesheet" href="assets/css/custom.css"> <script src="assets/js/jquery.min.js"></script> <script src="assets/js/script.js"></script> </head> <body> <script> var DATA={{ site.data | jsonify }}; var TEAMS=<?=json_encode( db_getFromTeams() )?>; var T2ID={}; TEAMS.forEach( function(v){ T2ID[v.nt] = v.id; } ); var STARTLISTE={{ page.startliste | jsonify }}; {% assign startliste_size = page.startliste[0] | size | append: '' %} var STARTLISTE_PARTIEN={{ site.data.partien | map: startliste_size | jsonify }}[0]; var STARTLISTE_PARTIEN_PAUSE={{ page.startliste_partien_pause | jsonify }}; if( $.isArray( STARTLISTE_PARTIEN_PAUSE ) ){ STARTLISTE_PARTIEN.forEach( function(v,i){ if( STARTLISTE_PARTIEN_PAUSE[i] != undefined ){ STARTLISTE_PARTIEN[i][0]=STARTLISTE_PARTIEN_PAUSE[i]; } } ); } var SPIELER=<?=json_encode( db_getFromSpieler() )?>; var ERGEBNISSE=<?=json_encode( db_getFromErgebnisse() )?>; var STAT=<?=json_encode( db_getFromStatistikBySaison(SAISON))?>; STATISTIK={}; STAT.forEach( function(v,i){ if( STATISTIK[v.SpielerID] == undefined ) STATISTIK[v.SpielerID]={ 'S' :0, 'T' : 0, 'A' : 0, 'Z' : 0, 'Zpos' : 0, 'Zneg' : 0, 'MID' : [] }; STATISTIK[v.SpielerID].S++; STATISTIK[v.SpielerID].T+=v.Tore*1; STATISTIK[v.SpielerID].A+=v.Assists*1; STATISTIK[v.SpielerID].Z+=v.Zwk*1; STATISTIK[v.SpielerID].Zpos+=v.Zpos*1; STATISTIK[v.SpielerID].Zneg+=v.Zneg*1; STATISTIK[v.SpielerID].MID.push(v.MID); STATISTIK[v.SpielerID].name=v.name; STATISTIK[v.SpielerID].age=v.age*1; STATISTIK[v.SpielerID].age_saison=v.age_saison*1; STATISTIK[v.SpielerID].nt=v.nt; } ); const STEP={{ page.step | default: '1' }}; const FINALS_STEP={{ page.finals_step | default: '0' }}; const LIGASPIELTAG={{ page.ligaspieltag | default: '1' }}; // check ob alle Teams der Startliste in DB vorhanden sind var check= STARTLISTE.map( (a) => ( a.map( (b) => ( T2ID[b] != undefined ) ) ) ).reduce(( c,d ) => ( c && d )).reduce(( e,f ) => ( e && f )); if( check ){ $(document).ready( function(){ calculatePartien('{{ page.saison }}', '{{ page.date }}'); calculateTabelle('{{ page.saison }}', '7'); calculateTabelle( 0, '7'); calculateTore('{{ page.saison }}'); calculateAssists('{{ page.saison }}'); calculateZwk('{{ page.saison }}'); $('h2.tabelle button').on('click', function(){ $('h2.tabelle button').toggleClass('active',false); $(this).toggleClass('active',true); $('table.tabelle').toggleClass('d-none',true); $('#tabelle_'+$(this).text().toLowerCase()).toggleClass('d-none',false); } ); } ); } else { alert( 'Error: Nicht alle Teams der Startliste sind in der DB vorhanden!'); } </script> <form method="POST"> <div id="copypaste" class="d-none" ondblclick="$(this).toggleClass('d-none')"> <button type="submit">update</button> <input type="text" name="secret" placeholder="secret" value="<?=$secret?>"> <textarea name="csv"></textarea> </div> </form> <div class="div_right"> <h2 class="tabelle">Tabelle <button>Ewige</button><button>Zweikampf</button><button>Assists</button><button>Tore</button><button class="active">Punktestand</button></h2> <table id="tabelle_punktestand" class="tabelle"> <thead> <tr> <th>Pl.</th> <th>Sp.</th> <th>Team</th> <th>S/U/N</th> <th>Hist.</th> <th>Tore</th> <th>Dif</th> <th>Pkt.</th> </tr> </thead> <tbody> </tbody> </table> <table id="tabelle_tore" class="tabelle d-none"> <thead> <tr> <th>Pl.</th> <th>Sp.</th> <th>Name</th> <th>Team</th> <th>T</th> </tr> </thead> <tbody> </tbody> </table> <table id="tabelle_assists" class="tabelle d-none"> <thead> <tr> <th>Pl.</th> <th>Sp.</th> <th>Name</th> <th>Team</th> <th>A</th> </tr> </thead> <tbody> </tbody> </table> <table id="tabelle_zweikampf" class="tabelle d-none"> <thead> <tr> <th>Pl.</th> <th>Sp.</th> <th>Name</th> <th>Team</th> <th>A</th> </tr> </thead> <tbody> </tbody> </table> <table id="tabelle_ewige" class="tabelle d-none"> <thead> <tr> <th>Pl.</th> <th>Sp.</th> <th>Team</th> <th>S/U/N</th> <th>Hist.</th> <th>Tore</th> <th>Dif</th> <th>Pkt.</th> </tr> </thead> <tbody> </tbody> </table> <table id="tabelle_team" class="tabelle d-none" ondblclick="backToActiveTable()"> <thead> <tr> <th>Spieler</th> <th>Alter</th> <th>S/T/A</th> <th>Zwk</th> </tr> </thead> <tbody> </tbody> </table> </div> <div id="partien" class="div_left"> </div> </body> </html>