|
|
|
@ -68,7 +68,7 @@ function displayChallengeAccepted($user, $clan_id) {
|
|
|
|
|
function displayDenyChallenge($clan_id) {
|
|
|
|
|
if(!is_numeric($clan_id)) {
|
|
|
|
|
displayErrorMessage(NULL, 'Wollte da jemand schummeln? ;)', displayHistoryBackLink());
|
|
|
|
|
exit;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
?>
|
|
|
|
|
<table>
|
|
|
|
@ -91,7 +91,7 @@ function displayShowChallenge($clan_challenge_id, $user) {
|
|
|
|
|
|
|
|
|
|
if(!in_array($clan_challenge_id, $open_challenge_ids)) {
|
|
|
|
|
displayErrorMessage(NULL, 'Wollte da jemand schummeln? ;)', displayHistoryBackLink());
|
|
|
|
|
exit;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//initialisieren von wichtigen variablen
|
|
|
|
@ -191,6 +191,69 @@ function displayShowChallenge($clan_challenge_id, $user) {
|
|
|
|
|
<?php
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function displayShowOldChallenge($clan_challenge_id, array $user) {
|
|
|
|
|
$user_clan = getClan($user['clan']);
|
|
|
|
|
$challenge = getChallenge($clan_challenge_id);
|
|
|
|
|
$clans = getParticipatingClanIDs($clan_challenge_id);
|
|
|
|
|
if(!in_array($user['clan'] , $clans)) {
|
|
|
|
|
displayErrorMessage(NULL, 'Wollte da jemand schummeln? ;)', displayHistoryBackLink());
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if($challenge['calculated'] == FALSE) {
|
|
|
|
|
displayErrorMessage(NULL, 'Der Clankampf ist noch nicht soweit!!', displayHistoryBackLink());
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
//print_r($challenge);
|
|
|
|
|
|
|
|
|
|
// Get the Event
|
|
|
|
|
$event_id = $challenge['event_id'];
|
|
|
|
|
$event = getEvent($event_id);
|
|
|
|
|
if($event['event_type'] != EVENT_CLAN_FIGHT) {
|
|
|
|
|
displayErrorMessage(NULL, 'Das Event is garkein Clan-Kampf!!', displayHistoryBackLink());
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
$fight_ids = getEventFightIds($event_id);
|
|
|
|
|
|
|
|
|
|
echo '<table>';
|
|
|
|
|
echo '<tr><th align="center" width="100">Kampf</th><th>Ansehen</th></tr>';
|
|
|
|
|
foreach($fight_ids as $fight_id) {
|
|
|
|
|
$event_fight = getEventFight($event_id, $fight_id);
|
|
|
|
|
$round_data = getEventFightRoundData($event_id, $event_fight['event_fight_id'], 0); // get participants of fight
|
|
|
|
|
$host_char_id = NULL;
|
|
|
|
|
$guest_char_id = NULL;
|
|
|
|
|
foreach($round_data as $key => $value) {
|
|
|
|
|
if($event_fight['host'] == $key) {
|
|
|
|
|
$host_char_id = $key;
|
|
|
|
|
} else {
|
|
|
|
|
$guest_char_id = $key;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Key now lets read out the event_chars ...
|
|
|
|
|
|
|
|
|
|
$host_char = getEventChar($event_id, $host_char_id);
|
|
|
|
|
$guest_char = getEventChar($event_id, $guest_char_id);
|
|
|
|
|
|
|
|
|
|
// TODO: Check if the fight is already "visible"
|
|
|
|
|
|
|
|
|
|
echo '<tr>';
|
|
|
|
|
echo '<td align="center">';
|
|
|
|
|
if($host_char['char_id'] !== NULL)
|
|
|
|
|
echo displayCharLink($host_char['char_id'], $host_char['char_name']);
|
|
|
|
|
else
|
|
|
|
|
echo $host_char['char_name'];
|
|
|
|
|
echo ' vs. ';
|
|
|
|
|
if($guest_char['char_id'] !== NULL)
|
|
|
|
|
echo displayCharLink($guest_char['char_id'], $guest_char['char_name']);
|
|
|
|
|
else
|
|
|
|
|
echo $guest_char['char_name'];
|
|
|
|
|
echo '</td>';
|
|
|
|
|
echo '<td><a href="event_kampf_anzeige.php?event_id='.$event_id.'&event_fight_id='.$event_fight['event_fight_id'].'" target="_blank">anschauen</a></td>';
|
|
|
|
|
echo '</tr>';
|
|
|
|
|
}
|
|
|
|
|
echo '</table>';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function displayJoinChallenge($user, $clan_challenge_id, $char_id, $slot) {
|
|
|
|
|
$success = joinChallenge($clan_challenge_id, $user, $char_id, $slot);
|
|
|
|
|
if($success != null) {
|
|
|
|
@ -242,6 +305,7 @@ function displayClanFightMenu($user) {
|
|
|
|
|
}
|
|
|
|
|
$open_challenge_requests = getOpenChallengeRequests($user_clan['id']);
|
|
|
|
|
$open_challenge_ids = getOpenChallengeIDs($user_clan['id']);
|
|
|
|
|
$old_challenge_ids = getHistoricalChallengeIDs($user_clan['id']);
|
|
|
|
|
?>
|
|
|
|
|
<div align="center">
|
|
|
|
|
<table width="100%" border="1">
|
|
|
|
@ -291,39 +355,76 @@ function displayClanFightMenu($user) {
|
|
|
|
|
<th height="30" colspan="2" align="center">offene Herausforderungen</th>
|
|
|
|
|
</tr>
|
|
|
|
|
<?php
|
|
|
|
|
foreach ($open_challenge_ids as $oci) {
|
|
|
|
|
$participating_clan_ids = getParticipatingClanIDs($oci);
|
|
|
|
|
foreach ($participating_clan_ids as $pci)
|
|
|
|
|
if($pci != $user_clan['id']) {
|
|
|
|
|
$challenged_clan = getClan($pci);
|
|
|
|
|
echo '<tr>';
|
|
|
|
|
echo '<td> '.$challenged_clan['clanname'].'</td>';
|
|
|
|
|
echo '<td align="center"><a href="index.php?as=clan/kampf_info&action=showchallenge&challenge='.$oci.'">'.anzeigen.'</a></td>';
|
|
|
|
|
echo '</tr>';
|
|
|
|
|
if(count($open_challenge_ids) == 0) {
|
|
|
|
|
?><td height="20" colspan="2" align="center">Keine</td><?php
|
|
|
|
|
} else {
|
|
|
|
|
foreach ($open_challenge_ids as $oci) {
|
|
|
|
|
$participating_clan_ids = getParticipatingClanIDs($oci);
|
|
|
|
|
foreach ($participating_clan_ids as $pci)
|
|
|
|
|
if($pci != $user_clan['id']) {
|
|
|
|
|
$challenged_clan = getClan($pci);
|
|
|
|
|
echo '<tr>';
|
|
|
|
|
echo '<td> '.$challenged_clan['clanname'].'</td>';
|
|
|
|
|
echo '<td align="center"><a href="index.php?as=clan/kampf_info&action=showchallenge&challenge='.$oci.'">'.anzeigen.'</a></td>';
|
|
|
|
|
echo '</tr>';
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
?>
|
|
|
|
|
<tr>
|
|
|
|
|
<th height="30" colspan="2" align="center">Beendete Herausforderungen</th>
|
|
|
|
|
</tr>
|
|
|
|
|
<tr>
|
|
|
|
|
<?php
|
|
|
|
|
if(count($old_challenge_ids) == 0) {
|
|
|
|
|
?><td height="20" colspan="2" align="center">Keine</td><?php
|
|
|
|
|
} else {
|
|
|
|
|
foreach ($old_challenge_ids as $oci) {
|
|
|
|
|
$participating_clan_ids = getParticipatingClanIDs($oci);
|
|
|
|
|
foreach ($participating_clan_ids as $pci)
|
|
|
|
|
if($pci != $user_clan['id']) {
|
|
|
|
|
$challenged_clan = getClan($pci);
|
|
|
|
|
echo '<tr>';
|
|
|
|
|
echo '<td> '.$challenged_clan['clanname'].'</td>';
|
|
|
|
|
echo '<td align="center"><a href="index.php?as=clan/kampf_info&action=showoldchallenge&challenge='.$oci.'">'.anzeigen.'</a></td>';
|
|
|
|
|
echo '</tr>';
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
?>
|
|
|
|
|
</tr>
|
|
|
|
|
</table>
|
|
|
|
|
</div>
|
|
|
|
|
<?php
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if($action == 'challengeclan') {
|
|
|
|
|
displayChallengeClan($user_ida, $challangedclan_id);
|
|
|
|
|
} else if($action == 'acceptchallenge') {
|
|
|
|
|
displayChallengeAccepted($user_ida, $inquirychallenge_clanid);
|
|
|
|
|
} else if($action == 'q_denychallenge') {
|
|
|
|
|
displayDenyChallenge($inquirychallenge_clanid);
|
|
|
|
|
} else if($action == 'denychallenge') {
|
|
|
|
|
denyChallengeRequest($inquirychallenge_clanid, $user_ida);
|
|
|
|
|
displayClanFightMenu($user_ida);
|
|
|
|
|
} else if($action == 'showchallenge') {
|
|
|
|
|
displayShowChallenge($clan_challange_id, $user_ida);
|
|
|
|
|
} else if($action == 'joinchallenge') {
|
|
|
|
|
displayJoinChallenge($user_ida, $clan_challange_id, $char_id, $slot);
|
|
|
|
|
} else if($action == 'leavechallenge') {
|
|
|
|
|
displayLeaveChallenge($user_ida, $clan_challange_id, $char_id);
|
|
|
|
|
} else if ($action == NULL) {
|
|
|
|
|
displayClanFightMenu($user_ida);
|
|
|
|
|
switch($action) {
|
|
|
|
|
case 'challengeclan':
|
|
|
|
|
displayChallengeClan($user_ida, $challangedclan_id);
|
|
|
|
|
break;
|
|
|
|
|
case 'acceptchallenge':
|
|
|
|
|
displayChallengeAccepted($user_ida, $inquirychallenge_clanid);
|
|
|
|
|
break;
|
|
|
|
|
case 'q_denychallenge':
|
|
|
|
|
displayDenyChallenge($inquirychallenge_clanid);
|
|
|
|
|
break;
|
|
|
|
|
case 'denychallenge':
|
|
|
|
|
denyChallengeRequest($inquirychallenge_clanid, $user_ida);
|
|
|
|
|
displayClanFightMenu($user_ida);
|
|
|
|
|
break;
|
|
|
|
|
case 'showchallenge':
|
|
|
|
|
displayShowChallenge($clan_challange_id, $user_ida);
|
|
|
|
|
break;
|
|
|
|
|
case 'showoldchallenge':
|
|
|
|
|
displayShowOldChallenge($clan_challange_id, $user_ida);
|
|
|
|
|
break;
|
|
|
|
|
case 'joinchallenge':
|
|
|
|
|
displayJoinChallenge($user_ida, $clan_challange_id, $char_id, $slot);
|
|
|
|
|
break;
|
|
|
|
|
case 'leavechallenge':
|
|
|
|
|
displayLeaveChallenge($user_ida, $clan_challange_id, $char_id);
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
displayClanFightMenu($user_ida);
|
|
|
|
|
}
|
|
|
|
|
?>
|
|
|
|
|
?>
|
|
|
|
|