diff options
author | emkael <emkael@tlen.pl> | 2019-01-18 01:11:54 +0100 |
---|---|---|
committer | emkael <emkael@tlen.pl> | 2019-01-18 01:11:54 +0100 |
commit | ee552d007c4aa684e751dcac850cf7388b891145 (patch) | |
tree | d6f1e6a0c2932f0815878a9ab1ae283e8548014e |
Original code from pzbs.pl
-rw-r--r-- | .htaccess | 2 | ||||
-rw-r--r-- | .pkle2018-test-w-nawiasie.php | 601 | ||||
-rw-r--r-- | .pkle2018-test.php | 601 | ||||
-rw-r--r-- | images/bkg.JPG | bin | 0 -> 885 bytes | |||
-rw-r--r-- | images/favicon.ico | bin | 0 -> 3638 bytes | |||
-rw-r--r-- | images/logo_pzbs.gif | bin | 0 -> 1693 bytes | |||
-rw-r--r-- | images/pkle.png | bin | 0 -> 1744 bytes | |||
-rw-r--r-- | index.php | 4 | ||||
-rw-r--r-- | pkle.php | 3 | ||||
-rw-r--r-- | pkle2009.php | 582 | ||||
-rw-r--r-- | pkle2014.php | 584 | ||||
-rw-r--r-- | pkle2018-test.php | 630 | ||||
-rw-r--r-- | pkle2018.php | 588 | ||||
-rw-r--r-- | regKLas.gif | bin | 0 -> 4702 bytes | |||
-rw-r--r-- | style.css | 13 |
15 files changed, 3608 insertions, 0 deletions
diff --git a/.htaccess b/.htaccess new file mode 100644 index 0000000..3f9ced3 --- /dev/null +++ b/.htaccess @@ -0,0 +1,2 @@ +RewriteEngine On +RewriteRule ^pkle.php5(.*) pkle.php [R=301,L] diff --git a/.pkle2018-test-w-nawiasie.php b/.pkle2018-test-w-nawiasie.php new file mode 100644 index 0000000..556d782 --- /dev/null +++ b/.pkle2018-test-w-nawiasie.php @@ -0,0 +1,601 @@ +<?php +$tabpkl = array(); +$typ = 0; +$rng = 0; +$xrng = 0; +$iuc = 0; +$izw = 0; +$swk = 0; +$tab = 0; +$minpkl = 0; +$mnoznikRZD = 1; +$rzd = 30; + +$min1 = 200; +$min2 = 150; +$min3 = 75; +$min4 = 50; +$min5 = 0; +$min6 = 0; +$min7 = 0; +$min8 = 0; + +$min1_ = 300; +$min2_ = 200; +$min3_ = 100; +$min4_ = 70; +$min5_ = 0; +$min6_ = 0; +$min7_ = 0; +$min8_ = 0; + +// regulamin +$progu0 = 0; +$progp0 = 100; + +$progu1 = 2; // dla pierwszych progu1% uczestników +$progp1 = 90; // ostatni dostaje progp1% maximum punktów + +$progu2 = 20; // dla kolejnych (progu2-progu1)% uczestników +$progp2 = 20; // ostatni dostaje 10*progp2% maximum punktów + +$progu3 = 50; // dla kolejnych (progu3-progu2)% uczestników +$progp3 = 0; // ostatni dostaje 10*progp3% maximum punktów + + +$rgg = 25; // OTP**** +$rgp = 15; // OTP*** +$rot = 10; // OTP** +$rok1 = 7; // OTP* +$rok = 5; // OTP +$rtp = 4; // RTP +$rto = 2; // okregowy +$rtk = 1; // klubowy + +$rgg_ = 40; // OTP**** +$rgp_ = 25; // OTP*** +$rot_ = 15; // OTP** +$rok1_ = 10; // OTP* +$rok_ = 7; // OTP +$rtp_ = 5; // RTP +$rto_ = 3; // okregowy +$rtk_ = 2; // klubowy + +$zaw = 0.05; +$dajp = 0; + +/*if( $_SERVER['REQUEST_METHOD'] == 'GET' ){ +// ?typtur=[1,2,4]&uczest=IU&sumawk=SWK&ranga=[1..9] +// I P T GP..KLUB + $l = 0; + $rozdan = $_GET['rozdan']; + if( isset($_GET['typtur']) ){ + $typ = $_GET['typtur']; + $l = 1; + } + if( isset($_GET['uczest']) ){ + $iuc = $_GET['uczest']; + $l = $l + 1; + } + if( isset($_GET['sumawk']) ){ + $swk = $_GET['sumawk']; + $l = $l + 1; + } + if( isset($_GET['ranga']) ){ + $rng = $_GET['ranga']; + switch( $rng ){ + case 1: + $rng = $rgg; + $xrng = $xrgg; + $minpkl = $min1; + break; + case 2: + $rng = $rgp; + $xrng = $xrgp; + $minpkl = $min2; + break; + case 3: + $rng = $rot; + $xrng = $xrot; + $minpkl = $min3; + break; + case 4: + $rng = $rok; + $xrng = $xrok; + $minpkl = $min4; + break; + case 5: + $rng = $r40; + $xrng = $xr40; + $minpkl = $min5; + break; + case 6: + $rng = $rtp; + $xrng = $xrtp; + $minpkl = $min6; + break; + case 7: + $rng = $rtd; + $xrng = $xrtd; + $minpkl = $mind; + break; + case 8: + $rng = $rtr; + $xrng = $xrtr; + $minpkl = $min7; + break; + case 9: + $rng = $rto; + $xrng = $xrto; + $minpkl = $min8; + break; + case 10: + $rng = $rtk; + $xrng = $xrtk; + $minpkl = $min9; + break; + } + if( $rng ) $l = $l + 1; + } + if( $typ>2 ) $typ = 4; + $izw = $typ*$iuc; + if( $izw > 99 ){ + $dajp = 1; + } + if( $l > 3 ) $tab = 1; +} +else*/if( $_SERVER['REQUEST_METHOD'] == 'POST' ){ + $rozdan = $_POST['rozdan']; + + $progu1 = $_POST['pru1']; // dla pierwszych progu1% uczestników + $progp1 = $_POST['prp1']; // ostatni dostaje progp1% maximum punktów + $progu2 = $_POST['pru2']; // dla kolejnych (progu2-progu1)% uczestników + $progp2 = $_POST['prp2']; // ostatni dostaje 10*progp2% maximum punktów + $progu3 = $_POST['pru3']; // dla kolejnych (progu3-progu2)% uczestników + $rgg = $_POST['rgg']; + $rgp = $_POST['rgp']; + $rot = $_POST['rot']; + $rok1 = $_POST['rok1']; + $rok = $_POST['rok']; + $rtp = $_POST['rtp']; + $rto = $_POST['rto']; + $rtk = $_POST['rtk']; + $rgg_ = $_POST['rgg_']; + $rgp_ = $_POST['rgp_']; + $rot_ = $_POST['rot_']; + $rok1_ = $_POST['rok1_']; + $rok_ = $_POST['rok_']; + $rtp_ = $_POST['rtp_']; + $rto_ = $_POST['rto_']; + $rtk_ = $_POST['rtk_']; + + $typ = $_POST['typ']; + $rng = $_POST['rng']; + $zaw = $_POST['zaw']; + $mnoznikRZD = $_POST['mnoznikRZD']; + $rzd = $_POST['rzd']; + $min1 = $_POST['min1']; + $min2 = $_POST['min2']; + $min3 = $_POST['min3']; + $min4 = $_POST['min4']; + $min5 = $_POST['min5']; + $min6 = $_POST['min6']; + $min7 = $_POST['min7']; + $min8 = $_POST['min8']; + $min1_ = $_POST['min1_']; + $min2_ = $_POST['min2_']; + $min3_ = $_POST['min3_']; + $min4_ = $_POST['min4_']; + $min5_ = $_POST['min5_']; + $min6_ = $_POST['min6_']; + $min7_ = $_POST['min7_']; + $min8_ = $_POST['min8_']; + if(!$rozdan): + switch( $rng ){ + case 1: + $rng = $rgg; + $minpkl = $min1; + break; + case 2: + $rng = $rgp; + $minpkl = $min2; + break; + case 3: + $rng = $rot; + $minpkl = $min3; + break; + case 4: + $rng = $rok1; + $minpkl = $min4; + break; + case 5: + $rng = $rok; + $minpkl = $min5; + break; + case 6: + $rng = $rtp; + $minpkl = $min6; + break; + case 7: + $rng = $rto; + $minpkl = $min7; + break; + case 8: + $rng = $rtk; + $minpkl = $min8; + break; + } + else: + switch( $rng ){ + case 1: + $rng = $rgg_; + $minpkl = $min1_; + break; + case 2: + $rng = $rgp_; + $minpkl = $min2_; + break; + case 3: + $rng = $rot_; + $minpkl = $min3_; + break; + case 4: + $rng = $rok1_; + $minpkl = $min4_; + break; + case 5: + $rng = $rok_; + $minpkl = $min5_; + break; + case 6: + $rng = $rtp_; + $minpkl = $min6_; + break; + case 7: + $rng = $rto_; + $minpkl = $min7_; + break; + case 8: + $rng = $rtk_; + $minpkl = $min8_; + break; + } + endif; + $iuc = $_POST['iuc']; + if( $typ>2 ) $typ = 4; + $izw = $typ*$iuc; + if( $izw > 99 ){ + $dajp = 1; + } + $swk = $_POST['swk']; + $tab = 1; +} +?> +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> +<html> +<head> +<meta http-equiv="pragma" content="no-cache"> +<meta http-equiv="cache-control" content="no-cache"> +<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> +<title>Kargulator PKLi</title> +<link rel="stylesheet" href="style.css" type="text/css"> +<link rel="icon" href="images/favicon.ico" type="image/x-icon"> +<link rel="shortcut icon" href="images/favicon.ico" type="image/x-icon"> +<script type="text/javascript"> +<!-- +function valiuc(x,y){ + if( !(x.value==null || x.value=='') ){ + x.value = x.value.replace(',','.'); + if( isFinite(x.value)){ + if( y==1 ){ + if( document.getElementsByName("typ")[0].checked ){ + document.getElementById("izw").value = x.value; + } else { + if( document.getElementsByName("typ")[1].checked ){ + document.getElementById("izw").value = 2 * x.value; + } else { + if( document.getElementsByName("typ")[2].checked ){ + document.getElementById("izw").value = 4 * x.value; + } + } + } + } + if( y==3 ){ + var z = document.getElementById('izw'); + if( valiuc(z,2) ){ + var srednieWk = x.value/z.value; + if(srednieWk < 0.15) srednieWk = 0.15; + document.getElementById('srd').value = srednieWk; + } + } + if( y==4 ){ + var m = document.getElementById('rzd'); + if( valiuc(m,2) ){ + var mnoznikRZD = x.value/30; + if(mnoznikRZD < 1) mnoznikRZD = 1; + document.getElementById('mnoznikRZD').value = mnoznikRZD; + } + } + return true; + } else { + alert(x.value+' to nie liczba!'); + x.select(); + x.focus(); + return false; + } + } +} + +function typtur(x){ + var t = document.getElementById("iuc"); + var z = document.getElementById("izw"); + if( t.value!=null && t.value!='' && isFinite(t.value) ){ + z.value = x * t.value; + } +} + +function submitit(){ + if( document.getElementsByName("typ")[0].checked || + document.getElementsByName("typ")[1].checked || + document.getElementsByName("typ")[2].checked ){ + if( document.getElementsByName("rng")[0].checked || + document.getElementsByName("rng")[1].checked || + document.getElementsByName("rng")[2].checked || + document.getElementsByName("rng")[3].checked || + document.getElementsByName("rng")[4].checked || + document.getElementsByName("rng")[5].checked || + document.getElementsByName("rng")[6].checked || + document.getElementsByName("rng")[7].checked || + document.getElementsByName("rng")[8].checked || + document.getElementsByName("rng")[9].checked ){ + var t = document.getElementById("iuc") + if( t.value!=null && t.value!='' && isFinite(t.value) ){ + t = document.getElementById("izw"); + if( t.value!=null && t.value!='' && isFinite(t.value) ){ + t = document.getElementById("swk"); + if( t.value!=null && t.value!='' && isFinite(t.value) ){ + + document.getElementById("pkl").submit(); + + } else { + alert('Brak sumy WK!'); + t.select(); + } + } else { + alert('Brak liczby zawodników!'); + t.select(); + } + } else { + alert('Brak liczby uczestników!'); + t.select(); + } + } else { + alert('Wybierz rangę turnieju'); + document.getElementsByName("rng")[0].select(); + } + } else { + alert('Wybierz typ turnieju'); + document.getElementsByName("typ")[0].select(); + } +} +--> +</script> +</head> +<body> +<form id="pkl" method="post" action="pkle2018-test.php"> +<table border="0" cellspacing="0" cellpadding="0"> + <tr> + <td><img src="images/logo_pzbs.gif"></td> + <td colspan="3" align="center"><h3>KALKULATOR PKLI W TURNIEJACH PZBS<br> + zgodny z <span style="color:#d00">nowa propozycja - mnożnik rozdaniowy tylko na śr.WKxWAGA</span></h3> + Przejdź do <a href="pkle2018-test.php"><b>wersji z mnoznikiem nakładanym na całość</b></a>! + <br><br> + <td><img src="images/logo_pzbs.gif"></td> + </tr> + <tr><td colspan="5"> </td></tr> + <tr> + <td align="center" colspan="2"><b>turniej do 39 rozdań</b></td> + <td align="center" colspan="2"><b>turniej od 40 rozdań</b></td> + </tr> + <tr> + <td align="right">WAGA<br>turnieju</td><td align="left">MINIMUM<br>za 1sze miejsce</td> + <td align="right">WAGA<br>turnieju</td><td align="left">MINIMUM<br>za 1sze miejsce</td> + <td align="left" colspan="3">WSP:</td> + </tr> + <tr> + <td align="right" rowspan="3"> + OTP<sup>∗∗∗∗</sup>: <input type="text" id="rgg" name="rgg" maxlength="3" style="width:30px" value=<?php echo '"'.$rgg.'"'; ?>><br /> + OTP<sup>∗∗∗</sup>: <input type="text" id="rgp" name="rgp" maxlength="3" style="width:30px" value=<?php echo '"'.$rgp.'"'; ?>><br /> + OTP<sup>∗∗</sup>: <input type="text" id="rot" name="rot" maxlength="3" style="width:30px" value=<?php echo '"'.$rot.'"'; ?>><br /> + OTP<sup>∗</sup>: <input type="text" id="rok1" name="rok1" maxlength="3" style="width:30px" value=<?php echo '"'.$rok1.'"'; ?>><br /> + OTP: <input type="text" id="rok" name="rok" maxlength="3" style="width:30px" value=<?php echo '"'.$rok.'"'; ?>><br /> + Regionalny: <input type="text" id="rtp" name="rtp" maxlength="3" style="width:30px" value=<?php echo '"'.$rtp.'"'; ?>><br /> + Okręgowy: <input type="text" id="rto" name="rto" maxlength="3" style="width:30px" value=<?php echo '"'.$rto.'"'; ?>><br /> + Klubowy: <input type="text" id="rtk" name="rtk" maxlength="3" style="width:30px" value=<?php echo '"'.$rtk.'"'; ?>></td> + <td align="left" rowspan="3"> + <input type="text" id="min1" name="min1" maxlength="3" style="width:30px" value=<?php echo '"'.$min1.'"'; ?>><br /> + <input type="text" id="min2" name="min2" maxlength="3" style="width:30px" value=<?php echo '"'.$min2.'"'; ?>><br /> + <input type="text" id="min3" name="min3" maxlength="3" style="width:30px" value=<?php echo '"'.$min3.'"'; ?>><br /> + <input type="text" id="min4" name="min4" maxlength="3" style="width:30px" value=<?php echo '"'.$min4.'"'; ?>><br /> + <input type="text" id="min5" name="min5" maxlength="3" style="width:30px" value=<?php echo '"'.$min5.'"'; ?>><br /> + <input type="text" id="min6" name="min6" maxlength="3" style="width:30px" value=<?php echo '"'.$min6.'"'; ?>><br /> + <input type="text" id="min7" name="min7" maxlength="3" style="width:30px" value=<?php echo '"'.$min7.'"'; ?>><br /> + <input type="text" id="min8" name="min8" maxlength="3" style="width:30px" value=<?php echo '"'.$min8.'"'; ?>></td> + <td align="right" rowspan="3"> + OTP<sup>∗∗∗∗</sup>: <input type="text" id="rgg_" name="rgg_" maxlength="3" style="width:30px" value=<?php echo '"'.$rgg_.'"'; ?>><br /> + OTP<sup>∗∗∗</sup>: <input type="text" id="rgp_" name="rgp_" maxlength="3" style="width:30px" value=<?php echo '"'.$rgp_.'"'; ?>><br /> + OTP<sup>∗∗</sup>: <input type="text" id="rot_" name="rot_" maxlength="3" style="width:30px" value=<?php echo '"'.$rot_.'"'; ?>><br /> + OTP<sup>∗</sup>: <input type="text" id="rok1_" name="rok1_" maxlength="3" style="width:30px" value=<?php echo '"'.$rok1_.'"'; ?>><br /> + OTP: <input type="text" id="rok_" name="rok_" maxlength="3" style="width:30px" value=<?php echo '"'.$rok_.'"'; ?>><br /> + Regionalny: <input type="text" id="rtp_" name="rtp_" maxlength="3" style="width:30px" value=<?php echo '"'.$rtp_.'"'; ?>><br /> + Okręgowy: <input type="text" id="rto_" name="rto_" maxlength="3" style="width:30px" value=<?php echo '"'.$rto_.'"'; ?>><br /> + Klubowy: <input type="text" id="rtk_" name="rtk_" maxlength="3" style="width:30px" value=<?php echo '"'.$rtk_.'"'; ?>></td> + <td align="left" rowspan="3"> + <input type="text" id="min1_" name="min1_" maxlength="3" style="width:30px" value=<?php echo '"'.$min1_.'"'; ?>><br /> + <input type="text" id="min2_" name="min2_" maxlength="3" style="width:30px" value=<?php echo '"'.$min2_.'"'; ?>><br /> + <input type="text" id="min3_" name="min3_" maxlength="3" style="width:30px" value=<?php echo '"'.$min3_.'"'; ?>><br /> + <input type="text" id="min4_" name="min4_" maxlength="3" style="width:30px" value=<?php echo '"'.$min4_.'"'; ?>><br /> + <input type="text" id="min5_" name="min5_" maxlength="3" style="width:30px" value=<?php echo '"'.$min5_.'"'; ?>><br /> + <input type="text" id="min6_" name="min6_" maxlength="3" style="width:30px" value=<?php echo '"'.$min6_.'"'; ?>><br /> + <input type="text" id="min7_" name="min7_" maxlength="3" style="width:30px" value=<?php echo '"'.$min7_.'"'; ?>><br /> + <input type="text" id="min8_" name="min8_" maxlength="3" style="width:30px" value=<?php echo '"'.$min8_.'"'; ?>></td> + <td align="left" valign="top"><input type="text" id="zaw" name="zaw" maxlength="5" style="width:30px" value=<?php echo '"'.$zaw.'"'; ?>></td> + + <td valign="top" colspan="2">PKL za 1 m = <b>śr.WK×WAGA + il.zaw×WSP</b></td> + </tr> + <tr> + <td align="right" valign="top"><br /><br /><br /><br /><input type="text" id="prp1" name="prp1" style="width:18px" value=<?php echo '"'.$progp1.'"'; ?>>%<br /><input type="text" id="prp2" name="prp2" style="width:18px" value=<?php echo '"'.$progp2.'"'; ?>>%</td> + <td colspan="2" align="left"><img src="images/pkle.png"></td> + </tr> + <tr> + <td> </td> + <td colspan="2"><table cellspacing="0" cellpadding="0"><tr><td align="right" style="width:50px"><input type="text" id="pru1" name="pru1" style="width:18px" value=<?php echo '"'.$progu1.'"'; ?>>%</td><td align="right" style="width:25px"><input type="text" id="pru2" name="pru2" style="width:18px" value=<?php echo '"'.$progu2.'"'; ?>>%</td><td align="right" style="width:55px"><input type="text" id="pru3" name="pru3" style="width:18px" value=<?php echo '"'.$progu3.'"'; ?>>%</td></tr></table></td> + </tr> + + <tr><td colspan="5"> </td></tr> + <tr> + <td valign=top rowspan="2">TYP ZAWODÓW<br /> + <input type="radio" name="typ" id="tp1" value="1" onclick="typtur(1)"<?php if( $typ==1 ){ echo ' checked="checked"';}?>><label for="tp1"> Indywiduel</label><br /> + <input type="radio" name="typ" id="tp2" value="2" onclick="typtur(2)"<?php if( $typ==2 ){ echo ' checked="checked"';}?>><label for="tp2"> Pary</label><br /> + <input type="radio" name="typ" id="tp3" value="4" onclick="typtur(4)"<?php if( $typ==4 ){ echo ' checked="checked"';}?>><label for="tp3"> Teamy</label> + <br><br>LICZBA ROZDAŃ<br> + <input type="radio" name="rozdan" id="rozdan0" value="0"<?php if( !$rozdan ){ echo ' checked="checked"';}?>><label for="rozdan0"> do 39</label><br /> + <input type="radio" name="rozdan" id="rozdan1" value="1"<?php if( $rozdan ){ echo ' checked="checked"';}?>><label for="rozdan1"> od 40</label> + </td> + <td valign=top rowspan="2">RANGA ZAWODÓW<br /> + <input type="radio" name="rng" id="rg1" value="1"<?php if( $_POST['rng']==1 ){echo ' checked="checked"';}?>><label for="rg1"> OTP<sup>∗∗∗∗</sup></label><br /> + <input type="radio" name="rng" id="rg2" value="2"<?php if( $_POST['rng']==2 ){echo ' checked="checked"';}?>><label for="rg2"> OTP<sup>∗∗∗</sup></label><br /> + <input type="radio" name="rng" id="rg3" value="3"<?php if( $_POST['rng']==3 ){echo ' checked="checked"';}?>><label for="rg3"> OTP<sup>∗∗</sup></label><br /> + <input type="radio" name="rng" id="rg4" value="4"<?php if( $_POST['rng']==4 ){echo ' checked="checked"';}?>><label for="rg4"> OTP<sup>∗</sup></label><br /> + <input type="radio" name="rng" id="rg5" value="5"<?php if( $_POST['rng']==5 ){echo ' checked="checked"';}?>><label for="rg5"> OTP</label><br /> + <input type="radio" name="rng" id="rg6" value="6"<?php if( $_POST['rng']==6 ){echo ' checked="checked"';}?>><label for="rg6"> Regionalny</label><br /> + <input type="radio" name="rng" id="rg7" value="7"<?php if( $_POST['rng']==7 ){echo ' checked="checked"';}?>><label for="rg7"> Okręgowy</label><br /> + <input type="radio" name="rng" id="rg8" value="8"<?php if( $_POST['rng']==8 ){echo ' checked="checked"';}?>><label for="rg8"> Klubowy</label></td> + <td align="CENTER" valign=top>UCZESTNIKÓW<br /> + <input type="text" id="iuc" name="iuc" maxlength="3" style="width:50px" onblur="valiuc(this,1)"<?php if( $iuc>0 ){echo ' value="'.$iuc.'"';}?>><br /> + <small>W zależności od typu<br />ilość indywidualistów,<br />par lub teamów</small></td> + <td align="CENTER" valign=top>ZAWODNIKÓW<br /> + <input type="text" id="izw" name="izw" readonly="readonly" maxlength="4" style="width:50px" onblur="valiuc(this,2)"<?php if( $izw>0 ){echo ' value="'.$izw.'"';}?>><br /> + <small>To pole jest wyliczane<br />automatycznie.</small></td> + <td align="CENTER" valign=top>SUMA WK<br /> + <input type="text" id="swk" name="swk" maxlength="7" style="width:70px" onblur="valiuc(this,3)"<?php if( $swk>0 ){echo ' value="'.$swk.'"';}?>><br /> + <small>Suma WK wszystkich<br />zawodników.</small></td> + <td align="CENTER" valign=top>Liczba rozdań<br /> + <input type="text" id="rzd" name="rzd" maxlength="7" style="width:70px" onblur="valiuc(this,4)"<?php if( $rzd>0 ){echo ' value="'.$rzd.'"';}?>><br /> + <small>Podaj liczbę rozdań<br />30 jest po staremu.</small></td> + </tr> + <tr> + <td align="CENTER" colspan="3">Średnie WK zawodnika w turnieju: + <input type="text" id="srd" name="srd" readonly="readonly"<?php if( $izw>0 ){echo ' value="'.($swk/$izw > 0.15 ? $swk/$izw : 0.15).'"';}?>><br /> + </td> + <td align="CENTER" colspan="3">Mnożnik rozdaniowy (LiczbaRozdań/30): + <input type="text" id="mnoznikRZD" name="mnoznikRZD" readonly="readonly"<?php if( $rzd>0 ){echo ' value="'.($rzd/30.0 > 1.0 ? $rzd/30.0 : 1.0).'"';}?>><br /> + </td> + </tr> + <tr><td colspan="5"> </td></tr> + <tr> + <td align="CENTER" colspan="2"> + <input type="button" value="Policz PKLe" onclick="submitit()"></td> + <td colspan="3"> +<?php +if( $tab>0 ){ + echo '<input type="button" value="SQL dla JFR Pary" onclick="document.getElementById(\'outsql\').style.display=(document.getElementById(\'outsql\').style.display==\'none\') ? \'block\' : \'none\';"> + <input type="button" value="SQL dla JFR Teamy" onclick="document.getElementById(\'outsql2\').style.display=(document.getElementById(\'outsql2\').style.display==\'none\') ? \'block\' : \'none\';">'; +} else { + echo ' '; +} +?> + </td> + </tr> + <tr><td colspan="2" align="center"> +<?php +if( $tab>0 ){ + unset( $tabpkl ); + $lasti = 0; + echo '<table><tr><td class="t">Miejsce</td><td class="t"> PKL </td>'; + echo '</tr>'; + $max = ceil(($mnoznikRZD*(($swk/$izw)*$rng) + $izw*$zaw)); + if( $max<$minpkl ) $max = $minpkl; + $prem = 0; + $zni = 1; + switch( $typ ){ + case 2: + $zni = 2; + break; + case 4: + $zni = 4; + break; + } + if( $prem>0 ){ + $d = 2; + } else { + $d = 0; + } + $maxold = ceil($prcold*$izw + 0.05*$swk); + $progu1 = $progu1*$iuc*0.01+1; + $progu2 = $progu2*$iuc*0.01+1; + $progu3 = $progu3*$iuc*0.01+1; // 0 pkl za ostatnie punktowane+1 + $progp1 = $max*$progp1*0.01; + $progp2 = $max*$progp2*0.01; + $sumn = 0 ; + $sumo = 0; + $i = 0; + $dok = 1 - 1e-6; // unikamy błędu ceil(2)=3; + do{ + $i++; + if( $i<=$progu1 ){ + $p = $progp1+($max-$progp1)*($progu1-$i)/($progu1-1); + } + elseif( $i<=$progu2 ){ + $p = $progp2+($progp1-$progp2)*($progu2-$i)/($progu2-$progu1); + } + elseif( $i<$progu3 ){ + $p = $progp3+($progp2-$progp3)*($progu3-$i)/($progu3-$progu2); + } + else $p=0; + if( ($p>0) ){ + echo '<tr><td class="t">'.$i.'</td>'; + if( $p>0 ){ + $pkl_temp = ceil($p); + if (($pkl_temp - $p) < $dok){ + $p = $pkl_temp; + } else { + $p = round($p); + } + $tabkl[$i] = $p; + $lasti = $i; + echo '<td class="t">'.$p.'</td>'; + $sumn = $sumn + $p; + } else { + echo '<td class="p"> </td>'; + } + echo '</tr>'; + } + } while( (($p>0) || ($maxold>0)) && ($i<$iuc) ); + echo '<tr><td class="p">SUMA PKL</td><td class="t">'.$typ*$sumn.'</td></tr>'; + echo '</table>'; +} else { + echo ' '; +} +?> +</td><td colspan="3" valign="top"><span id="outsql" style="display: none"> +<?php +echo "UPDATE `dodatki` SET `pkl`=0;<br />\r\n"; +for( $i=1; $i<=$lasti; $i++){ + echo "UPDATE `dodatki` SET `pkl`=".$tabkl[$i]." WHERE `miejsce`=".$i.";<br />\r\n"; +} +?> +</span></td> +<td colspan="3" valign="top"><span id="outsql2" style="display: none"> +<?php +echo "UPDATE `addons` SET `mastr`=0;<br />\r\n"; +for( $i=1; $i<=$lasti; $i++){ + echo "UPDATE `addons` SET `mastr`=".$tabkl[$i]." WHERE `place`=".$i.";<br />\r\n"; +} +?> +</span></td></tr> +<tr><td colspan="5" class="copyright">©'2009, Jan Romański dla PZBS</td></tr> +</table> +</form> +</body> +</html> diff --git a/.pkle2018-test.php b/.pkle2018-test.php new file mode 100644 index 0000000..958ab50 --- /dev/null +++ b/.pkle2018-test.php @@ -0,0 +1,601 @@ +<?php +$tabpkl = array(); +$typ = 0; +$rng = 0; +$xrng = 0; +$iuc = 0; +$izw = 0; +$swk = 0; +$tab = 0; +$minpkl = 0; +$mnoznikRZD = 1; +$rzd = 30; + +$min1 = 200; +$min2 = 150; +$min3 = 75; +$min4 = 50; +$min5 = 0; +$min6 = 0; +$min7 = 0; +$min8 = 0; + +$min1_ = 300; +$min2_ = 200; +$min3_ = 100; +$min4_ = 70; +$min5_ = 0; +$min6_ = 0; +$min7_ = 0; +$min8_ = 0; + +// regulamin +$progu0 = 0; +$progp0 = 100; + +$progu1 = 2; // dla pierwszych progu1% uczestników +$progp1 = 90; // ostatni dostaje progp1% maximum punktów + +$progu2 = 20; // dla kolejnych (progu2-progu1)% uczestników +$progp2 = 20; // ostatni dostaje 10*progp2% maximum punktów + +$progu3 = 50; // dla kolejnych (progu3-progu2)% uczestników +$progp3 = 0; // ostatni dostaje 10*progp3% maximum punktów + + +$rgg = 25; // OTP**** +$rgp = 15; // OTP*** +$rot = 10; // OTP** +$rok1 = 7; // OTP* +$rok = 5; // OTP +$rtp = 4; // RTP +$rto = 2; // okregowy +$rtk = 1; // klubowy + +$rgg_ = 40; // OTP**** +$rgp_ = 25; // OTP*** +$rot_ = 15; // OTP** +$rok1_ = 10; // OTP* +$rok_ = 7; // OTP +$rtp_ = 5; // RTP +$rto_ = 3; // okregowy +$rtk_ = 2; // klubowy + +$zaw = 0.05; +$dajp = 0; + +/*if( $_SERVER['REQUEST_METHOD'] == 'GET' ){ +// ?typtur=[1,2,4]&uczest=IU&sumawk=SWK&ranga=[1..9] +// I P T GP..KLUB + $l = 0; + $rozdan = $_GET['rozdan']; + if( isset($_GET['typtur']) ){ + $typ = $_GET['typtur']; + $l = 1; + } + if( isset($_GET['uczest']) ){ + $iuc = $_GET['uczest']; + $l = $l + 1; + } + if( isset($_GET['sumawk']) ){ + $swk = $_GET['sumawk']; + $l = $l + 1; + } + if( isset($_GET['ranga']) ){ + $rng = $_GET['ranga']; + switch( $rng ){ + case 1: + $rng = $rgg; + $xrng = $xrgg; + $minpkl = $min1; + break; + case 2: + $rng = $rgp; + $xrng = $xrgp; + $minpkl = $min2; + break; + case 3: + $rng = $rot; + $xrng = $xrot; + $minpkl = $min3; + break; + case 4: + $rng = $rok; + $xrng = $xrok; + $minpkl = $min4; + break; + case 5: + $rng = $r40; + $xrng = $xr40; + $minpkl = $min5; + break; + case 6: + $rng = $rtp; + $xrng = $xrtp; + $minpkl = $min6; + break; + case 7: + $rng = $rtd; + $xrng = $xrtd; + $minpkl = $mind; + break; + case 8: + $rng = $rtr; + $xrng = $xrtr; + $minpkl = $min7; + break; + case 9: + $rng = $rto; + $xrng = $xrto; + $minpkl = $min8; + break; + case 10: + $rng = $rtk; + $xrng = $xrtk; + $minpkl = $min9; + break; + } + if( $rng ) $l = $l + 1; + } + if( $typ>2 ) $typ = 4; + $izw = $typ*$iuc; + if( $izw > 99 ){ + $dajp = 1; + } + if( $l > 3 ) $tab = 1; +} +else*/if( $_SERVER['REQUEST_METHOD'] == 'POST' ){ + $rozdan = $_POST['rozdan']; + + $progu1 = $_POST['pru1']; // dla pierwszych progu1% uczestników + $progp1 = $_POST['prp1']; // ostatni dostaje progp1% maximum punktów + $progu2 = $_POST['pru2']; // dla kolejnych (progu2-progu1)% uczestników + $progp2 = $_POST['prp2']; // ostatni dostaje 10*progp2% maximum punktów + $progu3 = $_POST['pru3']; // dla kolejnych (progu3-progu2)% uczestników + $rgg = $_POST['rgg']; + $rgp = $_POST['rgp']; + $rot = $_POST['rot']; + $rok1 = $_POST['rok1']; + $rok = $_POST['rok']; + $rtp = $_POST['rtp']; + $rto = $_POST['rto']; + $rtk = $_POST['rtk']; + $rgg_ = $_POST['rgg_']; + $rgp_ = $_POST['rgp_']; + $rot_ = $_POST['rot_']; + $rok1_ = $_POST['rok1_']; + $rok_ = $_POST['rok_']; + $rtp_ = $_POST['rtp_']; + $rto_ = $_POST['rto_']; + $rtk_ = $_POST['rtk_']; + + $typ = $_POST['typ']; + $rng = $_POST['rng']; + $zaw = $_POST['zaw']; + $mnoznikRZD = $_POST['mnoznikRZD']; + $rzd = $_POST['rzd']; + $min1 = $_POST['min1']; + $min2 = $_POST['min2']; + $min3 = $_POST['min3']; + $min4 = $_POST['min4']; + $min5 = $_POST['min5']; + $min6 = $_POST['min6']; + $min7 = $_POST['min7']; + $min8 = $_POST['min8']; + $min1_ = $_POST['min1_']; + $min2_ = $_POST['min2_']; + $min3_ = $_POST['min3_']; + $min4_ = $_POST['min4_']; + $min5_ = $_POST['min5_']; + $min6_ = $_POST['min6_']; + $min7_ = $_POST['min7_']; + $min8_ = $_POST['min8_']; + if(!$rozdan): + switch( $rng ){ + case 1: + $rng = $rgg; + $minpkl = $min1; + break; + case 2: + $rng = $rgp; + $minpkl = $min2; + break; + case 3: + $rng = $rot; + $minpkl = $min3; + break; + case 4: + $rng = $rok1; + $minpkl = $min4; + break; + case 5: + $rng = $rok; + $minpkl = $min5; + break; + case 6: + $rng = $rtp; + $minpkl = $min6; + break; + case 7: + $rng = $rto; + $minpkl = $min7; + break; + case 8: + $rng = $rtk; + $minpkl = $min8; + break; + } + else: + switch( $rng ){ + case 1: + $rng = $rgg_; + $minpkl = $min1_; + break; + case 2: + $rng = $rgp_; + $minpkl = $min2_; + break; + case 3: + $rng = $rot_; + $minpkl = $min3_; + break; + case 4: + $rng = $rok1_; + $minpkl = $min4_; + break; + case 5: + $rng = $rok_; + $minpkl = $min5_; + break; + case 6: + $rng = $rtp_; + $minpkl = $min6_; + break; + case 7: + $rng = $rto_; + $minpkl = $min7_; + break; + case 8: + $rng = $rtk_; + $minpkl = $min8_; + break; + } + endif; + $iuc = $_POST['iuc']; + if( $typ>2 ) $typ = 4; + $izw = $typ*$iuc; + if( $izw > 99 ){ + $dajp = 1; + } + $swk = $_POST['swk']; + $tab = 1; +} +?> +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> +<html> +<head> +<meta http-equiv="pragma" content="no-cache"> +<meta http-equiv="cache-control" content="no-cache"> +<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> +<title>Kargulator PKLi</title> +<link rel="stylesheet" href="style.css" type="text/css"> +<link rel="icon" href="images/favicon.ico" type="image/x-icon"> +<link rel="shortcut icon" href="images/favicon.ico" type="image/x-icon"> +<script type="text/javascript"> +<!-- +function valiuc(x,y){ + if( !(x.value==null || x.value=='') ){ + x.value = x.value.replace(',','.'); + if( isFinite(x.value)){ + if( y==1 ){ + if( document.getElementsByName("typ")[0].checked ){ + document.getElementById("izw").value = x.value; + } else { + if( document.getElementsByName("typ")[1].checked ){ + document.getElementById("izw").value = 2 * x.value; + } else { + if( document.getElementsByName("typ")[2].checked ){ + document.getElementById("izw").value = 4 * x.value; + } + } + } + } + if( y==3 ){ + var z = document.getElementById('izw'); + if( valiuc(z,2) ){ + var srednieWk = x.value/z.value; + if(srednieWk < 0.15) srednieWk = 0.15; + document.getElementById('srd').value = srednieWk; + } + } + if( y==4 ){ + var m = document.getElementById('rzd'); + if( valiuc(m,2) ){ + var mnoznikRZD = x.value/30; + if(mnoznikRZD < 1) mnoznikRZD = 1; + document.getElementById('mnoznikRZD').value = mnoznikRZD; + } + } + return true; + } else { + alert(x.value+' to nie liczba!'); + x.select(); + x.focus(); + return false; + } + } +} + +function typtur(x){ + var t = document.getElementById("iuc"); + var z = document.getElementById("izw"); + if( t.value!=null && t.value!='' && isFinite(t.value) ){ + z.value = x * t.value; + } +} + +function submitit(){ + if( document.getElementsByName("typ")[0].checked || + document.getElementsByName("typ")[1].checked || + document.getElementsByName("typ")[2].checked ){ + if( document.getElementsByName("rng")[0].checked || + document.getElementsByName("rng")[1].checked || + document.getElementsByName("rng")[2].checked || + document.getElementsByName("rng")[3].checked || + document.getElementsByName("rng")[4].checked || + document.getElementsByName("rng")[5].checked || + document.getElementsByName("rng")[6].checked || + document.getElementsByName("rng")[7].checked || + document.getElementsByName("rng")[8].checked || + document.getElementsByName("rng")[9].checked ){ + var t = document.getElementById("iuc") + if( t.value!=null && t.value!='' && isFinite(t.value) ){ + t = document.getElementById("izw"); + if( t.value!=null && t.value!='' && isFinite(t.value) ){ + t = document.getElementById("swk"); + if( t.value!=null && t.value!='' && isFinite(t.value) ){ + + document.getElementById("pkl").submit(); + + } else { + alert('Brak sumy WK!'); + t.select(); + } + } else { + alert('Brak liczby zawodników!'); + t.select(); + } + } else { + alert('Brak liczby uczestników!'); + t.select(); + } + } else { + alert('Wybierz rangę turnieju'); + document.getElementsByName("rng")[0].select(); + } + } else { + alert('Wybierz typ turnieju'); + document.getElementsByName("typ")[0].select(); + } +} +--> +</script> +</head> +<body> +<form id="pkl" method="post" action="pkle2018-test.php"> +<table border="0" cellspacing="0" cellpadding="0"> + <tr> + <td><img src="images/logo_pzbs.gif"></td> + <td colspan="3" align="center"><h3>KALKULATOR PKLI W TURNIEJACH PZBS<br> + zgodny z <span style="color:#d00">nowa propozycja - mnożnik rozdaniowy nakłądany (śr.WKxWAGA+il.zawXWSP)</span></h3> + Przejdź do <a href="pkle2018-test-w-nawiasie.php"><b>wersji z mnoznikiem nakładanym tylko na śr.WKxWAGA</b></a>! + <br><br> + <td><img src="images/logo_pzbs.gif"></td> + </tr> + <tr><td colspan="5"> </td></tr> + <tr> + <td align="center" colspan="2"><b>turniej do 39 rozdań</b></td> + <td align="center" colspan="2"><b>turniej od 40 rozdań</b></td> + </tr> + <tr> + <td align="right">WAGA<br>turnieju</td><td align="left">MINIMUM<br>za 1sze miejsce</td> + <td align="right">WAGA<br>turnieju</td><td align="left">MINIMUM<br>za 1sze miejsce</td> + <td align="left" colspan="3">WSP:</td> + </tr> + <tr> + <td align="right" rowspan="3"> + OTP<sup>∗∗∗∗</sup>: <input type="text" id="rgg" name="rgg" maxlength="3" style="width:30px" value=<?php echo '"'.$rgg.'"'; ?>><br /> + OTP<sup>∗∗∗</sup>: <input type="text" id="rgp" name="rgp" maxlength="3" style="width:30px" value=<?php echo '"'.$rgp.'"'; ?>><br /> + OTP<sup>∗∗</sup>: <input type="text" id="rot" name="rot" maxlength="3" style="width:30px" value=<?php echo '"'.$rot.'"'; ?>><br /> + OTP<sup>∗</sup>: <input type="text" id="rok1" name="rok1" maxlength="3" style="width:30px" value=<?php echo '"'.$rok1.'"'; ?>><br /> + OTP: <input type="text" id="rok" name="rok" maxlength="3" style="width:30px" value=<?php echo '"'.$rok.'"'; ?>><br /> + Regionalny: <input type="text" id="rtp" name="rtp" maxlength="3" style="width:30px" value=<?php echo '"'.$rtp.'"'; ?>><br /> + Okręgowy: <input type="text" id="rto" name="rto" maxlength="3" style="width:30px" value=<?php echo '"'.$rto.'"'; ?>><br /> + Klubowy: <input type="text" id="rtk" name="rtk" maxlength="3" style="width:30px" value=<?php echo '"'.$rtk.'"'; ?>></td> + <td align="left" rowspan="3"> + <input type="text" id="min1" name="min1" maxlength="3" style="width:30px" value=<?php echo '"'.$min1.'"'; ?>><br /> + <input type="text" id="min2" name="min2" maxlength="3" style="width:30px" value=<?php echo '"'.$min2.'"'; ?>><br /> + <input type="text" id="min3" name="min3" maxlength="3" style="width:30px" value=<?php echo '"'.$min3.'"'; ?>><br /> + <input type="text" id="min4" name="min4" maxlength="3" style="width:30px" value=<?php echo '"'.$min4.'"'; ?>><br /> + <input type="text" id="min5" name="min5" maxlength="3" style="width:30px" value=<?php echo '"'.$min5.'"'; ?>><br /> + <input type="text" id="min6" name="min6" maxlength="3" style="width:30px" value=<?php echo '"'.$min6.'"'; ?>><br /> + <input type="text" id="min7" name="min7" maxlength="3" style="width:30px" value=<?php echo '"'.$min7.'"'; ?>><br /> + <input type="text" id="min8" name="min8" maxlength="3" style="width:30px" value=<?php echo '"'.$min8.'"'; ?>></td> + <td align="right" rowspan="3"> + OTP<sup>∗∗∗∗</sup>: <input type="text" id="rgg_" name="rgg_" maxlength="3" style="width:30px" value=<?php echo '"'.$rgg_.'"'; ?>><br /> + OTP<sup>∗∗∗</sup>: <input type="text" id="rgp_" name="rgp_" maxlength="3" style="width:30px" value=<?php echo '"'.$rgp_.'"'; ?>><br /> + OTP<sup>∗∗</sup>: <input type="text" id="rot_" name="rot_" maxlength="3" style="width:30px" value=<?php echo '"'.$rot_.'"'; ?>><br /> + OTP<sup>∗</sup>: <input type="text" id="rok1_" name="rok1_" maxlength="3" style="width:30px" value=<?php echo '"'.$rok1_.'"'; ?>><br /> + OTP: <input type="text" id="rok_" name="rok_" maxlength="3" style="width:30px" value=<?php echo '"'.$rok_.'"'; ?>><br /> + Regionalny: <input type="text" id="rtp_" name="rtp_" maxlength="3" style="width:30px" value=<?php echo '"'.$rtp_.'"'; ?>><br /> + Okręgowy: <input type="text" id="rto_" name="rto_" maxlength="3" style="width:30px" value=<?php echo '"'.$rto_.'"'; ?>><br /> + Klubowy: <input type="text" id="rtk_" name="rtk_" maxlength="3" style="width:30px" value=<?php echo '"'.$rtk_.'"'; ?>></td> + <td align="left" rowspan="3"> + <input type="text" id="min1_" name="min1_" maxlength="3" style="width:30px" value=<?php echo '"'.$min1_.'"'; ?>><br /> + <input type="text" id="min2_" name="min2_" maxlength="3" style="width:30px" value=<?php echo '"'.$min2_.'"'; ?>><br /> + <input type="text" id="min3_" name="min3_" maxlength="3" style="width:30px" value=<?php echo '"'.$min3_.'"'; ?>><br /> + <input type="text" id="min4_" name="min4_" maxlength="3" style="width:30px" value=<?php echo '"'.$min4_.'"'; ?>><br /> + <input type="text" id="min5_" name="min5_" maxlength="3" style="width:30px" value=<?php echo '"'.$min5_.'"'; ?>><br /> + <input type="text" id="min6_" name="min6_" maxlength="3" style="width:30px" value=<?php echo '"'.$min6_.'"'; ?>><br /> + <input type="text" id="min7_" name="min7_" maxlength="3" style="width:30px" value=<?php echo '"'.$min7_.'"'; ?>><br /> + <input type="text" id="min8_" name="min8_" maxlength="3" style="width:30px" value=<?php echo '"'.$min8_.'"'; ?>></td> + <td align="left" valign="top"><input type="text" id="zaw" name="zaw" maxlength="5" style="width:30px" value=<?php echo '"'.$zaw.'"'; ?>></td> + + <td valign="top" colspan="2">PKL za 1 m = <b>śr.WK×WAGA + il.zaw×WSP</b></td> + </tr> + <tr> + <td align="right" valign="top"><br /><br /><br /><br /><input type="text" id="prp1" name="prp1" style="width:18px" value=<?php echo '"'.$progp1.'"'; ?>>%<br /><input type="text" id="prp2" name="prp2" style="width:18px" value=<?php echo '"'.$progp2.'"'; ?>>%</td> + <td colspan="2" align="left"><img src="images/pkle.png"></td> + </tr> + <tr> + <td> </td> + <td colspan="2"><table cellspacing="0" cellpadding="0"><tr><td align="right" style="width:50px"><input type="text" id="pru1" name="pru1" style="width:18px" value=<?php echo '"'.$progu1.'"'; ?>>%</td><td align="right" style="width:25px"><input type="text" id="pru2" name="pru2" style="width:18px" value=<?php echo '"'.$progu2.'"'; ?>>%</td><td align="right" style="width:55px"><input type="text" id="pru3" name="pru3" style="width:18px" value=<?php echo '"'.$progu3.'"'; ?>>%</td></tr></table></td> + </tr> + + <tr><td colspan="5"> </td></tr> + <tr> + <td valign=top rowspan="2">TYP ZAWODÓW<br /> + <input type="radio" name="typ" id="tp1" value="1" onclick="typtur(1)"<?php if( $typ==1 ){ echo ' checked="checked"';}?>><label for="tp1"> Indywiduel</label><br /> + <input type="radio" name="typ" id="tp2" value="2" onclick="typtur(2)"<?php if( $typ==2 ){ echo ' checked="checked"';}?>><label for="tp2"> Pary</label><br /> + <input type="radio" name="typ" id="tp3" value="4" onclick="typtur(4)"<?php if( $typ==4 ){ echo ' checked="checked"';}?>><label for="tp3"> Teamy</label> + <br><br>LICZBA ROZDAŃ<br> + <input type="radio" name="rozdan" id="rozdan0" value="0"<?php if( !$rozdan ){ echo ' checked="checked"';}?>><label for="rozdan0"> do 39</label><br /> + <input type="radio" name="rozdan" id="rozdan1" value="1"<?php if( $rozdan ){ echo ' checked="checked"';}?>><label for="rozdan1"> od 40</label> + </td> + <td valign=top rowspan="2">RANGA ZAWODÓW<br /> + <input type="radio" name="rng" id="rg1" value="1"<?php if( $_POST['rng']==1 ){echo ' checked="checked"';}?>><label for="rg1"> OTP<sup>∗∗∗∗</sup></label><br /> + <input type="radio" name="rng" id="rg2" value="2"<?php if( $_POST['rng']==2 ){echo ' checked="checked"';}?>><label for="rg2"> OTP<sup>∗∗∗</sup></label><br /> + <input type="radio" name="rng" id="rg3" value="3"<?php if( $_POST['rng']==3 ){echo ' checked="checked"';}?>><label for="rg3"> OTP<sup>∗∗</sup></label><br /> + <input type="radio" name="rng" id="rg4" value="4"<?php if( $_POST['rng']==4 ){echo ' checked="checked"';}?>><label for="rg4"> OTP<sup>∗</sup></label><br /> + <input type="radio" name="rng" id="rg5" value="5"<?php if( $_POST['rng']==5 ){echo ' checked="checked"';}?>><label for="rg5"> OTP</label><br /> + <input type="radio" name="rng" id="rg6" value="6"<?php if( $_POST['rng']==6 ){echo ' checked="checked"';}?>><label for="rg6"> Regionalny</label><br /> + <input type="radio" name="rng" id="rg7" value="7"<?php if( $_POST['rng']==7 ){echo ' checked="checked"';}?>><label for="rg7"> Okręgowy</label><br /> + <input type="radio" name="rng" id="rg8" value="8"<?php if( $_POST['rng']==8 ){echo ' checked="checked"';}?>><label for="rg8"> Klubowy</label></td> + <td align="CENTER" valign=top>UCZESTNIKÓW<br /> + <input type="text" id="iuc" name="iuc" maxlength="3" style="width:50px" onblur="valiuc(this,1)"<?php if( $iuc>0 ){echo ' value="'.$iuc.'"';}?>><br /> + <small>W zależności od typu<br />ilość indywidualistów,<br />par lub teamów</small></td> + <td align="CENTER" valign=top>ZAWODNIKÓW<br /> + <input type="text" id="izw" name="izw" readonly="readonly" maxlength="4" style="width:50px" onblur="valiuc(this,2)"<?php if( $izw>0 ){echo ' value="'.$izw.'"';}?>><br /> + <small>To pole jest wyliczane<br />automatycznie.</small></td> + <td align="CENTER" valign=top>SUMA WK<br /> + <input type="text" id="swk" name="swk" maxlength="7" style="width:70px" onblur="valiuc(this,3)"<?php if( $swk>0 ){echo ' value="'.$swk.'"';}?>><br /> + <small>Suma WK wszystkich<br />zawodników.</small></td> + <td align="CENTER" valign=top>Liczba rozdań<br /> + <input type="text" id="rzd" name="rzd" maxlength="7" style="width:70px" onblur="valiuc(this,4)"<?php if( $rzd>0 ){echo ' value="'.$rzd.'"';}?>><br /> + <small>Podaj liczbę rozdań<br />30 jest po staremu.</small></td> + </tr> + <tr> + <td align="CENTER" colspan="3">Średnie WK zawodnika w turnieju: + <input type="text" id="srd" name="srd" readonly="readonly"<?php if( $izw>0 ){echo ' value="'.($swk/$izw > 0.15 ? $swk/$izw : 0.15).'"';}?>><br /> + </td> + <td align="CENTER" colspan="3">Mnożnik rozdaniowy (LiczbaRozdań/30): + <input type="text" id="mnoznikRZD" name="mnoznikRZD" readonly="readonly"<?php if( $rzd>0 ){echo ' value="'.($rzd/30.0 > 1.0 ? $rzd/30.0 : 1.0).'"';}?>><br /> + </td> + </tr> + <tr><td colspan="5"> </td></tr> + <tr> + <td align="CENTER" colspan="2"> + <input type="button" value="Policz PKLe" onclick="submitit()"></td> + <td colspan="3"> +<?php +if( $tab>0 ){ + echo '<input type="button" value="SQL dla JFR Pary" onclick="document.getElementById(\'outsql\').style.display=(document.getElementById(\'outsql\').style.display==\'none\') ? \'block\' : \'none\';"> + <input type="button" value="SQL dla JFR Teamy" onclick="document.getElementById(\'outsql2\').style.display=(document.getElementById(\'outsql2\').style.display==\'none\') ? \'block\' : \'none\';">'; +} else { + echo ' '; +} +?> + </td> + </tr> + <tr><td colspan="2" align="center"> +<?php +if( $tab>0 ){ + unset( $tabpkl ); + $lasti = 0; + echo '<table><tr><td class="t">Miejsce</td><td class="t"> PKL </td>'; + echo '</tr>'; + $max = ceil($mnoznikRZD*(($swk/$izw)*$rng + $izw*$zaw)); + if( $max<$minpkl ) $max = $minpkl; + $prem = 0; + $zni = 1; + switch( $typ ){ + case 2: + $zni = 2; + break; + case 4: + $zni = 4; + break; + } + if( $prem>0 ){ + $d = 2; + } else { + $d = 0; + } + $maxold = ceil($prcold*$izw + 0.05*$swk); + $progu1 = $progu1*$iuc*0.01+1; + $progu2 = $progu2*$iuc*0.01+1; + $progu3 = $progu3*$iuc*0.01+1; // 0 pkl za ostatnie punktowane+1 + $progp1 = $max*$progp1*0.01; + $progp2 = $max*$progp2*0.01; + $sumn = 0 ; + $sumo = 0; + $i = 0; + $dok = 1 - 1e-6; // unikamy błędu ceil(2)=3; + do{ + $i++; + if( $i<=$progu1 ){ + $p = $progp1+($max-$progp1)*($progu1-$i)/($progu1-1); + } + elseif( $i<=$progu2 ){ + $p = $progp2+($progp1-$progp2)*($progu2-$i)/($progu2-$progu1); + } + elseif( $i<$progu3 ){ + $p = $progp3+($progp2-$progp3)*($progu3-$i)/($progu3-$progu2); + } + else $p=0; + if( ($p>0) ){ + echo '<tr><td class="t">'.$i.'</td>'; + if( $p>0 ){ + $pkl_temp = ceil($p); + if (($pkl_temp - $p) < $dok){ + $p = $pkl_temp; + } else { + $p = round($p); + } + $tabkl[$i] = $p; + $lasti = $i; + echo '<td class="t">'.$p.'</td>'; + $sumn = $sumn + $p; + } else { + echo '<td class="p"> </td>'; + } + echo '</tr>'; + } + } while( (($p>0) || ($maxold>0)) && ($i<$iuc) ); + echo '<tr><td class="p">SUMA PKL</td><td class="t">'.$typ*$sumn.'</td></tr>'; + echo '</table>'; +} else { + echo ' '; +} +?> +</td><td colspan="3" valign="top"><span id="outsql" style="display: none"> +<?php +echo "UPDATE `dodatki` SET `pkl`=0;<br />\r\n"; +for( $i=1; $i<=$lasti; $i++){ + echo "UPDATE `dodatki` SET `pkl`=".$tabkl[$i]." WHERE `miejsce`=".$i.";<br />\r\n"; +} +?> +</span></td> +<td colspan="3" valign="top"><span id="outsql2" style="display: none"> +<?php +echo "UPDATE `addons` SET `mastr`=0;<br />\r\n"; +for( $i=1; $i<=$lasti; $i++){ + echo "UPDATE `addons` SET `mastr`=".$tabkl[$i]." WHERE `place`=".$i.";<br />\r\n"; +} +?> +</span></td></tr> +<tr><td colspan="5" class="copyright">©'2009, Jan Romański dla PZBS</td></tr> +</table> +</form> +</body> +</html> diff --git a/images/bkg.JPG b/images/bkg.JPG Binary files differnew file mode 100644 index 0000000..fd04a6f --- /dev/null +++ b/images/bkg.JPG diff --git a/images/favicon.ico b/images/favicon.ico Binary files differnew file mode 100644 index 0000000..0edfe3a --- /dev/null +++ b/images/favicon.ico diff --git a/images/logo_pzbs.gif b/images/logo_pzbs.gif Binary files differnew file mode 100644 index 0000000..8d57c1b --- /dev/null +++ b/images/logo_pzbs.gif diff --git a/images/pkle.png b/images/pkle.png Binary files differnew file mode 100644 index 0000000..597ad54 --- /dev/null +++ b/images/pkle.png diff --git a/index.php b/index.php new file mode 100644 index 0000000..60e3e88 --- /dev/null +++ b/index.php @@ -0,0 +1,4 @@ +<html> +<head></head> +<body></body> +</html> diff --git a/pkle.php b/pkle.php new file mode 100644 index 0000000..8159e28 --- /dev/null +++ b/pkle.php @@ -0,0 +1,3 @@ +<?php +Header('location: pkle2018.php'); +die(); diff --git a/pkle2009.php b/pkle2009.php new file mode 100644 index 0000000..ddd1135 --- /dev/null +++ b/pkle2009.php @@ -0,0 +1,582 @@ +<?php +$tabpkl = array(); +$typ = 0; +$rng = 0; +$xrng = 0; +$iuc = 0; +$izw = 0; +$swk = 0; +$tab = 0; +$minpkl = 0; +$min1 = 300; +$min2 = 200; +$min3 = 100; +$min4 = 50; +$min5 = 0; +$min6 = 50; +$mind = 0; +$min7 = 0; +$min8 = 0; +$min9 = 0; + +// regulamin +$progu0 = 0; +$progp0 = 100; + +$progu1 = 2; // dla pierwszych progu1% uczestników +$progp1 = 90; // ostatni dostaje progp1% maximum punktów + +$progu2 = 20; // dla kolejnych (progu2-progu1)% uczestników +$progp2 = 20; // ostatni dostaje 10*progp2% maximum punktów + +$progu3 = 50; // dla kolejnych (progu3-progu2)% uczestników +$progp3 = 0; // ostatni dostaje 10*progp3% maximum punktów + + +$rgg = 15; // OTP**** +$rgp = 12; // OTP*** +$rot = 10; // OTP** +$rok = 7; // OTP +$r40 = 5; // OTP krótki +$rtp = 5; // RTP* +$rtd = 5; // RTP 40+ +$rtr = 3; // RTP +$rto = 2; // okregowy +$rtk = 1; // klubowy + +$xrgg = 20; // OTP**** +$xrgp = 16; // OTP*** +$xrot = 12; // OTP** +$xrok = 9; // OTP +$xr40 = 8; // OTP krótki +$xrtp = 7; // RTP* +$xrtd = 6; // RTP 40+ +$xrtr = 5; // RTP +$xrto = 3; // okregowy +$xrtk = 2; // klubowy + +$zaw = 0.05; +$dajp = 0; + +if( $_SERVER['REQUEST_METHOD'] == 'GET' ){ +// ?typtur=[1,2,4]&uczest=IU&sumawk=SWK&ranga=[1..9] +// I P T GP..KLUB + $l = 0; + if( isset($_GET['typtur']) ){ + $typ = $_GET['typtur']; + $l = 1; + } + if( isset($_GET['uczest']) ){ + $iuc = $_GET['uczest']; + $l = $l + 1; + } + if( isset($_GET['sumawk']) ){ + $swk = $_GET['sumawk']; + $l = $l + 1; + } + if( isset($_GET['ranga']) ){ + $rng = $_GET['ranga']; + switch( $rng ){ + case 1: + $rng = $rgg; + $xrng = $xrgg; + $minpkl = $min1; + break; + case 2: + $rng = $rgp; + $xrng = $xrgp; + $minpkl = $min2; + break; + case 3: + $rng = $rot; + $xrng = $xrot; + $minpkl = $min3; + break; + case 4: + $rng = $rok; + $xrng = $xrok; + $minpkl = $min4; + break; + case 5: + $rng = $r40; + $xrng = $xr40; + $minpkl = $min5; + break; + case 6: + $rng = $rtp; + $xrng = $xrtp; + $minpkl = $min6; + break; + case 7: + $rng = $rtd; + $xrng = $xrtd; + $minpkl = $mind; + break; + case 8: + $rng = $rtr; + $xrng = $xrtr; + $minpkl = $min7; + break; + case 9: + $rng = $rto; + $xrng = $xrto; + $minpkl = $min8; + break; + case 10: + $rng = $rtk; + $xrng = $xrtk; + $minpkl = $min9; + break; + } + if( $rng ) $l = $l + 1; + } + if( $typ>2 ) $typ = 4; + $izw = $typ*$iuc; + if( $izw > 99 ){ + $dajp = 1; + } + if( $l > 3 ) $tab = 1; +} +elseif( $_SERVER['REQUEST_METHOD'] == 'POST' ){ + $progu1 = $_POST['pru1']; // dla pierwszych progu1% uczestników + $progp1 = $_POST['prp1']; // ostatni dostaje progp1% maximum punktów + $progu2 = $_POST['pru2']; // dla kolejnych (progu2-progu1)% uczestników + $progp2 = $_POST['prp2']; // ostatni dostaje 10*progp2% maximum punktów + $progu3 = $_POST['pru3']; // dla kolejnych (progu3-progu2)% uczestników + $rgg = $_POST['rgg']; + $rgp = $_POST['rgp']; + $rot = $_POST['rot']; + $rok = $_POST['rok']; + $r40 = $_POST['r40']; + $rtp = $_POST['rtp']; + $rtd = $_POST['rtd']; + $rtr = $_POST['rtr']; + $rto = $_POST['rto']; + $rtk = $_POST['rtk']; + + $typ = $_POST['typ']; + $rng = $_POST['rng']; + $zaw = $_POST['zaw']; + $min1 = $_POST['min1']; + $min2 = $_POST['min2']; + $min3 = $_POST['min3']; + $min4 = $_POST['min4']; + $min5 = $_POST['min5']; + $min6 = $_POST['min6']; + $min7 = $_POST['min7']; + $min8 = $_POST['min8']; + $min9 = $_POST['min9']; + switch( $rng ){ + case 20: + $rng = $rgg; + $xrng = $xrgg; + $minpkl = $min1; + break; + case 16: + $rng = $rgp; + $xrng = $xrgp; + $minpkl = $min2; + break; + case 12: + $rng = $rot; + $xrng = $xrot; + $minpkl = $min3; + break; + case 9: + $rng = $rok; + $xrng = $xrok; + $minpkl = $min4; + break; + case 8: + $rng = $r40; + $xrng = $xr40; + $minpkl = $min5; + break; + case 7: + $rng = $rtp; + $xrng = $xrtp; + $minpkl = $min6; + break; + case 6: + $rng = $rtd; + $xrng = $xrtd; + $minpkl = $mind; + break; + case 5: + $rng = $rtr; + $xrng = $xrtr; + $minpkl = $min7; + break; + case 3: + $rng = $rto; + $xrng = $xrto; + $minpkl = $min8; + break; + case 2: + $rng = $rtk; + $xrng = $xrtk; + $minpkl = $min9; + break; + } + $iuc = $_POST['iuc']; + if( $typ>2 ) $typ = 4; + $izw = $typ*$iuc; + if( $izw > 99 ){ + $dajp = 1; + } + $swk = $_POST['swk']; + $tab = 1; +} +?> +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> +<html> +<head> +<meta http-equiv="pragma" content="no-cache"> +<meta http-equiv="cache-control" content="no-cache"> +<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> +<title>Kargulator PKLi</title> +<link rel="stylesheet" href="style.css" type="text/css"> +<link rel="icon" href="images/favicon.ico" type="image/x-icon"> +<link rel="shortcut icon" href="images/favicon.ico" type="image/x-icon"> +<script type="text/javascript"> +<!-- +function valiuc(x,y){ + if( !(x.value==null || x.value=='') ){ + if( isFinite(x.value)){ + if( y==1 ){ + if( document.getElementsByName("typ")[0].checked ){ + document.getElementById("izw").value = x.value; + } else { + if( document.getElementsByName("typ")[1].checked ){ + document.getElementById("izw").value = 2 * x.value; + } else { + if( document.getElementsByName("typ")[2].checked ){ + document.getElementById("izw").value = 4 * x.value; + } + } + } + } + if( y==3 ){ + var z = document.getElementById('izw'); + if( valiuc(z,2) ){ + document.getElementById('srd').value = x.value/z.value; + } + } + return true; + } else { + alert(x.value+' to nie liczba!'); + x.select(); + x.focus(); + return false; + } + } +} + +function typtur(x){ + var t = document.getElementById("iuc"); + var z = document.getElementById("izw"); + if( t.value!=null && t.value!='' && isFinite(t.value) ){ + z.value = x * t.value; + } +} + +function submitit(){ + if( document.getElementsByName("typ")[0].checked || + document.getElementsByName("typ")[1].checked || + document.getElementsByName("typ")[2].checked ){ + if( document.getElementsByName("rng")[0].checked || + document.getElementsByName("rng")[1].checked || + document.getElementsByName("rng")[2].checked || + document.getElementsByName("rng")[3].checked || + document.getElementsByName("rng")[4].checked || + document.getElementsByName("rng")[5].checked || + document.getElementsByName("rng")[6].checked || + document.getElementsByName("rng")[7].checked || + document.getElementsByName("rng")[8].checked || + document.getElementsByName("rng")[9].checked ){ + var t = document.getElementById("iuc") + if( t.value!=null && t.value!='' && isFinite(t.value) ){ + t = document.getElementById("izw"); + if( t.value!=null && t.value!='' && isFinite(t.value) ){ + t = document.getElementById("swk"); + if( t.value!=null && t.value!='' && isFinite(t.value) ){ + + document.getElementById("pkl").submit(); + + } else { + alert('Brak sumy WK!'); + t.select(); + } + } else { + alert('Brak liczby zawodników!'); + t.select(); + } + } else { + alert('Brak liczby uczestników!'); + t.select(); + } + } else { + alert('Wybierz rangę turnieju'); + document.getElementsByName("rng")[0].select(); + } + } else { + alert('Wybierz typ turnieju'); + document.getElementsByName("typ")[0].select(); + } +} +--> +</script> +</head> +<body> +<form id="pkl" method="post" action="pkle2009.php"> +<table border="0" cellspacing="0" cellpadding="0"> + <tr> + <td><img src="images/logo_pzbs.gif"></td> + <td colspan="3" align="center"><h3>KALKULATOR PKLI W TURNIEJACH PZBS<br> + zgodny ze <span style="color:#d00">starym regulaminem (01.10.2009 - 31.03.2014)</span></h3> + Przejdź do <a href="pkle2014.php"><b>kalkulatora zgodnego z nowym regulaminem</b></a>! + <br><br> + Możesz eksperymentować ze wszystkimi (prawie) parametrami.<br> + Dla przywrócenia stanu regulaminowego otwórz ponownie stronę.</td> + <td><img src="images/logo_pzbs.gif"></td> + </tr> + <tr><td colspan="5"> </td></tr> + <tr> + <td align="right">WAGA<br>turnieju</td><td align="left">MINIMUM<br>za 1sze miejsce</td><td align="left" colspan="3">WSP:</td> + </tr> + <tr> + <td align="right" rowspan="3"> + OTP<sup>∗∗∗∗</sup>: <input type="text" id="rgg" name="rgg" maxlength="3" style="width:30px" value=<?php echo '"'.$rgg.'"'; ?>><br /> + OTP<sup>∗∗∗</sup>: <input type="text" id="rgp" name="rgp" maxlength="3" style="width:30px" value=<?php echo '"'.$rgp.'"'; ?>><br /> + OTP<sup>∗∗</sup>: <input type="text" id="rot" name="rot" maxlength="3" style="width:30px" value=<?php echo '"'.$rot.'"'; ?>><br /> + OTP: <input type="text" id="rok" name="rok" maxlength="3" style="width:30px" value=<?php echo '"'.$rok.'"'; ?>><br /> + OTP krótki: <input type="text" id="r40" name="r40" maxlength="3" style="width:30px" value=<?php echo '"'.$r40.'"'; ?>><br /> + Regionalny<sup>∗</sup>: <input type="text" id="rtp" name="rtp" maxlength="3" style="width:30px" value=<?php echo '"'.$rtp.'"'; ?>><br /> + Regionalny+40r: <input type="text" id="rtd" name="rtd" maxlength="3" style="width:30px" value=<?php echo '"'.$rtd.'"'; ?>><br /> + Regionalny: <input type="text" id="rtr" name="rtr" maxlength="3" style="width:30px" value=<?php echo '"'.$rtr.'"'; ?>><br /> + Okręgowy: <input type="text" id="rto" name="rto" maxlength="3" style="width:30px" value=<?php echo '"'.$rto.'"'; ?>><br /> + Klubowy: <input type="text" id="rtk" name="rtk" maxlength="3" style="width:30px" value=<?php echo '"'.$rtk.'"'; ?>></td> + <td align="left" rowspan="3"> + <input type="text" id="min1" name="min1" maxlength="3" style="width:30px" value=<?php echo '"'.$min1.'"'; ?>><br /> + <input type="text" id="min2" name="min2" maxlength="3" style="width:30px" value=<?php echo '"'.$min2.'"'; ?>><br /> + <input type="text" id="min3" name="min3" maxlength="3" style="width:30px" value=<?php echo '"'.$min3.'"'; ?>><br /> + <input type="text" id="min4" name="min4" maxlength="3" style="width:30px" value=<?php echo '"'.$min4.'"'; ?>><br /> + <input type="text" id="min5" name="min5" maxlength="3" style="width:30px" value=<?php echo '"'.$min5.'"'; ?>><br /> + <input type="text" id="min6" name="min6" maxlength="3" style="width:30px" value=<?php echo '"'.$min6.'"'; ?>><br /> + <input type="text" id="mind" name="minD" maxlength="3" style="width:30px" value=<?php echo '"'.$mind.'"'; ?>><br /> + <input type="text" id="min7" name="min7" maxlength="3" style="width:30px" value=<?php echo '"'.$min7.'"'; ?>><br /> + <input type="text" id="min8" name="min8" maxlength="3" style="width:30px" value=<?php echo '"'.$min8.'"'; ?>><br /> + <input type="text" id="min9" name="min9" maxlength="3" style="width:30px" value=<?php echo '"'.$min9.'"'; ?>></td> + <td align="left" valign="top"><input type="text" id="zaw" name="zaw" maxlength="5" style="width:30px" value=<?php echo '"'.$zaw.'"'; ?>></td> + <td valign="top" colspan="2">PKL za 1 m = <b>śr.WK×WAGA + il.zaw×WSP</b></td> + </tr> + <tr> + <td align="right" valign="top"><br /><br /><br /><br /><input type="text" id="prp1" name="prp1" style="width:18px" value=<?php echo '"'.$progp1.'"'; ?>>%<br /><input type="text" id="prp2" name="prp2" style="width:18px" value=<?php echo '"'.$progp2.'"'; ?>>%</td> + <td colspan="2" align="left"><img src="images/pkle.png"></td> + </tr> + <tr> + <td> </td> + <td colspan="2"><table cellspacing="0" cellpadding="0"><tr><td align="right" style="width:50px"><input type="text" id="pru1" name="pru1" style="width:18px" value=<?php echo '"'.$progu1.'"'; ?>>%</td><td align="right" style="width:25px"><input type="text" id="pru2" name="pru2" style="width:18px" value=<?php echo '"'.$progu2.'"'; ?>>%</td><td align="right" style="width:55px"><input type="text" id="pru3" name="pru3" style="width:18px" value=<?php echo '"'.$progu3.'"'; ?>>%</td></tr></table></td> + </tr> + + <tr><td colspan="5"> </td></tr> + <tr> + <td valign=top rowspan="2">TYP ZAWODÓW<br /> + <input type="radio" name="typ" id="tp1" value="1" onclick="typtur(1)"<?php if( $typ==1 ){ echo ' checked="checked"';}?>><label for="tp1"> Indywiduel</label><br /> + <input type="radio" name="typ" id="tp2" value="2" onclick="typtur(2)"<?php if( $typ==2 ){ echo ' checked="checked"';}?>><label for="tp2"> Pary</label><br /> + <input type="radio" name="typ" id="tp3" value="4" onclick="typtur(4)"<?php if( $typ==4 ){ echo ' checked="checked"';}?>><label for="tp3"> Teamy</label></td> + <td valign=top rowspan="2">RANGA ZAWODÓW<br /> + <input type="radio" name="rng" id="rg1" value="20"<?php if( $xrng==$xrgg ){echo ' checked="checked"';}?>><label for="rg1"> OTP<sup>∗∗∗∗</sup></label><br /> + <input type="radio" name="rng" id="rg2" value="16"<?php if( $xrng==$xrgp ){echo ' checked="checked"';}?>><label for="rg2"> OTP<sup>∗∗∗</sup></label><br /> + <input type="radio" name="rng" id="rg3" value="12"<?php if( $xrng==$xrot ){echo ' checked="checked"';}?>><label for="rg3"> OTP<sup>∗∗</sup></label><br /> + <input type="radio" name="rng" id="rg4" value="9"<?php if( $xrng==$xrok ){echo ' checked="checked"';}?>><label for="rg4"> OTP</label><br /> + <input type="radio" name="rng" id="rg5" value="8"<?php if( $xrng==$xr40 ){echo ' checked="checked"';}?>><label for="rg5"> OTP krótki</label><br /> + <input type="radio" name="rng" id="rg6" value="7"<?php if( $xrng==$xrtp ){echo ' checked="checked"';}?>><label for="rg6"> Regionalny<sup>∗</sup></label><br /> + <input type="radio" name="rng" id="rgD" value="6"<?php if( $xrng==$xrtd ){echo ' checked="checked"';}?>><label for="rgD"> Regionalny+40</label><br /> + <input type="radio" name="rng" id="rg7" value="5"<?php if( $xrng==$xrtr ){echo ' checked="checked"';}?>><label for="rg7"> Regionalny</label><br /> + <input type="radio" name="rng" id="rg8" value="3"<?php if( $xrng==$xrto ){echo ' checked="checked"';}?>><label for="rg8"> Okręgowy</label><br /> + <input type="radio" name="rng" id="rg9" value="2"<?php if( $xrng==$xrtk ){echo ' checked="checked"';}?>><label for="rg9"> Klubowy</label></td> + <td align="CENTER" valign=top>UCZESTNIKÓW<br /> + <input type="text" id="iuc" name="iuc" maxlength="3" style="width:50px" onblur="valiuc(this,1)"<?php if( $iuc>0 ){echo ' value="'.$iuc.'"';}?>><br /> + <small>W zależności od typu<br />ilość indywidualistów,<br />par lub teamów</small></td> + <td align="CENTER" valign=top>ZAWODNIKÓW<br /> + <input type="text" id="izw" name="izw" readonly="readonly" maxlength="4" style="width:50px" onblur="valiuc(this,2)"<?php if( $izw>0 ){echo ' value="'.$izw.'"';}?>><br /> + <small>To pole jest wyliczane<br />automatycznie.</small></td> + <td align="CENTER" valign=top>SUMA WK<br /> + <input type="text" id="swk" name="swk" maxlength="7" style="width:70px" onblur="valiuc(this,3)"<?php if( $swk>0 ){echo ' value="'.$swk.'"';}?>><br /> + <small>Suma WK wszystkich<br />zawodników.</small></td> + </tr> + <tr> + <td align="CENTER" colspan="3">Średnie WK zawodnika w turnieju: + <input type="text" id="srd" name="srd" readonly="readonly"<?php if( $izw>0 ){echo ' value="'.$swk/$izw.'"';}?>><br /> + </td> + </tr> + <tr><td colspan="5"> </td></tr> + <tr> + <td align="CENTER" colspan="2"> + <input type="button" value="Policz PKLe" onclick="submitit()"></td> + <td colspan="3"> +<?php +if( $tab>0 ){ + echo '<input type="button" value="SQL dla Pary" onclick="document.getElementById(\'outsql\').style.display=(document.getElementById(\'outsql\').style.display==\'none\') ? \'block\' : \'none\';"> + <input type="button" value="SQL dla Teamów" onclick="document.getElementById(\'outsql2\').style.display=(document.getElementById(\'outsql2\').style.display==\'none\') ? \'block\' : \'none\';">'; +} else { + echo ' '; +} +?> + </td> + </tr> + <tr><td colspan="2" align="center"> +<?php +if( $tab>0 ){ + unset( $tabpkl ); + $lasti = 0; + echo '<table><tr><td class="t">Miejsce</td><td class="t"> PKL </td>'; + echo '<td class="s">dotychczas</td></tr>'; + $max = ceil(($swk/$izw)*$rng + $izw*$zaw); + if( $max<$minpkl ) $max = $minpkl; + $prem = 0; + switch( $rng ){ + case $rgg: + case $rgp: + $prcold = 0.1; + break; + case $rot: + $prcold = 0.1; + break; + case $rok: + case $r40: + $prcold = 0.06; + break; + case $rtp: + case $rtr: + $prcold = 0.06; + if( $dajp ){ + $prem = 3; + } + break; + case $rto: + $prcold = 0.05; + break; + case $rtk: + $prcold = 0.04; + break; + } + $zni = 1; + switch( $typ ){ + case 2: + $zni = 2; + break; + case 4: + $zni = 4; + break; + } + if( $prem>0 ){ + $d = 2; + } else { + $d = 0; + } + $maxold = ceil($prcold*$izw + 0.05*$swk); + $progu1 = $progu1*$iuc*0.01+1; + $progu2 = $progu2*$iuc*0.01+1; + $progu3 = $progu3*$iuc*0.01+1; // 0 pkl za ostatnie punktowane+1 + $progp1 = $max*$progp1*0.01; + $progp2 = $max*$progp2*0.01; + $sumn = 0 ; + $sumo = 0; + $i = 0; + $dok = 1 - 1e-15; // unikamy błędu ceil(2)=3; + do{ + $i++; + if( $i<=$progu1 ){ + $p = $progp1+($max-$progp1)*($progu1-$i)/($progu1-1); + } + elseif( $i<=$progu2 ){ + $p = $progp2+($progp1-$progp2)*($progu2-$i)/($progu2-$progu1); + } + elseif( $i<$progu3 ){ + $p = $progp3+($progp2-$progp3)*($progu3-$i)/($progu3-$progu2); + } + else $p=0; + if( ($p>0) || ($maxold>0) ){ + echo '<tr><td class="t">'.$i.'</td>'; + if( $p>0 ){ + $pkl_temp = ceil($p); + if (($pkl_temp - $p) < $dok){ + $p = $pkl_temp; + } else { + $p = round($p); + } + $tabkl[$i] = $p; + $lasti = $i; + echo '<td class="t">'.$p.'</td>'; + $sumn = $sumn + $p; + } else { + echo '<td class="p"> </td>'; + } + if( $maxold>0 ){ + echo '<td class="s">'; + if( $i>($iuc/2) ){ + echo '<del> '; + } else { + $sumo = $sumo + $maxold + $d; + } + echo ($maxold + $d); + if( $i>($iuc/2) ){ + echo ' </del>'; + } + echo '</td>'; + if( $maxold<10 ){ + switch( $typ ){ + case 4: + $zni = 2; + break; + case 2: + $zni = 1; + break; + } + } + $maxold = $maxold - $zni; + if( $prem>0 ){ + if( $prem==3 ){ + $d = 1; + } else { + if( $prem==1 ){ + $d = 0; + } + } + $prem = $prem - 1; + } + } else { + echo '<td class="p"> </td>'; + } + echo '</tr>'; + } + } while( (($p>0) || ($maxold>0)) && ($i<$iuc) ); + echo '<tr><td class="p">SUMA PKL</td><td class="t">'.$typ*$sumn.'</td><td class="s">'.$typ*$sumo.'</td></tr>'; + echo '</table>'; +} else { + echo ' '; +} +?> +</td><td colspan="3" valign="top"><span id="outsql" style="display: none"> +<?php +echo "UPDATE `dodatki` SET `pkl`=0;<br />\r\n"; +for( $i=1; $i<=$lasti; $i++){ + echo "UPDATE `dodatki` SET `pkl`=".$tabkl[$i]." WHERE `miejsce`=".$i.";<br />\r\n"; +} +?> +</span></td> +<td colspan="3" valign="top"><span id="outsql2" style="display: none"> +<?php +echo "UPDATE `addons` SET `mastr`=0;<br />\r\n"; +for( $i=1; $i<=$lasti; $i++){ + echo "UPDATE `addons` SET `mastr`=".$tabkl[$i]." WHERE `place`=".$i.";<br />\r\n"; +} +?> +</span></td></tr> +<tr><td colspan="5" class="copyright">©'2009, Jan Romański dla PZBS</td></tr> +</table> +</form> +</body> +</html> diff --git a/pkle2014.php b/pkle2014.php new file mode 100644 index 0000000..8f0bbc7 --- /dev/null +++ b/pkle2014.php @@ -0,0 +1,584 @@ +<?php +$tabpkl = array(); +$typ = 0; +$rng = 0; +$xrng = 0; +$iuc = 0; +$izw = 0; +$swk = 0; +$tab = 0; +$minpkl = 0; + +$min1 = 200; +$min2 = 150; +$min3 = 75; +$min4 = 50; +$min5 = 0; +$min6 = 0; +$min7 = 0; +$min8 = 0; + +$min1_ = 300; +$min2_ = 200; +$min3_ = 100; +$min4_ = 70; +$min5_ = 0; +$min6_ = 0; +$min7_ = 0; +$min8_ = 0; + +// regulamin +$progu0 = 0; +$progp0 = 100; + +$progu1 = 2; // dla pierwszych progu1% uczestników +$progp1 = 90; // ostatni dostaje progp1% maximum punktów + +$progu2 = 20; // dla kolejnych (progu2-progu1)% uczestników +$progp2 = 20; // ostatni dostaje 10*progp2% maximum punktów + +$progu3 = 50; // dla kolejnych (progu3-progu2)% uczestników +$progp3 = 0; // ostatni dostaje 10*progp3% maximum punktów + + +$rgg = 25; // OTP**** +$rgp = 15; // OTP*** +$rot = 10; // OTP** +$rok1 = 7; // OTP* +$rok = 5; // OTP +$rtp = 4; // RTP +$rto = 2; // okregowy +$rtk = 1; // klubowy + +$rgg_ = 40; // OTP**** +$rgp_ = 25; // OTP*** +$rot_ = 15; // OTP** +$rok1_ = 10; // OTP* +$rok_ = 7; // OTP +$rtp_ = 5; // RTP +$rto_ = 3; // okregowy +$rtk_ = 2; // klubowy + +$zaw = 0.05; +$dajp = 0; + +/*if( $_SERVER['REQUEST_METHOD'] == 'GET' ){ +// ?typtur=[1,2,4]&uczest=IU&sumawk=SWK&ranga=[1..9] +// I P T GP..KLUB + $l = 0; + $rozdan = $_GET['rozdan']; + if( isset($_GET['typtur']) ){ + $typ = $_GET['typtur']; + $l = 1; + } + if( isset($_GET['uczest']) ){ + $iuc = $_GET['uczest']; + $l = $l + 1; + } + if( isset($_GET['sumawk']) ){ + $swk = $_GET['sumawk']; + $l = $l + 1; + } + if( isset($_GET['ranga']) ){ + $rng = $_GET['ranga']; + switch( $rng ){ + case 1: + $rng = $rgg; + $xrng = $xrgg; + $minpkl = $min1; + break; + case 2: + $rng = $rgp; + $xrng = $xrgp; + $minpkl = $min2; + break; + case 3: + $rng = $rot; + $xrng = $xrot; + $minpkl = $min3; + break; + case 4: + $rng = $rok; + $xrng = $xrok; + $minpkl = $min4; + break; + case 5: + $rng = $r40; + $xrng = $xr40; + $minpkl = $min5; + break; + case 6: + $rng = $rtp; + $xrng = $xrtp; + $minpkl = $min6; + break; + case 7: + $rng = $rtd; + $xrng = $xrtd; + $minpkl = $mind; + break; + case 8: + $rng = $rtr; + $xrng = $xrtr; + $minpkl = $min7; + break; + case 9: + $rng = $rto; + $xrng = $xrto; + $minpkl = $min8; + break; + case 10: + $rng = $rtk; + $xrng = $xrtk; + $minpkl = $min9; + break; + } + if( $rng ) $l = $l + 1; + } + if( $typ>2 ) $typ = 4; + $izw = $typ*$iuc; + if( $izw > 99 ){ + $dajp = 1; + } + if( $l > 3 ) $tab = 1; +} +else*/if( $_SERVER['REQUEST_METHOD'] == 'POST' ){ + $rozdan = $_POST['rozdan']; + + $progu1 = $_POST['pru1']; // dla pierwszych progu1% uczestników + $progp1 = $_POST['prp1']; // ostatni dostaje progp1% maximum punktów + $progu2 = $_POST['pru2']; // dla kolejnych (progu2-progu1)% uczestników + $progp2 = $_POST['prp2']; // ostatni dostaje 10*progp2% maximum punktów + $progu3 = $_POST['pru3']; // dla kolejnych (progu3-progu2)% uczestników + $rgg = $_POST['rgg']; + $rgp = $_POST['rgp']; + $rot = $_POST['rot']; + $rok1 = $_POST['rok1']; + $rok = $_POST['rok']; + $rtp = $_POST['rtp']; + $rto = $_POST['rto']; + $rtk = $_POST['rtk']; + $rgg_ = $_POST['rgg_']; + $rgp_ = $_POST['rgp_']; + $rot_ = $_POST['rot_']; + $rok1_ = $_POST['rok1_']; + $rok_ = $_POST['rok_']; + $rtp_ = $_POST['rtp_']; + $rto_ = $_POST['rto_']; + $rtk_ = $_POST['rtk_']; + + $typ = $_POST['typ']; + $rng = $_POST['rng']; + $zaw = $_POST['zaw']; + $min1 = $_POST['min1']; + $min2 = $_POST['min2']; + $min3 = $_POST['min3']; + $min4 = $_POST['min4']; + $min5 = $_POST['min5']; + $min6 = $_POST['min6']; + $min7 = $_POST['min7']; + $min8 = $_POST['min8']; + $min1_ = $_POST['min1_']; + $min2_ = $_POST['min2_']; + $min3_ = $_POST['min3_']; + $min4_ = $_POST['min4_']; + $min5_ = $_POST['min5_']; + $min6_ = $_POST['min6_']; + $min7_ = $_POST['min7_']; + $min8_ = $_POST['min8_']; + if(!$rozdan): + switch( $rng ){ + case 1: + $rng = $rgg; + $minpkl = $min1; + break; + case 2: + $rng = $rgp; + $minpkl = $min2; + break; + case 3: + $rng = $rot; + $minpkl = $min3; + break; + case 4: + $rng = $rok1; + $minpkl = $min4; + break; + case 5: + $rng = $rok; + $minpkl = $min5; + break; + case 6: + $rng = $rtp; + $minpkl = $min6; + break; + case 7: + $rng = $rto; + $minpkl = $min7; + break; + case 8: + $rng = $rtk; + $minpkl = $min8; + break; + } + else: + switch( $rng ){ + case 1: + $rng = $rgg_; + $minpkl = $min1_; + break; + case 2: + $rng = $rgp_; + $minpkl = $min2_; + break; + case 3: + $rng = $rot_; + $minpkl = $min3_; + break; + case 4: + $rng = $rok1_; + $minpkl = $min4_; + break; + case 5: + $rng = $rok_; + $minpkl = $min5_; + break; + case 6: + $rng = $rtp_; + $minpkl = $min6_; + break; + case 7: + $rng = $rto_; + $minpkl = $min7_; + break; + case 8: + $rng = $rtk_; + $minpkl = $min8_; + break; + } + endif; + $iuc = $_POST['iuc']; + if( $typ>2 ) $typ = 4; + $izw = $typ*$iuc; + if( $izw > 99 ){ + $dajp = 1; + } + $swk = $_POST['swk']; + $tab = 1; +} +?> +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> +<html> +<head> +<meta http-equiv="pragma" content="no-cache"> +<meta http-equiv="cache-control" content="no-cache"> +<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> +<title>Kargulator PKLi</title> +<link rel="stylesheet" href="style.css" type="text/css"> +<link rel="icon" href="images/favicon.ico" type="image/x-icon"> +<link rel="shortcut icon" href="images/favicon.ico" type="image/x-icon"> +<script type="text/javascript"> +<!-- +function valiuc(x,y){ + if( !(x.value==null || x.value=='') ){ + x.value = x.value.replace(',','.'); + if( isFinite(x.value)){ + if( y==1 ){ + if( document.getElementsByName("typ")[0].checked ){ + document.getElementById("izw").value = x.value; + } else { + if( document.getElementsByName("typ")[1].checked ){ + document.getElementById("izw").value = 2 * x.value; + } else { + if( document.getElementsByName("typ")[2].checked ){ + document.getElementById("izw").value = 4 * x.value; + } + } + } + } + if( y==3 ){ + var z = document.getElementById('izw'); + if( valiuc(z,2) ){ + var srednieWk = x.value/z.value; + if(srednieWk < 0.15) srednieWk = 0.15; + document.getElementById('srd').value = srednieWk; + } + } + return true; + } else { + alert(x.value+' to nie liczba!'); + x.select(); + x.focus(); + return false; + } + } +} + +function typtur(x){ + var t = document.getElementById("iuc"); + var z = document.getElementById("izw"); + if( t.value!=null && t.value!='' && isFinite(t.value) ){ + z.value = x * t.value; + } +} + +function submitit(){ + if( document.getElementsByName("typ")[0].checked || + document.getElementsByName("typ")[1].checked || + document.getElementsByName("typ")[2].checked ){ + if( document.getElementsByName("rng")[0].checked || + document.getElementsByName("rng")[1].checked || + document.getElementsByName("rng")[2].checked || + document.getElementsByName("rng")[3].checked || + document.getElementsByName("rng")[4].checked || + document.getElementsByName("rng")[5].checked || + document.getElementsByName("rng")[6].checked || + document.getElementsByName("rng")[7].checked || + document.getElementsByName("rng")[8].checked || + document.getElementsByName("rng")[9].checked ){ + var t = document.getElementById("iuc") + if( t.value!=null && t.value!='' && isFinite(t.value) ){ + t = document.getElementById("izw"); + if( t.value!=null && t.value!='' && isFinite(t.value) ){ + t = document.getElementById("swk"); + if( t.value!=null && t.value!='' && isFinite(t.value) ){ + + document.getElementById("pkl").submit(); + + } else { + alert('Brak sumy WK!'); + t.select(); + } + } else { + alert('Brak liczby zawodników!'); + t.select(); + } + } else { + alert('Brak liczby uczestników!'); + t.select(); + } + } else { + alert('Wybierz rangę turnieju'); + document.getElementsByName("rng")[0].select(); + } + } else { + alert('Wybierz typ turnieju'); + document.getElementsByName("typ")[0].select(); + } +} +--> +</script> +</head> +<body> +<form id="pkl" method="post" action="pkle2014.php"> +<table border="0" cellspacing="0" cellpadding="0"> + <tr> + <td><img src="images/logo_pzbs.gif"></td> + <td colspan="3" align="center"><h3>KALKULATOR PKLI W TURNIEJACH PZBS<br> + zgodny z <span style="color:#d00">starym regulaminem (obowiązującym do 01.11.2018)</span></h3> + Przejdź do <a href="pkle2018.php"><b>kalkulatora zgodnego z nowym regulaminem</b></a>! + <br><br> + Możesz eksperymentować ze wszystkimi (prawie) parametrami.<br> + Dla przywrócenia stanu regulaminowego otwórz ponownie stronę.</td> + <td><img src="images/logo_pzbs.gif"></td> + </tr> + <tr><td colspan="5"> </td></tr> + <tr> + <td align="center" colspan="2"><b>turniej do 39 rozdań</b></td> + <td align="center" colspan="2"><b>turniej od 40 rozdań</b></td> + </tr> + <tr> + <td align="right">WAGA<br>turnieju</td><td align="left">MINIMUM<br>za 1sze miejsce</td> + <td align="right">WAGA<br>turnieju</td><td align="left">MINIMUM<br>za 1sze miejsce</td> + <td align="left" colspan="3">WSP:</td> + </tr> + <tr> + <td align="right" rowspan="3"> + OTP<sup>∗∗∗∗</sup>: <input type="text" id="rgg" name="rgg" maxlength="3" style="width:30px" value=<?php echo '"'.$rgg.'"'; ?>><br /> + OTP<sup>∗∗∗</sup>: <input type="text" id="rgp" name="rgp" maxlength="3" style="width:30px" value=<?php echo '"'.$rgp.'"'; ?>><br /> + OTP<sup>∗∗</sup>: <input type="text" id="rot" name="rot" maxlength="3" style="width:30px" value=<?php echo '"'.$rot.'"'; ?>><br /> + OTP<sup>∗</sup>: <input type="text" id="rok1" name="rok1" maxlength="3" style="width:30px" value=<?php echo '"'.$rok1.'"'; ?>><br /> + OTP: <input type="text" id="rok" name="rok" maxlength="3" style="width:30px" value=<?php echo '"'.$rok.'"'; ?>><br /> + Regionalny: <input type="text" id="rtp" name="rtp" maxlength="3" style="width:30px" value=<?php echo '"'.$rtp.'"'; ?>><br /> + Okręgowy: <input type="text" id="rto" name="rto" maxlength="3" style="width:30px" value=<?php echo '"'.$rto.'"'; ?>><br /> + Klubowy: <input type="text" id="rtk" name="rtk" maxlength="3" style="width:30px" value=<?php echo '"'.$rtk.'"'; ?>></td> + <td align="left" rowspan="3"> + <input type="text" id="min1" name="min1" maxlength="3" style="width:30px" value=<?php echo '"'.$min1.'"'; ?>><br /> + <input type="text" id="min2" name="min2" maxlength="3" style="width:30px" value=<?php echo '"'.$min2.'"'; ?>><br /> + <input type="text" id="min3" name="min3" maxlength="3" style="width:30px" value=<?php echo '"'.$min3.'"'; ?>><br /> + <input type="text" id="min4" name="min4" maxlength="3" style="width:30px" value=<?php echo '"'.$min4.'"'; ?>><br /> + <input type="text" id="min5" name="min5" maxlength="3" style="width:30px" value=<?php echo '"'.$min5.'"'; ?>><br /> + <input type="text" id="min6" name="min6" maxlength="3" style="width:30px" value=<?php echo '"'.$min6.'"'; ?>><br /> + <input type="text" id="min7" name="min7" maxlength="3" style="width:30px" value=<?php echo '"'.$min7.'"'; ?>><br /> + <input type="text" id="min8" name="min8" maxlength="3" style="width:30px" value=<?php echo '"'.$min8.'"'; ?>></td> + <td align="right" rowspan="3"> + OTP<sup>∗∗∗∗</sup>: <input type="text" id="rgg_" name="rgg_" maxlength="3" style="width:30px" value=<?php echo '"'.$rgg_.'"'; ?>><br /> + OTP<sup>∗∗∗</sup>: <input type="text" id="rgp_" name="rgp_" maxlength="3" style="width:30px" value=<?php echo '"'.$rgp_.'"'; ?>><br /> + OTP<sup>∗∗</sup>: <input type="text" id="rot_" name="rot_" maxlength="3" style="width:30px" value=<?php echo '"'.$rot_.'"'; ?>><br /> + OTP<sup>∗</sup>: <input type="text" id="rok1_" name="rok1_" maxlength="3" style="width:30px" value=<?php echo '"'.$rok1_.'"'; ?>><br /> + OTP: <input type="text" id="rok_" name="rok_" maxlength="3" style="width:30px" value=<?php echo '"'.$rok_.'"'; ?>><br /> + Regionalny: <input type="text" id="rtp_" name="rtp_" maxlength="3" style="width:30px" value=<?php echo '"'.$rtp_.'"'; ?>><br /> + Okręgowy: <input type="text" id="rto_" name="rto_" maxlength="3" style="width:30px" value=<?php echo '"'.$rto_.'"'; ?>><br /> + Klubowy: <input type="text" id="rtk_" name="rtk_" maxlength="3" style="width:30px" value=<?php echo '"'.$rtk_.'"'; ?>></td> + <td align="left" rowspan="3"> + <input type="text" id="min1_" name="min1_" maxlength="3" style="width:30px" value=<?php echo '"'.$min1_.'"'; ?>><br /> + <input type="text" id="min2_" name="min2_" maxlength="3" style="width:30px" value=<?php echo '"'.$min2_.'"'; ?>><br /> + <input type="text" id="min3_" name="min3_" maxlength="3" style="width:30px" value=<?php echo '"'.$min3_.'"'; ?>><br /> + <input type="text" id="min4_" name="min4_" maxlength="3" style="width:30px" value=<?php echo '"'.$min4_.'"'; ?>><br /> + <input type="text" id="min5_" name="min5_" maxlength="3" style="width:30px" value=<?php echo '"'.$min5_.'"'; ?>><br /> + <input type="text" id="min6_" name="min6_" maxlength="3" style="width:30px" value=<?php echo '"'.$min6_.'"'; ?>><br /> + <input type="text" id="min7_" name="min7_" maxlength="3" style="width:30px" value=<?php echo '"'.$min7_.'"'; ?>><br /> + <input type="text" id="min8_" name="min8_" maxlength="3" style="width:30px" value=<?php echo '"'.$min8_.'"'; ?>></td> + <td align="left" valign="top"><input type="text" id="zaw" name="zaw" maxlength="5" style="width:30px" value=<?php echo '"'.$zaw.'"'; ?>></td> + <td valign="top" colspan="2">PKL za 1 m = <b>śr.WK×WAGA + il.zaw×WSP</b></td> + </tr> + <tr> + <td align="right" valign="top"><br /><br /><br /><br /><input type="text" id="prp1" name="prp1" style="width:18px" value=<?php echo '"'.$progp1.'"'; ?>>%<br /><input type="text" id="prp2" name="prp2" style="width:18px" value=<?php echo '"'.$progp2.'"'; ?>>%</td> + <td colspan="2" align="left"><img src="images/pkle.png"></td> + </tr> + <tr> + <td> </td> + <td colspan="2"><table cellspacing="0" cellpadding="0"><tr><td align="right" style="width:50px"><input type="text" id="pru1" name="pru1" style="width:18px" value=<?php echo '"'.$progu1.'"'; ?>>%</td><td align="right" style="width:25px"><input type="text" id="pru2" name="pru2" style="width:18px" value=<?php echo '"'.$progu2.'"'; ?>>%</td><td align="right" style="width:55px"><input type="text" id="pru3" name="pru3" style="width:18px" value=<?php echo '"'.$progu3.'"'; ?>>%</td></tr></table></td> + </tr> + + <tr><td colspan="5"> </td></tr> + <tr> + <td valign=top rowspan="2">TYP ZAWODÓW<br /> + <input type="radio" name="typ" id="tp1" value="1" onclick="typtur(1)"<?php if( $typ==1 ){ echo ' checked="checked"';}?>><label for="tp1"> Indywiduel</label><br /> + <input type="radio" name="typ" id="tp2" value="2" onclick="typtur(2)"<?php if( $typ==2 ){ echo ' checked="checked"';}?>><label for="tp2"> Pary</label><br /> + <input type="radio" name="typ" id="tp3" value="4" onclick="typtur(4)"<?php if( $typ==4 ){ echo ' checked="checked"';}?>><label for="tp3"> Teamy</label> + <br><br>LICZBA ROZDAŃ<br> + <input type="radio" name="rozdan" id="rozdan0" value="0"<?php if( !$rozdan ){ echo ' checked="checked"';}?>><label for="rozdan0"> do 39</label><br /> + <input type="radio" name="rozdan" id="rozdan1" value="1"<?php if( $rozdan ){ echo ' checked="checked"';}?>><label for="rozdan1"> od 40</label> + </td> + <td valign=top rowspan="2">RANGA ZAWODÓW<br /> + <input type="radio" name="rng" id="rg1" value="1"<?php if( $_POST['rng']==1 ){echo ' checked="checked"';}?>><label for="rg1"> OTP<sup>∗∗∗∗</sup></label><br /> + <input type="radio" name="rng" id="rg2" value="2"<?php if( $_POST['rng']==2 ){echo ' checked="checked"';}?>><label for="rg2"> OTP<sup>∗∗∗</sup></label><br /> + <input type="radio" name="rng" id="rg3" value="3"<?php if( $_POST['rng']==3 ){echo ' checked="checked"';}?>><label for="rg3"> OTP<sup>∗∗</sup></label><br /> + <input type="radio" name="rng" id="rg4" value="4"<?php if( $_POST['rng']==4 ){echo ' checked="checked"';}?>><label for="rg4"> OTP<sup>∗</sup></label><br /> + <input type="radio" name="rng" id="rg5" value="5"<?php if( $_POST['rng']==5 ){echo ' checked="checked"';}?>><label for="rg5"> OTP</label><br /> + <input type="radio" name="rng" id="rg6" value="6"<?php if( $_POST['rng']==6 ){echo ' checked="checked"';}?>><label for="rg6"> Regionalny</label><br /> + <input type="radio" name="rng" id="rg7" value="7"<?php if( $_POST['rng']==7 ){echo ' checked="checked"';}?>><label for="rg7"> Okręgowy</label><br /> + <input type="radio" name="rng" id="rg8" value="8"<?php if( $_POST['rng']==8 ){echo ' checked="checked"';}?>><label for="rg8"> Klubowy</label></td> + <td align="CENTER" valign=top>UCZESTNIKÓW<br /> + <input type="text" id="iuc" name="iuc" maxlength="3" style="width:50px" onblur="valiuc(this,1)"<?php if( $iuc>0 ){echo ' value="'.$iuc.'"';}?>><br /> + <small>W zależności od typu<br />ilość indywidualistów,<br />par lub teamów</small></td> + <td align="CENTER" valign=top>ZAWODNIKÓW<br /> + <input type="text" id="izw" name="izw" readonly="readonly" maxlength="4" style="width:50px" onblur="valiuc(this,2)"<?php if( $izw>0 ){echo ' value="'.$izw.'"';}?>><br /> + <small>To pole jest wyliczane<br />automatycznie.</small></td> + <td align="CENTER" valign=top>SUMA WK<br /> + <input type="text" id="swk" name="swk" maxlength="7" style="width:70px" onblur="valiuc(this,3)"<?php if( $swk>0 ){echo ' value="'.$swk.'"';}?>><br /> + <small>Suma WK wszystkich<br />zawodników.</small></td> + </tr> + <tr> + <td align="CENTER" colspan="3">Średnie WK zawodnika w turnieju: + <input type="text" id="srd" name="srd" readonly="readonly"<?php if( $izw>0 ){echo ' value="'.($swk/$izw > 0.15 ? $swk/$izw : 0.15).'"';}?>><br /> + </td> + </tr> + <tr><td colspan="5"> </td></tr> + <tr> + <td align="CENTER" colspan="2"> + <input type="button" value="Policz PKLe" onclick="submitit()"></td> + <td colspan="3"> +<?php +if( $tab>0 ){ + echo '<input type="button" value="SQL dla JFR Pary" onclick="document.getElementById(\'outsql\').style.display=(document.getElementById(\'outsql\').style.display==\'none\') ? \'block\' : \'none\';"> + <input type="button" value="SQL dla JFR Teamy" onclick="document.getElementById(\'outsql2\').style.display=(document.getElementById(\'outsql2\').style.display==\'none\') ? \'block\' : \'none\';">'; +} else { + echo ' '; +} +?> + </td> + </tr> + <tr><td colspan="2" align="center"> +<?php +if( $tab>0 ){ + unset( $tabpkl ); + $lasti = 0; + echo '<table><tr><td class="t">Miejsce</td><td class="t"> PKL </td>'; + echo '</tr>'; + $max = ceil(($swk/$izw)*$rng + $izw*$zaw); + if( $max<$minpkl ) $max = $minpkl; + $prem = 0; + $zni = 1; + switch( $typ ){ + case 2: + $zni = 2; + break; + case 4: + $zni = 4; + break; + } + if( $prem>0 ){ + $d = 2; + } else { + $d = 0; + } + $maxold = ceil($prcold*$izw + 0.05*$swk); + $progu1 = $progu1*$iuc*0.01+1; + $progu2 = $progu2*$iuc*0.01+1; + $progu3 = $progu3*$iuc*0.01+1; // 0 pkl za ostatnie punktowane+1 + $progp1 = $max*$progp1*0.01; + $progp2 = $max*$progp2*0.01; + $sumn = 0 ; + $sumo = 0; + $i = 0; + $dok = 1 - 1e-6; // unikamy błędu ceil(2)=3; + do{ + $i++; + if( $i<=$progu1 ){ + $p = $progp1+($max-$progp1)*($progu1-$i)/($progu1-1); + } + elseif( $i<=$progu2 ){ + $p = $progp2+($progp1-$progp2)*($progu2-$i)/($progu2-$progu1); + } + elseif( $i<$progu3 ){ + $p = $progp3+($progp2-$progp3)*($progu3-$i)/($progu3-$progu2); + } + else $p=0; + if( ($p>0) ){ + echo '<tr><td class="t">'.$i.'</td>'; + if( $p>0 ){ + $pkl_temp = ceil($p); + if (($pkl_temp - $p) < $dok){ + $p = $pkl_temp; + } else { + $p = round($p); + } + $tabkl[$i] = $p; + $lasti = $i; + echo '<td class="t">'.$p.'</td>'; + $sumn = $sumn + $p; + } else { + echo '<td class="p"> </td>'; + } + echo '</tr>'; + } + } while( (($p>0) || ($maxold>0)) && ($i<$iuc) ); + echo '<tr><td class="p">SUMA PKL</td><td class="t">'.$typ*$sumn.'</td></tr>'; + echo '</table>'; +} else { + echo ' '; +} +?> +</td><td colspan="3" valign="top"><span id="outsql" style="display: none"> +<?php +echo "UPDATE `dodatki` SET `pkl`=0;<br />\r\n"; +for( $i=1; $i<=$lasti; $i++){ + echo "UPDATE `dodatki` SET `pkl`=".$tabkl[$i]." WHERE `miejsce`=".$i.";<br />\r\n"; +} +?> +</span></td> +<td colspan="3" valign="top"><span id="outsql2" style="display: none"> +<?php +echo "UPDATE `addons` SET `mastr`=0;<br />\r\n"; +for( $i=1; $i<=$lasti; $i++){ + echo "UPDATE `addons` SET `mastr`=".$tabkl[$i]." WHERE `place`=".$i.";<br />\r\n"; +} +?> +</span></td></tr> +<tr><td colspan="5" class="copyright">©'2009, Jan Romański dla PZBS</td></tr> +</table> +</form> +</body> +</html> diff --git a/pkle2018-test.php b/pkle2018-test.php new file mode 100644 index 0000000..9e60c70 --- /dev/null +++ b/pkle2018-test.php @@ -0,0 +1,630 @@ +<?php +$tabpkl = array(); +$typ = 0; +$rng = 0; +$xrng = 0; +$iuc = 0; +$izw = 0; +$swk = 0; +$tab = 0; +$minpkl = 0; + +$min1 = 200; +$min2 = 150; +$min3 = 75; +$min4 = 50; +$min5 = 0; +$min6 = 0; +$min7 = 0; +$min8 = 0; + +$min1_ = 300; +$min2_ = 200; +$min3_ = 100; +$min4_ = 70; +$min5_ = 0; +$min6_ = 0; +$min7_ = 0; +$min8_ = 0; +$rozdan3 = 30; + +// regulamin +$progu0 = 0; +$progp0 = 100; + +$progu1 = 2; // dla pierwszych progu1% uczestników +$progp1 = 90; // ostatni dostaje progp1% maximum punktów + +$progu2 = 20; // dla kolejnych (progu2-progu1)% uczestników +$progp2 = 20; // ostatni dostaje 10*progp2% maximum punktów + +$progu3 = 50; // dla kolejnych (progu3-progu2)% uczestników +$progp3 = 0; // ostatni dostaje 10*progp3% maximum punktów + + +$rgg = 25; // OTP**** +$rgp = 15; // OTP*** +$rot = 10; // OTP** +$rok1 = 7; // OTP* +$rok = 5; // OTP +$rtp = 4; // RTP +$rto = 2; // okregowy +$rtk = 1; // klubowy + +$rgg_ = 40; // OTP**** +$rgp_ = 25; // OTP*** +$rot_ = 15; // OTP** +$rok1_ = 10; // OTP* +$rok_ = 7; // OTP +$rtp_ = 5; // RTP +$rto_ = 3; // okregowy +$rtk_ = 2; // klubowy + +$zaw = 0.05; +$dajp = 0; + +/*if( $_SERVER['REQUEST_METHOD'] == 'GET' ){ +// ?typtur=[1,2,4]&uczest=IU&sumawk=SWK&ranga=[1..9] +// I P T GP..KLUB + $l = 0; + $rozdan = $_GET['rozdan']; + if( isset($_GET['typtur']) ){ + $typ = $_GET['typtur']; + $l = 1; + } + if( isset($_GET['uczest']) ){ + $iuc = $_GET['uczest']; + $l = $l + 1; + } + if( isset($_GET['sumawk']) ){ + $swk = $_GET['sumawk']; + $l = $l + 1; + } + if( isset($_GET['ranga']) ){ + $rng = $_GET['ranga']; + switch( $rng ){ + case 1: + $rng = $rgg; + $xrng = $xrgg; + $minpkl = $min1; + break; + case 2: + $rng = $rgp; + $xrng = $xrgp; + $minpkl = $min2; + break; + case 3: + $rng = $rot; + $xrng = $xrot; + $minpkl = $min3; + break; + case 4: + $rng = $rok; + $xrng = $xrok; + $minpkl = $min4; + break; + case 5: + $rng = $r40; + $xrng = $xr40; + $minpkl = $min5; + break; + case 6: + $rng = $rtp; + $xrng = $xrtp; + $minpkl = $min6; + break; + case 7: + $rng = $rtd; + $xrng = $xrtd; + $minpkl = $mind; + break; + case 8: + $rng = $rtr; + $xrng = $xrtr; + $minpkl = $min7; + break; + case 9: + $rng = $rto; + $xrng = $xrto; + $minpkl = $min8; + break; + case 10: + $rng = $rtk; + $xrng = $xrtk; + $minpkl = $min9; + break; + } + if( $rng ) $l = $l + 1; + } + if( $typ>2 ) $typ = 4; + $izw = $typ*$iuc; + if( $izw > 99 ){ + $dajp = 1; + } + if( $l > 3 ) $tab = 1; +} +else*/if( $_SERVER['REQUEST_METHOD'] == 'POST' ){ + $rozdan = $_POST['rozdan']; + + $progu1 = $_POST['pru1']; // dla pierwszych progu1% uczestników + $progp1 = $_POST['prp1']; // ostatni dostaje progp1% maximum punktów + $progu2 = $_POST['pru2']; // dla kolejnych (progu2-progu1)% uczestników + $progp2 = $_POST['prp2']; // ostatni dostaje 10*progp2% maximum punktów + $progu3 = $_POST['pru3']; // dla kolejnych (progu3-progu2)% uczestników + $rgg = $_POST['rgg']; + $rgp = $_POST['rgp']; + $rot = $_POST['rot']; + $rok1 = $_POST['rok1']; + $rok = $_POST['rok']; + $rtp = $_POST['rtp']; + $rto = $_POST['rto']; + $rtk = $_POST['rtk']; + $rgg_ = $_POST['rgg_']; + $rgp_ = $_POST['rgp_']; + $rot_ = $_POST['rot_']; + $rok1_ = $_POST['rok1_']; + $rok_ = $_POST['rok_']; + $rtp_ = $_POST['rtp_']; + $rto_ = $_POST['rto_']; + $rtk_ = $_POST['rtk_']; + $rozdan3 = $_POST['rozdan3']; + + $typ = $_POST['typ']; + $rng = $_POST['rng']; + $zaw = $_POST['zaw']; + $min1 = $_POST['min1']; + $min2 = $_POST['min2']; + $min3 = $_POST['min3']; + $min4 = $_POST['min4']; + $min5 = $_POST['min5']; + $min6 = $_POST['min6']; + $min7 = $_POST['min7']; + $min8 = $_POST['min8']; + $min1_ = $_POST['min1_']; + $min2_ = $_POST['min2_']; + $min3_ = $_POST['min3_']; + $min4_ = $_POST['min4_']; + $min5_ = $_POST['min5_']; + $min6_ = $_POST['min6_']; + $min7_ = $_POST['min7_']; + $min8_ = $_POST['min8_']; + if($rozdan == 0): + switch( $rng ){ + case 1: + $rng = $rgg; + $minpkl = $min1; + break; + case 2: + $rng = $rgp; + $minpkl = $min2; + break; + case 3: + $rng = $rot; + $minpkl = $min3; + break; + case 4: + $rng = $rok1; + $minpkl = $min4; + break; + case 5: + $rng = $rok; + $minpkl = $min5; + break; + case 6: + $rng = $rtp; + $minpkl = $min6; + break; + case 7: + $rng = $rto; + $minpkl = $min7; + break; + case 8: + $rng = $rtk; + $minpkl = $min8; + break; + } + + elseif ($rozdan == 2): + switch( $rng ){ + case 1: + $rng = $rgg; + $minpkl = $min1_; + break; + case 2: + $rng = $rgp; + $minpkl = $min2_; + break; + case 3: + $rng = $rot; + $minpkl = $min3_; + break; + case 4: + $rng = $rok1; + $minpkl = $min4_; + break; + case 5: + $rng = $rok; + $minpkl = $min5_; + break; + case 6: + $rng = $rtp; + $minpkl = $min6_; + break; + case 7: + $rng = $rto; + $minpkl = $min7_; + break; + case 8: + $rng = $rtk; + $minpkl = $min8_; + break; + } + + else: + switch( $rng ){ + case 1: + $rng = $rgg_; + $minpkl = $min1_; + break; + case 2: + $rng = $rgp_; + $minpkl = $min2_; + break; + case 3: + $rng = $rot_; + $minpkl = $min3_; + break; + case 4: + $rng = $rok1_; + $minpkl = $min4_; + break; + case 5: + $rng = $rok_; + $minpkl = $min5_; + break; + case 6: + $rng = $rtp_; + $minpkl = $min6_; + break; + case 7: + $rng = $rto_; + $minpkl = $min7_; + break; + case 8: + $rng = $rtk_; + $minpkl = $min8_; + break; + } + endif; + $iuc = $_POST['iuc']; + if( $typ>2 ) $typ = 4; + $izw = $typ*$iuc; + if( $izw > 99 ){ + $dajp = 1; + } + $swk = $_POST['swk']; + $tab = 1; +} +?> +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> +<html> +<head> +<meta http-equiv="pragma" content="no-cache"> +<meta http-equiv="cache-control" content="no-cache"> +<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> +<title>Kargulator PKLi</title> +<link rel="stylesheet" href="style.css" type="text/css"> +<link rel="icon" href="images/favicon.ico" type="image/x-icon"> +<link rel="shortcut icon" href="images/favicon.ico" type="image/x-icon"> +<script type="text/javascript"> +<!-- +function valiuc(x,y){ + if( !(x.value==null || x.value=='') ){ + x.value = x.value.replace(',','.'); + if( isFinite(x.value)){ + if( y==1 ){ + if( document.getElementsByName("typ")[0].checked ){ + document.getElementById("izw").value = x.value; + } else { + if( document.getElementsByName("typ")[1].checked ){ + document.getElementById("izw").value = 2 * x.value; + } else { + if( document.getElementsByName("typ")[2].checked ){ + document.getElementById("izw").value = 4 * x.value; + } + } + } + } + if( y==3 ){ + var z = document.getElementById('izw'); + if( valiuc(z,2) ){ + var srednieWk = x.value/z.value; + if(srednieWk < 0.15) srednieWk = 0.15; + document.getElementById('srd').value = srednieWk; + } + } + return true; + } else { + alert(x.value+' to nie liczba!'); + x.select(); + x.focus(); + return false; + } + } +} + +function typtur(x){ + var t = document.getElementById("iuc"); + var z = document.getElementById("izw"); + if( t.value!=null && t.value!='' && isFinite(t.value) ){ + z.value = x * t.value; + } +} + +function submitit(){ + if( document.getElementsByName("typ")[0].checked || + document.getElementsByName("typ")[1].checked || + document.getElementsByName("typ")[2].checked ){ + if( document.getElementsByName("rng")[0].checked || + document.getElementsByName("rng")[1].checked || + document.getElementsByName("rng")[2].checked || + document.getElementsByName("rng")[3].checked || + document.getElementsByName("rng")[4].checked || + document.getElementsByName("rng")[5].checked || + document.getElementsByName("rng")[6].checked || + document.getElementsByName("rng")[7].checked || + document.getElementsByName("rng")[8].checked || + document.getElementsByName("rng")[9].checked ){ + var t = document.getElementById("iuc") + if( t.value!=null && t.value!='' && isFinite(t.value) ){ + t = document.getElementById("izw"); + if( t.value!=null && t.value!='' && isFinite(t.value) ){ + t = document.getElementById("swk"); + if( t.value!=null && t.value!='' && isFinite(t.value) ){ + + document.getElementById("pkl").submit(); + + } else { + alert('Brak sumy WK!'); + t.select(); + } + } else { + alert('Brak liczby zawodników!'); + t.select(); + } + } else { + alert('Brak liczby uczestników!'); + t.select(); + } + } else { + alert('Wybierz rangę turnieju'); + document.getElementsByName("rng")[0].select(); + } + } else { + alert('Wybierz typ turnieju'); + document.getElementsByName("typ")[0].select(); + } +} +--> +</script> +</head> +<body style="background-color: #E0E0E0; background-image: none"> +<form id="pkl" method="post" action="pkle2018-test.php"> +<table border="0" cellspacing="0" cellpadding="0"> + <tr> + <td><img src="images/logo_pzbs.gif"></td> + <td colspan="3" align="center"><h3>PROPOZYCJA KALKULATORA<br> + zgodnego z propozycją aktualzacji Regulaminu Klasyfikacyjnego</h3> + <img src="regKLas.gif" width="500px"/><br> + W "LICZBA ROZDAŃ" wybierz opcję "nowyRK" i podaj liczbę<br> rozdań żeby skorzystać z nowych zasad + + <td><img src="images/logo_pzbs.gif"></td> + </tr> + <tr><td colspan="5"> </td></tr> + <tr> + <td align="center" colspan="2"><b>turniej do 39 rozdań</b><br><i>(wagi w nowyRK)</i></td> + <td align="center" colspan="2"><b>turniej od 40 rozdań</b><br><i>(minimum w nowyRK)</i></td> + </tr> + <tr> + <td align="right">WAGA<br>turnieju</td><td align="left">MINIMUM<br>za 1sze miejsce</td> + <td align="right">WAGA<br>turnieju</td><td align="left">MINIMUM<br>za 1sze miejsce</td> + <td align="left" colspan="3">WSP:</td> + </tr> + <tr> + <td align="right" rowspan="3"> + OTP<sup>∗∗∗∗</sup>: <input type="text" id="rgg" name="rgg" maxlength="3" style="width:30px" value=<?php echo '"'.$rgg.'"'; ?>><br /> + OTP<sup>∗∗∗</sup>: <input type="text" id="rgp" name="rgp" maxlength="3" style="width:30px" value=<?php echo '"'.$rgp.'"'; ?>><br /> + OTP<sup>∗∗</sup>: <input type="text" id="rot" name="rot" maxlength="3" style="width:30px" value=<?php echo '"'.$rot.'"'; ?>><br /> + OTP<sup>∗</sup>: <input type="text" id="rok1" name="rok1" maxlength="3" style="width:30px" value=<?php echo '"'.$rok1.'"'; ?>><br /> + OTP: <input type="text" id="rok" name="rok" maxlength="3" style="width:30px" value=<?php echo '"'.$rok.'"'; ?>><br /> + Regionalny: <input type="text" id="rtp" name="rtp" maxlength="3" style="width:30px" value=<?php echo '"'.$rtp.'"'; ?>><br /> + Okręgowy: <input type="text" id="rto" name="rto" maxlength="3" style="width:30px" value=<?php echo '"'.$rto.'"'; ?>><br /> + Klubowy: <input type="text" id="rtk" name="rtk" maxlength="3" style="width:30px" value=<?php echo '"'.$rtk.'"'; ?>></td> + <td align="left" rowspan="3"> + <input type="text" id="min1" name="min1" maxlength="3" style="width:30px" value=<?php echo '"'.$min1.'"'; ?>><br /> + <input type="text" id="min2" name="min2" maxlength="3" style="width:30px" value=<?php echo '"'.$min2.'"'; ?>><br /> + <input type="text" id="min3" name="min3" maxlength="3" style="width:30px" value=<?php echo '"'.$min3.'"'; ?>><br /> + <input type="text" id="min4" name="min4" maxlength="3" style="width:30px" value=<?php echo '"'.$min4.'"'; ?>><br /> + <input type="text" id="min5" name="min5" maxlength="3" style="width:30px" value=<?php echo '"'.$min5.'"'; ?>><br /> + <input type="text" id="min6" name="min6" maxlength="3" style="width:30px" value=<?php echo '"'.$min6.'"'; ?>><br /> + <input type="text" id="min7" name="min7" maxlength="3" style="width:30px" value=<?php echo '"'.$min7.'"'; ?>><br /> + <input type="text" id="min8" name="min8" maxlength="3" style="width:30px" value=<?php echo '"'.$min8.'"'; ?>></td> + <td align="right" rowspan="3"> + OTP<sup>∗∗∗∗</sup>: <input type="text" id="rgg_" name="rgg_" maxlength="3" style="width:30px" value=<?php echo '"'.$rgg_.'"'; ?>><br /> + OTP<sup>∗∗∗</sup>: <input type="text" id="rgp_" name="rgp_" maxlength="3" style="width:30px" value=<?php echo '"'.$rgp_.'"'; ?>><br /> + OTP<sup>∗∗</sup>: <input type="text" id="rot_" name="rot_" maxlength="3" style="width:30px" value=<?php echo '"'.$rot_.'"'; ?>><br /> + OTP<sup>∗</sup>: <input type="text" id="rok1_" name="rok1_" maxlength="3" style="width:30px" value=<?php echo '"'.$rok1_.'"'; ?>><br /> + OTP: <input type="text" id="rok_" name="rok_" maxlength="3" style="width:30px" value=<?php echo '"'.$rok_.'"'; ?>><br /> + Regionalny: <input type="text" id="rtp_" name="rtp_" maxlength="3" style="width:30px" value=<?php echo '"'.$rtp_.'"'; ?>><br /> + Okręgowy: <input type="text" id="rto_" name="rto_" maxlength="3" style="width:30px" value=<?php echo '"'.$rto_.'"'; ?>><br /> + Klubowy: <input type="text" id="rtk_" name="rtk_" maxlength="3" style="width:30px" value=<?php echo '"'.$rtk_.'"'; ?>></td> + <td align="left" rowspan="3"> + <input type="text" id="min1_" name="min1_" maxlength="3" style="width:30px" value=<?php echo '"'.$min1_.'"'; ?>><br /> + <input type="text" id="min2_" name="min2_" maxlength="3" style="width:30px" value=<?php echo '"'.$min2_.'"'; ?>><br /> + <input type="text" id="min3_" name="min3_" maxlength="3" style="width:30px" value=<?php echo '"'.$min3_.'"'; ?>><br /> + <input type="text" id="min4_" name="min4_" maxlength="3" style="width:30px" value=<?php echo '"'.$min4_.'"'; ?>><br /> + <input type="text" id="min5_" name="min5_" maxlength="3" style="width:30px" value=<?php echo '"'.$min5_.'"'; ?>><br /> + <input type="text" id="min6_" name="min6_" maxlength="3" style="width:30px" value=<?php echo '"'.$min6_.'"'; ?>><br /> + <input type="text" id="min7_" name="min7_" maxlength="3" style="width:30px" value=<?php echo '"'.$min7_.'"'; ?>><br /> + <input type="text" id="min8_" name="min8_" maxlength="3" style="width:30px" value=<?php echo '"'.$min8_.'"'; ?>></td> + <td align="left" valign="top"><input type="text" id="zaw" name="zaw" maxlength="5" style="width:30px" value=<?php echo '"'.$zaw.'"'; ?>></td> + <td valign="top" colspan="2">PKL za 1 m = <b>sprawdź w mailu</b></td> + </tr> + <tr> + <td align="right" valign="top"><br /><br /><br /><br /><input type="text" id="prp1" name="prp1" style="width:18px" value=<?php echo '"'.$progp1.'"'; ?>>%<br /><input type="text" id="prp2" name="prp2" style="width:18px" value=<?php echo '"'.$progp2.'"'; ?>>%</td> + <td colspan="2" align="left"><img src="images/pkle.png"></td> + </tr> + <tr> + <td> </td> + <td colspan="2"><table cellspacing="0" cellpadding="0"><tr><td align="right" style="width:50px"><input type="text" id="pru1" name="pru1" style="width:18px" value=<?php echo '"'.$progu1.'"'; ?>>%</td><td align="right" style="width:25px"><input type="text" id="pru2" name="pru2" style="width:18px" value=<?php echo '"'.$progu2.'"'; ?>>%</td><td align="right" style="width:55px"><input type="text" id="pru3" name="pru3" style="width:18px" value=<?php echo '"'.$progu3.'"'; ?>>%</td></tr></table></td> + </tr> + + <tr><td colspan="5"> </td></tr> + <tr> + <td valign=top rowspan="2">TYP ZAWODÓW<br /> + <input type="radio" name="typ" id="tp1" value="1" onclick="typtur(1)"<?php if( $typ==1 ){ echo ' checked="checked"';}?>><label for="tp1"> Indywiduel</label><br /> + <input type="radio" name="typ" id="tp2" value="2" onclick="typtur(2)"<?php if( $typ==2 ){ echo ' checked="checked"';}?>><label for="tp2"> Pary</label><br /> + <input type="radio" name="typ" id="tp3" value="4" onclick="typtur(4)"<?php if( $typ==4 ){ echo ' checked="checked"';}?>><label for="tp3"> Teamy</label> + <br><br>LICZBA ROZDAŃ<br> + <input type="radio" name="rozdan" id="rozdan0" value="0"<?php if( !$rozdan ){ echo ' checked="checked"';}?>><label for="rozdan0"> do 39</label><br /> + <input type="radio" name="rozdan" id="rozdan1" value="1"<?php if( $rozdan ){ echo ' checked="checked"';}?>><label for="rozdan1"> od 40</label> <br /> + <input type="radio" name="rozdan" id="rozdan2" value="2"<?php if( $rozdan == 2 ){ echo ' checked="checked"';}?>><label style="border-bottom: 3px solid red" for="rozdan2"> nowyRK</label> + <input type="text" name="rozdan3" id="rozdan3" maxlength="3" style="width:25px" <?php if( $rozdan3>0 ){echo ' value="'.$rozdan3.'"';}?>> + </td> + <td valign=top rowspan="2">RANGA ZAWODÓW<br /> + <input type="radio" name="rng" id="rg1" value="1"<?php if( $_POST['rng']==1 ){echo ' checked="checked"';}?>><label for="rg1"> OTP<sup>∗∗∗∗</sup></label><br /> + <input type="radio" name="rng" id="rg2" value="2"<?php if( $_POST['rng']==2 ){echo ' checked="checked"';}?>><label for="rg2"> OTP<sup>∗∗∗</sup></label><br /> + <input type="radio" name="rng" id="rg3" value="3"<?php if( $_POST['rng']==3 ){echo ' checked="checked"';}?>><label for="rg3"> OTP<sup>∗∗</sup></label><br /> + <input type="radio" name="rng" id="rg4" value="4"<?php if( $_POST['rng']==4 ){echo ' checked="checked"';}?>><label for="rg4"> OTP<sup>∗</sup></label><br /> + <input type="radio" name="rng" id="rg5" value="5"<?php if( $_POST['rng']==5 ){echo ' checked="checked"';}?>><label for="rg5"> OTP</label><br /> + <input type="radio" name="rng" id="rg6" value="6"<?php if( $_POST['rng']==6 ){echo ' checked="checked"';}?>><label for="rg6"> Regionalny</label><br /> + <input type="radio" name="rng" id="rg7" value="7"<?php if( $_POST['rng']==7 ){echo ' checked="checked"';}?>><label for="rg7"> Okręgowy</label><br /> + <input type="radio" name="rng" id="rg8" value="8"<?php if( $_POST['rng']==8 ){echo ' checked="checked"';}?>><label for="rg8"> Klubowy</label></td> + <td align="CENTER" valign=top>UCZESTNIKÓW<br /> + <input type="text" id="iuc" name="iuc" maxlength="3" style="width:50px" onblur="valiuc(this,1)"<?php if( $iuc>0 ){echo ' value="'.$iuc.'"';}?>><br /> + <small>W zależności od typu<br />ilość indywidualistów,<br />par lub teamów</small></td> + <td align="CENTER" valign=top>ZAWODNIKÓW<br /> + <input type="text" id="izw" name="izw" readonly="readonly" maxlength="4" style="width:50px" onblur="valiuc(this,2)"<?php if( $izw>0 ){echo ' value="'.$izw.'"';}?>><br /> + <small>To pole jest wyliczane<br />automatycznie.</small></td> + <td align="CENTER" valign=top>SUMA WK<br /> + <input type="text" id="swk" name="swk" maxlength="7" style="width:70px" onblur="valiuc(this,3)"<?php if( $swk>0 ){echo ' value="'.$swk.'"';}?>><br /> + <small>Suma WK wszystkich<br />zawodników.</small></td> + </tr> + <tr> + <td align="CENTER" colspan="3">Średnie WK zawodnika w turnieju: + <input type="text" id="srd" name="srd" readonly="readonly"<?php if( $izw>0 ){echo ' value="'.($swk/$izw > 0.15 ? $swk/$izw : 0.15).'"';}?>><br /> + </td> + </tr> + <tr><td colspan="5"> </td></tr> + <tr> + <td align="CENTER" colspan="2"> + <input type="button" value="Policz PKLe" onclick="submitit()"></td> + <td colspan="3"> +<?php +if( $tab>0 ){ + echo '<input type="button" value="SQL dla JFR Pary" onclick="document.getElementById(\'outsql\').style.display=(document.getElementById(\'outsql\').style.display==\'none\') ? \'block\' : \'none\';"> + <input type="button" value="SQL dla JFR Teamy" onclick="document.getElementById(\'outsql2\').style.display=(document.getElementById(\'outsql2\').style.display==\'none\') ? \'block\' : \'none\';">'; +} else { + echo ' '; +} +?> + </td> + </tr> + <tr><td colspan="2" align="center"> +<?php +if( $tab>0 ){ + unset( $tabpkl ); + $lasti = 0; + echo '<table><tr><td class="t">Miejsce</td><td class="t"> PKL </td>'; + echo '</tr>'; + if ($rozdan == 2) { + $max = ceil(($swk/$izw)*$rng + $izw*$zaw); + $max = pow(log(($rozdan3/2-5),10),2)*$max; + } + else { + $max = ceil(($swk/$izw)*$rng + $izw*$zaw); + } + if( $max<$minpkl ) $max = $minpkl; + $prem = 0; + $zni = 1; + switch( $typ ){ + case 2: + $zni = 2; + break; + case 4: + $zni = 4; + break; + } + if( $prem>0 ){ + $d = 2; + } else { + $d = 0; + } + $maxold = ceil($prcold*$izw + 0.05*$swk); + $progu1 = $progu1*$iuc*0.01+1; + $progu2 = $progu2*$iuc*0.01+1; + $progu3 = $progu3*$iuc*0.01+1; // 0 pkl za ostatnie punktowane+1 + $progp1 = $max*$progp1*0.01; + $progp2 = $max*$progp2*0.01; + $sumn = 0 ; + $sumo = 0; + $i = 0; + $dok = 1 - 1e-6; // unikamy błędu ceil(2)=3; + do{ + $i++; + if( $i<=$progu1 ){ + $p = $progp1+($max-$progp1)*($progu1-$i)/($progu1-1); + } + elseif( $i<=$progu2 ){ + $p = $progp2+($progp1-$progp2)*($progu2-$i)/($progu2-$progu1); + } + elseif( $i<$progu3 ){ + $p = $progp3+($progp2-$progp3)*($progu3-$i)/($progu3-$progu2); + } + else $p=0; + if( ($p>0) ){ + echo '<tr><td class="t">'.$i.'</td>'; + if( $p>0 ){ + $pkl_temp = ceil($p); + if (($pkl_temp - $p) < $dok){ + $p = $pkl_temp; + } else { + $p = round($p); + } + $tabkl[$i] = $p; + $lasti = $i; + echo '<td class="t">'.$p.'</td>'; + $sumn = $sumn + $p; + } else { + echo '<td class="p"> </td>'; + } + echo '</tr>'; + } + } while( (($p>0) || ($maxold>0)) && ($i<$iuc) ); + echo '<tr><td class="p">SUMA PKL</td><td class="t">'.$typ*$sumn.'</td><td>+ dla reszty po 1</td></tr>'; + echo '</table>'; +} else { + echo ' '; +} +?> +</td><td colspan="3" valign="top"><span id="outsql" style="display: none"> +<?php +echo "UPDATE `dodatki` SET `pkl`=1;<br />\r\n"; +for( $i=1; $i<=$lasti; $i++){ + echo "UPDATE `dodatki` SET `pkl`=".$tabkl[$i]." WHERE `miejsce`=".$i.";<br />\r\n"; +} +?> +</span></td> +<td colspan="3" valign="top"><span id="outsql2" style="display: none"> +<?php +echo "UPDATE `addons` SET `mastr`=1;<br />\r\n"; +for( $i=1; $i<=$lasti; $i++){ + echo "UPDATE `addons` SET `mastr`=".$tabkl[$i]." WHERE `place`=".$i.";<br />\r\n"; +} +?> +</span></td></tr> +<tr><td colspan="5" class="copyright">©'2009, Jan Romański dla PZBS</td></tr> +</table> +</form> +</body> +</html> diff --git a/pkle2018.php b/pkle2018.php new file mode 100644 index 0000000..a851ead --- /dev/null +++ b/pkle2018.php @@ -0,0 +1,588 @@ +<?php +$tabpkl = array(); +$typ = 0; +$rng = 0; +$xrng = 0; +$iuc = 0; +$izw = 0; +$swk = 0; +$tab = 0; +$minpkl = 0; + +$min1 = 200; +$min2 = 150; +$min3 = 75; +$min4 = 50; +$min5 = 0; +$min6 = 0; +$min7 = 0; +$min8 = 0; + +$min1_ = 300; +$min2_ = 200; +$min3_ = 100; +$min4_ = 70; +$min5_ = 0; +$min6_ = 0; +$min7_ = 0; +$min8_ = 0; + +// regulamin +$progu0 = 0; +$progp0 = 100; + +$progu1 = 2; // dla pierwszych progu1% uczestników +$progp1 = 90; // ostatni dostaje progp1% maximum punktów + +$progu2 = 20; // dla kolejnych (progu2-progu1)% uczestników +$progp2 = 20; // ostatni dostaje 10*progp2% maximum punktów + +$progu3 = 50; // dla kolejnych (progu3-progu2)% uczestników +$progp3 = 0; // ostatni dostaje 10*progp3% maximum punktów + + +$rgg = 25; // OTP**** +$rgp = 15; // OTP*** +$rot = 10; // OTP** +$rok1 = 7; // OTP* +$rok = 5; // OTP +$rtp = 4; // RTP +$rto = 2; // okregowy +$rtk = 1; // klubowy + +$rgg_ = 40; // OTP**** +$rgp_ = 25; // OTP*** +$rot_ = 15; // OTP** +$rok1_ = 10; // OTP* +$rok_ = 7; // OTP +$rtp_ = 5; // RTP +$rto_ = 3; // okregowy +$rtk_ = 2; // klubowy + +$zaw = 0.05; +$dajp = 0; + +/*if( $_SERVER['REQUEST_METHOD'] == 'GET' ){ +// ?typtur=[1,2,4]&uczest=IU&sumawk=SWK&ranga=[1..9] +// I P T GP..KLUB + $l = 0; + $rozdan = $_GET['rozdan']; + if( isset($_GET['typtur']) ){ + $typ = $_GET['typtur']; + $l = 1; + } + if( isset($_GET['uczest']) ){ + $iuc = $_GET['uczest']; + $l = $l + 1; + } + if( isset($_GET['sumawk']) ){ + $swk = $_GET['sumawk']; + $l = $l + 1; + } + if( isset($_GET['ranga']) ){ + $rng = $_GET['ranga']; + switch( $rng ){ + case 1: + $rng = $rgg; + $xrng = $xrgg; + $minpkl = $min1; + break; + case 2: + $rng = $rgp; + $xrng = $xrgp; + $minpkl = $min2; + break; + case 3: + $rng = $rot; + $xrng = $xrot; + $minpkl = $min3; + break; + case 4: + $rng = $rok; + $xrng = $xrok; + $minpkl = $min4; + break; + case 5: + $rng = $r40; + $xrng = $xr40; + $minpkl = $min5; + break; + case 6: + $rng = $rtp; + $xrng = $xrtp; + $minpkl = $min6; + break; + case 7: + $rng = $rtd; + $xrng = $xrtd; + $minpkl = $mind; + break; + case 8: + $rng = $rtr; + $xrng = $xrtr; + $minpkl = $min7; + break; + case 9: + $rng = $rto; + $xrng = $xrto; + $minpkl = $min8; + break; + case 10: + $rng = $rtk; + $xrng = $xrtk; + $minpkl = $min9; + break; + } + if( $rng ) $l = $l + 1; + } + if( $typ>2 ) $typ = 4; + $izw = $typ*$iuc; + if( $izw > 99 ){ + $dajp = 1; + } + if( $l > 3 ) $tab = 1; +} +else*/if( $_SERVER['REQUEST_METHOD'] == 'POST' ){ + $rozdan = $_POST['rozdan']; + + $progu1 = $_POST['pru1']; // dla pierwszych progu1% uczestników + $progp1 = $_POST['prp1']; // ostatni dostaje progp1% maximum punktów + $progu2 = $_POST['pru2']; // dla kolejnych (progu2-progu1)% uczestników + $progp2 = $_POST['prp2']; // ostatni dostaje 10*progp2% maximum punktów + $progu3 = $_POST['pru3']; // dla kolejnych (progu3-progu2)% uczestników + $rgg = $_POST['rgg']; + $rgp = $_POST['rgp']; + $rot = $_POST['rot']; + $rok1 = $_POST['rok1']; + $rok = $_POST['rok']; + $rtp = $_POST['rtp']; + $rto = $_POST['rto']; + $rtk = $_POST['rtk']; + $rgg_ = $_POST['rgg_']; + $rgp_ = $_POST['rgp_']; + $rot_ = $_POST['rot_']; + $rok1_ = $_POST['rok1_']; + $rok_ = $_POST['rok_']; + $rtp_ = $_POST['rtp_']; + $rto_ = $_POST['rto_']; + $rtk_ = $_POST['rtk_']; + + $typ = $_POST['typ']; + $rng = $_POST['rng']; + $zaw = $_POST['zaw']; + $min1 = $_POST['min1']; + $min2 = $_POST['min2']; + $min3 = $_POST['min3']; + $min4 = $_POST['min4']; + $min5 = $_POST['min5']; + $min6 = $_POST['min6']; + $min7 = $_POST['min7']; + $min8 = $_POST['min8']; + $min1_ = $_POST['min1_']; + $min2_ = $_POST['min2_']; + $min3_ = $_POST['min3_']; + $min4_ = $_POST['min4_']; + $min5_ = $_POST['min5_']; + $min6_ = $_POST['min6_']; + $min7_ = $_POST['min7_']; + $min8_ = $_POST['min8_']; + if(!$rozdan): + switch( $rng ){ + case 1: + $rng = $rgg; + $minpkl = $min1; + break; + case 2: + $rng = $rgp; + $minpkl = $min2; + break; + case 3: + $rng = $rot; + $minpkl = $min3; + break; + case 4: + $rng = $rok1; + $minpkl = $min4; + break; + case 5: + $rng = $rok; + $minpkl = $min5; + break; + case 6: + $rng = $rtp; + $minpkl = $min6; + break; + case 7: + $rng = $rto; + $minpkl = $min7; + break; + case 8: + $rng = $rtk; + $minpkl = $min8; + break; + } + else: + switch( $rng ){ + case 1: + $rng = $rgg_; + $minpkl = $min1_; + break; + case 2: + $rng = $rgp_; + $minpkl = $min2_; + break; + case 3: + $rng = $rot_; + $minpkl = $min3_; + break; + case 4: + $rng = $rok1_; + $minpkl = $min4_; + break; + case 5: + $rng = $rok_; + $minpkl = $min5_; + break; + case 6: + $rng = $rtp_; + $minpkl = $min6_; + break; + case 7: + $rng = $rto_; + $minpkl = $min7_; + break; + case 8: + $rng = $rtk_; + $minpkl = $min8_; + break; + } + endif; + $iuc = $_POST['iuc']; + if( $typ>2 ) $typ = 4; + $izw = $typ*$iuc; + if( $izw > 99 ){ + $dajp = 1; + } + $swk = $_POST['swk']; + $tab = 1; +} +?> +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> +<html> +<head> +<meta http-equiv="pragma" content="no-cache"> +<meta http-equiv="cache-control" content="no-cache"> +<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> +<title>Kargulator PKLi</title> +<link rel="stylesheet" href="style.css" type="text/css"> +<link rel="icon" href="images/favicon.ico" type="image/x-icon"> +<link rel="shortcut icon" href="images/favicon.ico" type="image/x-icon"> +<script type="text/javascript"> +<!-- +function valiuc(x,y){ + if( !(x.value==null || x.value=='') ){ + x.value = x.value.replace(',','.'); + if( isFinite(x.value)){ + if( y==1 ){ + if( document.getElementsByName("typ")[0].checked ){ + document.getElementById("izw").value = x.value; + } else { + if( document.getElementsByName("typ")[1].checked ){ + document.getElementById("izw").value = 2 * x.value; + } else { + if( document.getElementsByName("typ")[2].checked ){ + document.getElementById("izw").value = 4 * x.value; + } + } + } + } + if( y==3 ){ + var z = document.getElementById('izw'); + if( valiuc(z,2) ){ + var srednieWk = x.value/z.value; + if(srednieWk < 0.15) srednieWk = 0.15; + document.getElementById('srd').value = srednieWk; + } + } + return true; + } else { + alert(x.value+' to nie liczba!'); + x.select(); + x.focus(); + return false; + } + } +} + +function typtur(x){ + var t = document.getElementById("iuc"); + var z = document.getElementById("izw"); + if( t.value!=null && t.value!='' && isFinite(t.value) ){ + z.value = x * t.value; + } +} + +function submitit(){ + if( document.getElementsByName("typ")[0].checked || + document.getElementsByName("typ")[1].checked || + document.getElementsByName("typ")[2].checked ){ + if( document.getElementsByName("rng")[0].checked || + document.getElementsByName("rng")[1].checked || + document.getElementsByName("rng")[2].checked || + document.getElementsByName("rng")[3].checked || + document.getElementsByName("rng")[4].checked || + document.getElementsByName("rng")[5].checked || + document.getElementsByName("rng")[6].checked || + document.getElementsByName("rng")[7].checked || + document.getElementsByName("rng")[8].checked || + document.getElementsByName("rng")[9].checked ){ + var t = document.getElementById("iuc") + if( t.value!=null && t.value!='' && isFinite(t.value) ){ + t = document.getElementById("izw"); + if( t.value!=null && t.value!='' && isFinite(t.value) ){ + t = document.getElementById("swk"); + if( t.value!=null && t.value!='' && isFinite(t.value) ){ + + document.getElementById("pkl").submit(); + + } else { + alert('Brak sumy WK!'); + t.select(); + } + } else { + alert('Brak liczby zawodników!'); + t.select(); + } + } else { + alert('Brak liczby uczestników!'); + t.select(); + } + } else { + alert('Wybierz rangę turnieju'); + document.getElementsByName("rng")[0].select(); + } + } else { + alert('Wybierz typ turnieju'); + document.getElementsByName("typ")[0].select(); + } +} +--> +</script> +</head> +<body style="background-color: #F0F0F0; background-image: none"> +<form id="pkl" method="post" action="pkle2018.php"> +<table border="0" cellspacing="0" cellpadding="0"> + <tr> + <td><img src="images/logo_pzbs.gif"></td> + <td colspan="3" align="center"><h3>KALKULATOR PKLI W TURNIEJACH PZBS<br> + zgodny z <span style="color:#d00">nowym regulaminem (obowiązującym od 01.11.2018)</span></h3> + Przejdź do <a href="pkle2014.php"><b>kalkulatora zgodnego ze starym regulaminem</b></a>! + <br><br> + Możesz eksperymentować ze wszystkimi (prawie) parametrami.<br> + Dla przywrócenia stanu regulaminowego otwórz ponownie stronę.</td> + <td><img src="images/logo_pzbs.gif"></td> + </tr> + <tr><td colspan="5"> </td></tr> + <tr> + <td align="center" colspan="2"><b>turniej do 39 rozdań</b></td> + <td align="center" colspan="2"><b>turniej od 40 rozdań</b></td> + </tr> + <tr> + <td align="right">WAGA<br>turnieju</td><td align="left">MINIMUM<br>za 1sze miejsce</td> + <td align="right">WAGA<br>turnieju</td><td align="left">MINIMUM<br>za 1sze miejsce</td> + <td align="left" colspan="3">WSP:</td> + </tr> + <tr> + <td align="right" rowspan="3"> + OTP<sup>∗∗∗∗</sup>: <input type="text" id="rgg" name="rgg" maxlength="3" style="width:30px" value=<?php echo '"'.$rgg.'"'; ?>><br /> + OTP<sup>∗∗∗</sup>: <input type="text" id="rgp" name="rgp" maxlength="3" style="width:30px" value=<?php echo '"'.$rgp.'"'; ?>><br /> + OTP<sup>∗∗</sup>: <input type="text" id="rot" name="rot" maxlength="3" style="width:30px" value=<?php echo '"'.$rot.'"'; ?>><br /> + OTP<sup>∗</sup>: <input type="text" id="rok1" name="rok1" maxlength="3" style="width:30px" value=<?php echo '"'.$rok1.'"'; ?>><br /> + OTP: <input type="text" id="rok" name="rok" maxlength="3" style="width:30px" value=<?php echo '"'.$rok.'"'; ?>><br /> + Regionalny: <input type="text" id="rtp" name="rtp" maxlength="3" style="width:30px" value=<?php echo '"'.$rtp.'"'; ?>><br /> + Okręgowy: <input type="text" id="rto" name="rto" maxlength="3" style="width:30px" value=<?php echo '"'.$rto.'"'; ?>><br /> + Klubowy: <input type="text" id="rtk" name="rtk" maxlength="3" style="width:30px" value=<?php echo '"'.$rtk.'"'; ?>></td> + <td align="left" rowspan="3"> + <input type="text" id="min1" name="min1" maxlength="3" style="width:30px" value=<?php echo '"'.$min1.'"'; ?>><br /> + <input type="text" id="min2" name="min2" maxlength="3" style="width:30px" value=<?php echo '"'.$min2.'"'; ?>><br /> + <input type="text" id="min3" name="min3" maxlength="3" style="width:30px" value=<?php echo '"'.$min3.'"'; ?>><br /> + <input type="text" id="min4" name="min4" maxlength="3" style="width:30px" value=<?php echo '"'.$min4.'"'; ?>><br /> + <input type="text" id="min5" name="min5" maxlength="3" style="width:30px" value=<?php echo '"'.$min5.'"'; ?>><br /> + <input type="text" id="min6" name="min6" maxlength="3" style="width:30px" value=<?php echo '"'.$min6.'"'; ?>><br /> + <input type="text" id="min7" name="min7" maxlength="3" style="width:30px" value=<?php echo '"'.$min7.'"'; ?>><br /> + <input type="text" id="min8" name="min8" maxlength="3" style="width:30px" value=<?php echo '"'.$min8.'"'; ?>></td> + <td align="right" rowspan="3"> + OTP<sup>∗∗∗∗</sup>: <input type="text" id="rgg_" name="rgg_" maxlength="3" style="width:30px" value=<?php echo '"'.$rgg_.'"'; ?>><br /> + OTP<sup>∗∗∗</sup>: <input type="text" id="rgp_" name="rgp_" maxlength="3" style="width:30px" value=<?php echo '"'.$rgp_.'"'; ?>><br /> + OTP<sup>∗∗</sup>: <input type="text" id="rot_" name="rot_" maxlength="3" style="width:30px" value=<?php echo '"'.$rot_.'"'; ?>><br /> + OTP<sup>∗</sup>: <input type="text" id="rok1_" name="rok1_" maxlength="3" style="width:30px" value=<?php echo '"'.$rok1_.'"'; ?>><br /> + OTP: <input type="text" id="rok_" name="rok_" maxlength="3" style="width:30px" value=<?php echo '"'.$rok_.'"'; ?>><br /> + Regionalny: <input type="text" id="rtp_" name="rtp_" maxlength="3" style="width:30px" value=<?php echo '"'.$rtp_.'"'; ?>><br /> + Okręgowy: <input type="text" id="rto_" name="rto_" maxlength="3" style="width:30px" value=<?php echo '"'.$rto_.'"'; ?>><br /> + Klubowy: <input type="text" id="rtk_" name="rtk_" maxlength="3" style="width:30px" value=<?php echo '"'.$rtk_.'"'; ?>></td> + <td align="left" rowspan="3"> + <input type="text" id="min1_" name="min1_" maxlength="3" style="width:30px" value=<?php echo '"'.$min1_.'"'; ?>><br /> + <input type="text" id="min2_" name="min2_" maxlength="3" style="width:30px" value=<?php echo '"'.$min2_.'"'; ?>><br /> + <input type="text" id="min3_" name="min3_" maxlength="3" style="width:30px" value=<?php echo '"'.$min3_.'"'; ?>><br /> + <input type="text" id="min4_" name="min4_" maxlength="3" style="width:30px" value=<?php echo '"'.$min4_.'"'; ?>><br /> + <input type="text" id="min5_" name="min5_" maxlength="3" style="width:30px" value=<?php echo '"'.$min5_.'"'; ?>><br /> + <input type="text" id="min6_" name="min6_" maxlength="3" style="width:30px" value=<?php echo '"'.$min6_.'"'; ?>><br /> + <input type="text" id="min7_" name="min7_" maxlength="3" style="width:30px" value=<?php echo '"'.$min7_.'"'; ?>><br /> + <input type="text" id="min8_" name="min8_" maxlength="3" style="width:30px" value=<?php echo '"'.$min8_.'"'; ?>></td> + <td align="left" valign="top"><input type="text" id="zaw" name="zaw" maxlength="5" style="width:30px" value=<?php echo '"'.$zaw.'"'; ?>></td> + <td valign="top" colspan="2">PKL za 1 m = <b>śr.WK×WAGA + il.zaw×WSP</b></td> + </tr> + <tr> + <td align="right" valign="top"><br /><br /><br /><br /><input type="text" id="prp1" name="prp1" style="width:18px" value=<?php echo '"'.$progp1.'"'; ?>>%<br /><input type="text" id="prp2" name="prp2" style="width:18px" value=<?php echo '"'.$progp2.'"'; ?>>%</td> + <td colspan="2" align="left"><img src="images/pkle.png"></td> + </tr> + <tr> + <td> </td> + <td colspan="2"><table cellspacing="0" cellpadding="0"><tr><td align="right" style="width:50px"><input type="text" id="pru1" name="pru1" style="width:18px" value=<?php echo '"'.$progu1.'"'; ?>>%</td><td align="right" style="width:25px"><input type="text" id="pru2" name="pru2" style="width:18px" value=<?php echo '"'.$progu2.'"'; ?>>%</td><td align="right" style="width:55px"><input type="text" id="pru3" name="pru3" style="width:18px" value=<?php echo '"'.$progu3.'"'; ?>>%</td></tr></table></td> + </tr> + + <tr><td colspan="5"> </td></tr> + <tr> + <td valign=top rowspan="2">TYP ZAWODÓW<br /> + <input type="radio" name="typ" id="tp1" value="1" onclick="typtur(1)"<?php if( $typ==1 ){ echo ' checked="checked"';}?>><label for="tp1"> Indywiduel</label><br /> + <input type="radio" name="typ" id="tp2" value="2" onclick="typtur(2)"<?php if( $typ==2 ){ echo ' checked="checked"';}?>><label for="tp2"> Pary</label><br /> + <input type="radio" name="typ" id="tp3" value="4" onclick="typtur(4)"<?php if( $typ==4 ){ echo ' checked="checked"';}?>><label for="tp3"> Teamy</label> + <br><br>LICZBA ROZDAŃ<br> + <input type="radio" name="rozdan" id="rozdan0" value="0"<?php if( !$rozdan ){ echo ' checked="checked"';}?>><label for="rozdan0"> do 39</label><br /> + <input type="radio" name="rozdan" id="rozdan1" value="1"<?php if( $rozdan ){ echo ' checked="checked"';}?>><label for="rozdan1"> od 40</label> + </td> + <td valign=top rowspan="2">RANGA ZAWODÓW<br /> + <input type="radio" name="rng" id="rg1" value="1"<?php if( $_POST['rng']==1 ){echo ' checked="checked"';}?>><label for="rg1"> OTP<sup>∗∗∗∗</sup></label><br /> + <input type="radio" name="rng" id="rg2" value="2"<?php if( $_POST['rng']==2 ){echo ' checked="checked"';}?>><label for="rg2"> OTP<sup>∗∗∗</sup></label><br /> + <input type="radio" name="rng" id="rg3" value="3"<?php if( $_POST['rng']==3 ){echo ' checked="checked"';}?>><label for="rg3"> OTP<sup>∗∗</sup></label><br /> + <input type="radio" name="rng" id="rg4" value="4"<?php if( $_POST['rng']==4 ){echo ' checked="checked"';}?>><label for="rg4"> OTP<sup>∗</sup></label><br /> + <input type="radio" name="rng" id="rg5" value="5"<?php if( $_POST['rng']==5 ){echo ' checked="checked"';}?>><label for="rg5"> OTP</label><br /> + <input type="radio" name="rng" id="rg6" value="6"<?php if( $_POST['rng']==6 ){echo ' checked="checked"';}?>><label for="rg6"> Regionalny</label><br /> + <input type="radio" name="rng" id="rg7" value="7"<?php if( $_POST['rng']==7 ){echo ' checked="checked"';}?>><label for="rg7"> Okręgowy</label><br /> + <input type="radio" name="rng" id="rg8" value="8"<?php if( $_POST['rng']==8 ){echo ' checked="checked"';}?>><label for="rg8"> Klubowy</label></td> + <td align="CENTER" valign=top>UCZESTNIKÓW<br /> + <input type="text" id="iuc" name="iuc" maxlength="3" style="width:50px" onblur="valiuc(this,1)"<?php if( $iuc>0 ){echo ' value="'.$iuc.'"';}?>><br /> + <small>W zależności od typu<br />ilość indywidualistów,<br />par lub teamów</small></td> + <td align="CENTER" valign=top>ZAWODNIKÓW<br /> + <input type="text" id="izw" name="izw" readonly="readonly" maxlength="4" style="width:50px" onblur="valiuc(this,2)"<?php if( $izw>0 ){echo ' value="'.$izw.'"';}?>><br /> + <small>To pole jest wyliczane<br />automatycznie.</small></td> + <td align="CENTER" valign=top>SUMA WK<br /> + <input type="text" id="swk" name="swk" maxlength="7" style="width:70px" onblur="valiuc(this,3)"<?php if( $swk>0 ){echo ' value="'.$swk.'"';}?>><br /> + <small>Suma WK wszystkich<br />zawodników.</small></td> + </tr> + <tr> + <td align="CENTER" colspan="3">Średnie WK zawodnika w turnieju: + <input type="text" id="srd" name="srd" readonly="readonly"<?php if( $izw>0 ){echo ' value="'.($swk/$izw > 0.15 ? $swk/$izw : 0.15).'"';}?>><br /> + </td> + </tr> + <tr><td colspan="5"> </td></tr> + <tr> + <td align="CENTER" colspan="2"> + <input type="button" value="Policz PKLe" onclick="submitit()"></td> + <td colspan="3"> +<?php +if( $tab>0 ){ + echo '<input type="button" value="SQL dla JFR Pary" onclick="document.getElementById(\'outsql\').style.display=(document.getElementById(\'outsql\').style.display==\'none\') ? \'block\' : \'none\';"> + <input type="button" value="SQL dla JFR Teamy" onclick="document.getElementById(\'outsql2\').style.display=(document.getElementById(\'outsql2\').style.display==\'none\') ? \'block\' : \'none\';">'; +} else { + echo ' '; +} +?> + </td> + </tr> + <tr><td colspan="2" align="center"> +<?php +if( $tab>0 ){ + unset( $tabpkl ); + $lasti = 0; + echo '<table><tr><td class="t">Miejsce</td><td class="t"> PKL </td>'; + echo '</tr>'; + // #zmiany2018 - poprzednie brzmienie: $max = ceil(($swk/$izw)*$rng + $izw*$zaw); + $max = ($swk/$izw)*$rng + $izw*$zaw; + if($typ == 4) $max = $max*1.25; // mnożnik 1.25 dla teamów UCHWAŁA Zarządu NR 52/2018/2016–2020 + $max = ceil($max); + // #zmiany2018 - koniec zmienionego fragmentu + if( $max<$minpkl ) $max = $minpkl; + $prem = 0; + $zni = 1; + switch( $typ ){ + case 2: + $zni = 2; + break; + case 4: + $zni = 4; + break; + } + if( $prem>0 ){ + $d = 2; + } else { + $d = 0; + } + $maxold = ceil($prcold*$izw + 0.05*$swk); + $progu1 = $progu1*$iuc*0.01+1; + $progu2 = $progu2*$iuc*0.01+1; + $progu3 = $progu3*$iuc*0.01+1; // 0 pkl za ostatnie punktowane+1 + $progp1 = $max*$progp1*0.01; + $progp2 = $max*$progp2*0.01; + $sumn = 0 ; + $sumo = 0; + $i = 0; + $dok = 1 - 1e-6; // unikamy błędu ceil(2)=3; + do{ + $i++; + if( $i<=$progu1 ){ + $p = $progp1+($max-$progp1)*($progu1-$i)/($progu1-1); + } + elseif( $i<=$progu2 ){ + $p = $progp2+($progp1-$progp2)*($progu2-$i)/($progu2-$progu1); + } + elseif( $i<$progu3 ){ + $p = $progp3+($progp2-$progp3)*($progu3-$i)/($progu3-$progu2); + } + else $p=1; // #zmiany2018 - zmiana wartości z 0 na 1, UCHWAŁA Zarządu NR 67/2018/2016–2020 + if( ($p>0) ){ + echo '<tr><td class="t">'.$i.'</td>'; + if( $p>0 ){ + $pkl_temp = ceil($p); + if (($pkl_temp - $p) < $dok){ + $p = $pkl_temp; + } else { + $p = round($p); + } + $tabkl[$i] = $p; + $lasti = $i; + echo '<td class="t">'.$p.'</td>'; + $sumn = $sumn + $p; + } else { + echo '<td class="p"> </td>'; + } + echo '</tr>'; + } + } while( (($p>0) || ($maxold>0)) && ($i<$iuc) ); + echo '<tr><td class="p">SUMA PKL</td><td class="t">'.$typ*$sumn.'</td></tr>'; + echo '</table>'; +} else { + echo ' '; +} +?> +</td><td colspan="3" valign="top"><span id="outsql" style="display: none"> +<?php +echo "UPDATE `dodatki` SET `pkl`=0;<br />\r\n"; +for( $i=1; $i<=$lasti; $i++){ + echo "UPDATE `dodatki` SET `pkl`=".$tabkl[$i]." WHERE `miejsce`=".$i.";<br />\r\n"; +} +?> +</span></td> +<td colspan="3" valign="top"><span id="outsql2" style="display: none"> +<?php +echo "UPDATE `addons` SET `mastr`=0;<br />\r\n"; +for( $i=1; $i<=$lasti; $i++){ + echo "UPDATE `addons` SET `mastr`=".$tabkl[$i]." WHERE `place`=".$i.";<br />\r\n"; +} +?> +</span></td></tr> +<tr><td colspan="5" class="copyright">©'2009, Jan Romański dla PZBS</td></tr> +</table> +</form> +</body> +</html> diff --git a/regKLas.gif b/regKLas.gif Binary files differnew file mode 100644 index 0000000..d4cff64 --- /dev/null +++ b/regKLas.gif diff --git a/style.css b/style.css new file mode 100644 index 0000000..f226e5b --- /dev/null +++ b/style.css @@ -0,0 +1,13 @@ +body {background-color: #FFFFCC; background-image: url("images/bkg.JPG")} +a:link { color: #336699; font-family: Arial; text-decoration: underline; } +a:visited { color: #336699; font-family: Arial; text-decoration: underline; } +a:hover { color: #990000; font-family: Arial; text-decoration: underline; } +a:active { color: #336699; font-family: Arial; text-decoration: underline; } +input, textarea, select { font-size: 10pt; font-family: Arial } +td {padding: 1px 12px 1px 12px; font-family: Arial; font-size: 10pt; white-space: nowrap} +td.t {padding: 1px; border: 1px solid #008000; text-align: center; font-size: 10pt; white-space: nowrap} +td.s {padding: 1px; border: 1px solid #A0A0A0; text-align: center; font-size: 10pt; white-space: nowrap; color: #A0A0A0} +td.p {padding: 1px; font-size: 10pt} +hr {color: #0000A0} +/* Copyright */ +.copyright {padding: 0px; color: #555555; font-size: 8pt; font-family: Arial; text-align: center; border: 1px dotted #004000} |