You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

341 lines
9.0 KiB

<?php
/*
* Created on 31.05.2011
*
* @copyright (c) 2011 animegame.eu
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public Licence
*
*/
defineIfNotDefined('TURNIER_ANFAENGER_GEBUEHR', 10000);
defineIfNotDefined('TURNIER_WOCHEN_GEBUEHR', 50000);
defineIfNotDefined('TURNIER_WOCHENST_GEBUEHR', 50000);
function displayTournamentOptions() {
?>
<form method="POST">
<input type="hidden" name="choose" value="tournament"> <input
type="hidden" name="action" value="checktnmt">
<table width="80%">
<tr>
<th colspan="2"><h1 style="text-align: center">Übersicht</h1></th>
</tr>
<tr>
<td>Art</td>
<td style="text-align: center"><select id="input" name="art">
<option value="klein">Anf&auml;ngerturnier</option>
<option value="wochen">Wochenturnier</option>
<option value="wochenst">Wochenturnier non-Fusion</option>
<option value="gross">Weltturnier</option>
<option value="grossst">Weltturnier non-Fusion</option>
</select>
</td>
</tr>
<tr>
<td>Anzahl</td>
<td style="text-align: center"><select id="input" name="anzahl">
<option value="2">2</option>
<option value="4">4</option>
<option value="8">8</option>
<option value="16">16</option>
<option value="32">32</option>
<option value="64">64</option>
<option value="128">128</option>
<option value="256">256</option>
<option value="512">512</option>
</select>
</tr>
<tr>
<td>Fusion erlaubt?</td>
<td style="text-align: center"><select id="input" name="fusion">
<option value="1">ja</option>
<option value="0">nein</option>
</select>
</td>
</tr>
<tr>
<td>Spezialcharaktere erlaubt? (Kaio/Shichi)</td>
<td style="text-align: center"><select id="input" name="special">
<option value="1">ja</option>
<option value="0">nein</option>
</select>
</td>
</tr>
<tr>
<td>Min. Level</td>
<td style="text-align: center"><input name="minlevel" value="1"></td>
</tr>
<tr>
<td>Max. Level</td>
<td style="text-align: center"><input name="maxlevel" value="150"></td>
</tr>
<tr>
<td>Teilnehmer</td>
<td style="text-align: center"><select id="input" name="gain">
<option value="Anmeldung">Anmeldung</option>
<option value="PL">Powerlevel</option>
<option value="Level">Level</option>
</select>
</td>
</tr>
<tr>
<td>Zufällige Reihenfolge?</td>
<td style="text-align: center"><select id="input" name="randomize">
<option value="1">ja</option>
<option value="0">nein</option>
</select>
</td>
</tr>
<tr>
<td>Ausrüstung ignorieren?</td>
<td style="text-align: center"><select id="input" name="itemless">
<option value="1">ja</option>
<option value="0">nein</option>
</select>
</td>
</tr>
<tr>
<td>Chance auf eine Frucht</td>
<td style="text-align: center"><select id="input" name="fruit">
<?php
for ($i = 0; $i <= 100; ++$i) {
?>
<option value="<?php echo $i; ?>"><?php echo $i; ?>%</option>
<?php
}
?>
</select>
</td>
</tr>
<tr>
<td>Fruchttyp</td>
<td style="text-align: center"><select id="input" name="fruit_type">
<?php
$types = array('natur', 'Logia', 'Paramecia', 'Zoan');
foreach ($types as $type) {
?>
<option value="<?php echo $type; ?>"><?php echo $type; ?></option>
<?php
}
?>
</select>
</td>
</tr>
<tr>
<td>Turniergewinner ausschliessen?</td>
<td style="text-align: center"><select id="input" name="exclude_winners">
<option value="1">ja</option>
<option value="0">nein</option>
</select>
</td>
</tr>
<tr>
<td>Anzahl Teilnahmen nach der Fusionen ausgeschlossen werden?</td>
<td style="text-align: center"><select id="input" name="exclude_fusi_count">
<option value="0">deaktiviert</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
</select>
</td>
</tr>
<!-- <tr>
<td>Gruppenphase?</td>
<td style="text-align: center"><select id="input" name="gruppenphase">
<option value="0">nein</option>
<option value="1">ja</option>
</select>
</td>
</tr>
<tr>
<td>Gruppengr&ouml;sse</td>
<td style="text-align: center"><input name="grp_size" value="0"></td>
</tr>
<tr>
<td>Anzahl der Sieger die eine Gruppe verlassen</td>
<td style="text-align: center"><input name="grp_proceed" value="0"></td>
</tr>-->
<tr>
<td align="center" colspan="2"><input type="submit" value="starten">
</td>
</tr>
<tr>
<td align="center" colspan="2"><a
href="<?php echo $_SERVER['PHP_SELF'].'?choose=tournament'; ?>">Zur&uuml;ck</a>
</td>
</tr>
<tr>
<td align="center" colspan="2"><a
href="<?php echo $_SERVER['PHP_SELF']; ?>">Zum Hauptmenu</a>
</td>
</tr>
</table>
</form>
<?php
}
function displayCheckTournament($request) {
$name = $request['art'];
$anzahl = $request['anzahl'];
$fusion = $request['fusion'];
$special = $request['special'];
$minlvl = $request['minlevel'];
$maxlvl = $request['maxlevel'];
$gain = $request['gain'];
$random = $request['randomize'];
$itemless = $request['itemless'];
$fruit_chance = $request['fruit'];
$fruit_type = $request['fruit_type'];
$exclude_winners = $request['exclude_winners'];
$exclude_fusi_count = $request['exclude_fusi_count'];
if(is_numeric($minlvl) && is_numeric($maxlvl)) {?>
<table width="80%">
<tr>
<th colspan="2" style="text-align: center">Turnier wirklich starten?</th>
</tr>
<tr>
<td style="text-align: center"><a
href="<?php echo $GLOBALS['URL_TO_TURNIER'].'?fusion='.$fusion.'&special='.
$special.'&minlevel='.$minlvl.'&maxlevel='.$maxlvl.'&gain='.$gain.'&randomize='.
$random.'&name='.$name.'&anzahl='.$anzahl.'&itemless='.$itemless.'&fruit='.
$fruit_chance.'&fruit_type='.$fruit_type.'&exclude_winners='.$exclude_winners.
'&exclude_fusi_count='.$exclude_fusi_count;?>"
target="_blank">Turnier starten!</a>
</td>
<td style="text-align: center"><a
href="<?php echo $_SERVER['PHP_SELF'].'?choose=tournament&action=tnmt'; ?>">Doch
nicht</a>
</td>
</tr>
</table>
<?php
} else {
echo 'Keine gültige Eingabe von Min. oder Max. Level<br>';
echo '<a href="'.$_SERVER['PHP_SELF'].'?choose=tournament&action=tnmt">Zur&uuml;ck</a>';
}
}
function displayEditFee($request) {
$klein = $request['klein'];
$wochen = $request['wochen'];
$wochenst = $request['wochenst'];
$change = FALSE;
if($klein !== NULL || $wochen !== null) {
if($klein !== NULL && $klein != TURNIER_ANFAENGER_GEBUEHR) {
$change = TRUE;
setDefine('TURNIER_ANFAENGER_GEBUEHR', $klein);
}
if($wochen !== NULL && $wochen != TURNIER_WOCHEN_GEBUEHR) {
$change = TRUE;
setDefine('TURNIER_WOCHEN_GEBUEHR', $wochen);
}
if($wochenst !== NULL && $wochenst != TURNIER_WOCHENST_GEBUEHR) {
$change = TRUE;
setDefine('TURNIER_WOCHENST_GEBUEHR', $wochenst);
}
} else {
}
?>
<form method="get">
<input type="hidden" name="choose" value="tournament"> <input
type="hidden" name="action" value="fee">
<table width="80%">
<tr>
<th colspan="2"><h1 style="text-align: center">Übersicht</h1></th>
</tr>
<?php if($change === TRUE) {?>
<tr>
<td colspan="2" align="center">&Auml;nderungen &uuml;bernommen!</td>
</tr>
<?php }?>
<tr>
<td colspan="2" align="center"><b>Anf&auml;ngerturnier</b>
</td>
</tr>
<tr>
<td align="left">Anmeldegeb&uuml;hr:</td>
<td><input type="text" name="klein"
value=<?php echo ($klein == null)?TURNIER_ANFAENGER_GEBUEHR:$klein;?>>
</td>
</tr>
<tr>
<td colspan="2" align="center"><b>Wochenturnier</b>
</td>
</tr>
<tr>
<td align="left">Anmeldegeb&uuml;hr:</td>
<td><input type="text" name="wochen"
value=<?php echo ($wochen == null)?TURNIER_WOCHEN_GEBUEHR:$wochen;?>>
</td>
</tr>
<td colspan="2" align="center"><b>Wochenturnier non-Fusion</b>
</td>
</tr>
<tr>
<td align="left">Anmeldegeb&uuml;hr:</td>
<td><input type="text" name="wochenst"
value=<?php echo ($wochenst == null)?TURNIER_WOCHENST_GEBUEHR:$wochenst;?>>
</td>
</tr>
<td align="center" colspan="2"><input type="submit"
value="&auml;ndern">
</td>
</tr>
<tr>
<td align="center" colspan="2"><a
href="<?php echo $_SERVER['PHP_SELF'].'?choose=tournament'; ?>">Zur&uuml;ck</a>
</td>
</tr>
<tr>
<td align="center" colspan="2"><a
href="<?php echo $_SERVER['PHP_SELF']; ?>">Zum Hauptmenu</a>
</td>
</tr>
</table>
</form>
<?php
}
function displayTournamentMenu($request) {
switch ($request['action']) {
case 'checktnmt':
displayCheckTournament($request);
break;
case 'tnmt':
displayTournamentOptions();
break;
case 'fee':
displayEditFee($request);
break;
default:
?>
<table>
<?php if($GLOBALS['URL_TO_TURNIER'] !== null) { ?>
<tr>
<td><a
href="<?php $_SERVER['PHP_SELF'] ?>?choose=tournament&action=tnmt">Turnier
starten</a>
</td>
</tr>
<?php }?>
<tr>
<td><a
href="<?php $_SERVER['PHP_SELF'] ?>?choose=tournament&action=fee">
Anmeldegebühren bearbeiten</a>
</td>
</tr>
<tr>
<td><a href="<?php echo $_SERVER['PHP_SELF']; ?>">Zum Hauptmenu</a>
</td>
</tr>
</table>
<?php
}
}
?>