Newer
Older
<?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]) == 'Saison,Spieltag,MatchID,teamID,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' ){
$w=preg_split('/,/',$v);
if( !empty($TEAMS[$w[0]]) ){
if( $TEAMS[$w[0]] == $w[1] ){
db_addSpieler($v,$secret);
}
}
}
}
}
}
?>
<!DOCTYPE html>
<html>
<head>
<script src="assets/js/jquery.min.js"></script>
<script src="assets/js/script.js"></script>
</head>
<body>
<script>
var DATA={{ site.data | jsonify }};
var SAISON='{{ page.saison }}';
var SAISON_NOW='{{ page.saison_now }}';
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');
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
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">
<div id="saisons">
<a href="./26.php"><button class="{% if page.saison == 26 %}active{% endif %}"><b>1</b><sup>26</sup></button></a>
<a href="./27.php"><button class="{% if page.saison == 27 %}active{% endif %}"><b>2</b><sup>27</sup></button></a>
<a href="./28.php"><button class="{% if page.saison == 28 %}active{% endif %}"><b>3</b><sup>28</sup></button></a>
<a href="./29.php"><button class="{% if page.saison == 29 %}active{% endif %}"><b>4</b><sup>29</sup></button></a>
<a href="./30.php"><button class="{% if page.saison == 30 %}active{% endif %}"><b>5</b><sup>30</sup></button></a>
</div>
<h2 class="tabelle">Tabelle <button>Ewige</button><button>Zweikampf</button><button>Assists</button><button>Tore</button><button class="active">Punktestand</button></h2>
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
<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>
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
<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 id="partien" class="div_left">
</div>