|
|
|
@ -218,69 +218,6 @@ 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) {
|
|
|
|
@ -399,20 +336,20 @@ function displayClanFightMenuWithClanLocked($user) {
|
|
|
|
|
}
|
|
|
|
|
?>
|
|
|
|
|
<tr>
|
|
|
|
|
<th height="30" colspan="3" align="center">Beendete Herausforderungen</th>
|
|
|
|
|
<th height="30" colspan="5" align="center">Beendete Herausforderungen</th>
|
|
|
|
|
</tr>
|
|
|
|
|
<tr>
|
|
|
|
|
<?php
|
|
|
|
|
if(count($old_challenge_ids) == 0) {
|
|
|
|
|
echo '<td height="20" colspan="3" align="center">Keine</td>';
|
|
|
|
|
echo '<td height="20" colspan="5" align="center">Keine</td>';
|
|
|
|
|
} 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><td> '.$challenged_clan['clanname'].'</td>';
|
|
|
|
|
echo '<td align="center"><a href="index.php?as=clan/kampf_info&action=showoldchallenge&challenge='.$oci.'">'.anzeigen.'</a></td></tr>';
|
|
|
|
|
echo '<tr><td align="center" colspan="2"> '.$challenged_clan['clanname'].'</td>';
|
|
|
|
|
echo '<td align="center" colspan="3"><a href=\'javascript:showFight('.$oci.');\'>'.anzeigen.'</a></td></tr>';
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -436,6 +373,8 @@ function displayClanFightMenu($user) {
|
|
|
|
|
$open_challenge_ids = getOpenChallengeIDs($user_clan['id']);
|
|
|
|
|
$old_challenge_ids = getHistoricalChallengeIDs($user_clan['id']);
|
|
|
|
|
|
|
|
|
|
$authorized = isAuthorizedClanfightCoordinator($user_clan['id'], $user['id']);
|
|
|
|
|
|
|
|
|
|
?>
|
|
|
|
|
<SCRIPT language="JavaScript">
|
|
|
|
|
function showFight(challenge_id){
|
|
|
|
@ -444,7 +383,8 @@ function displayClanFightMenu($user) {
|
|
|
|
|
</SCRIPT>
|
|
|
|
|
|
|
|
|
|
<div align="center">
|
|
|
|
|
<table width="100%" border="1">
|
|
|
|
|
<table width="500">
|
|
|
|
|
<?php if($authorized) {?>
|
|
|
|
|
<tr>
|
|
|
|
|
<th height="30" colspan="5" align="center">Herausforderungen</th>
|
|
|
|
|
</tr>
|
|
|
|
@ -496,6 +436,7 @@ function displayClanFightMenu($user) {
|
|
|
|
|
}
|
|
|
|
|
?>
|
|
|
|
|
</tr>
|
|
|
|
|
<?php }?>
|
|
|
|
|
<tr>
|
|
|
|
|
<th height="30" colspan="5" align="center">offene Herausforderungen</th>
|
|
|
|
|
</tr>
|
|
|
|
@ -512,7 +453,9 @@ function displayClanFightMenu($user) {
|
|
|
|
|
echo '<tr>';
|
|
|
|
|
echo '<td colspan="2"> '.$challenged_clan['clanname'].'</td>';
|
|
|
|
|
echo '<td align="center" colspan="2"><a href="index.php?as=clan/kampf_info&action=showchallenge&challenge='.$oci.'">'.anzeigen.'</a></td>';
|
|
|
|
|
echo '<td align="center"><a href="index.php?as=clan/kampf_info&action=q_cancelclanchallenge&challenge='.$oci.'">'.abbrechen.'</a></td>';
|
|
|
|
|
if($authorized) {
|
|
|
|
|
echo '<td align="center"><a href="index.php?as=clan/kampf_info&action=q_cancelclanchallenge&challenge='.$oci.'">'.abbrechen.'</a></td>';
|
|
|
|
|
}
|
|
|
|
|
echo '</tr>';
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -532,8 +475,6 @@ function displayClanFightMenu($user) {
|
|
|
|
|
if($pci != $user_clan['id']) {
|
|
|
|
|
$challenged_clan = getClan($pci);
|
|
|
|
|
echo '<tr><td align="center" colspan="2"> '.$challenged_clan['clanname'].'</td>';
|
|
|
|
|
//TODO: hier muss javascript fenster aufgerufen werden
|
|
|
|
|
//echo '<td align="center" colspan="3"><a href="index.php?as=clan/kampf_info&action=showoldchallenge&challenge='.$acci.'">'.anzeigen.'</a></td></tr>';
|
|
|
|
|
echo '<td align="center" colspan="3"><a href=\'javascript:showFight('.$acci.');\'>'.anzeigen.'</a></td></tr>';
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -544,16 +485,23 @@ function displayClanFightMenu($user) {
|
|
|
|
|
</tr>
|
|
|
|
|
<tr>
|
|
|
|
|
<?php
|
|
|
|
|
if(count($old_challenge_ids) == 0) {
|
|
|
|
|
$count = count($old_challenge_ids);
|
|
|
|
|
if($count == 0) {
|
|
|
|
|
echo '<td height="20" colspan="5" align="center">Keine</td>';
|
|
|
|
|
} else {
|
|
|
|
|
foreach ($old_challenge_ids as $oci) {
|
|
|
|
|
$participating_clan_ids = getParticipatingClanIDs($oci);
|
|
|
|
|
if($count > 20) {
|
|
|
|
|
$max = 20;
|
|
|
|
|
} else {
|
|
|
|
|
$max = $count;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for ($i = 0; $i < $max; $i++) {
|
|
|
|
|
$participating_clan_ids = getParticipatingClanIDs($old_challenge_ids[$i]);
|
|
|
|
|
foreach ($participating_clan_ids as $pci)
|
|
|
|
|
if($pci != $user_clan['id']) {
|
|
|
|
|
$challenged_clan = getClan($pci);
|
|
|
|
|
echo '<tr><td align="center" colspan="2"> '.$challenged_clan['clanname'].'</td>';
|
|
|
|
|
echo '<td align="center" colspan="3"><a href=\'javascript:showFight('.$oci.');\'>'.anzeigen.'</a></td></tr>';
|
|
|
|
|
echo '<td align="center" colspan="3"><a href=\'javascript:showFight('.$old_challenge_ids[$i].');\'>'.anzeigen.'</a></td></tr>';
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -585,9 +533,6 @@ if(!isClanLocked($user_ida['clan'])) {
|
|
|
|
|
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;
|
|
|
|
@ -605,9 +550,6 @@ if(!isClanLocked($user_ida['clan'])) {
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
switch($action) {
|
|
|
|
|
case 'showoldchallenge':
|
|
|
|
|
displayShowOldChallenge($clan_challange_id, $user_ida);
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
displayClanFightMenuWithClanLocked($user_ida);
|
|
|
|
|
}
|
|
|
|
|