Now an adjusted clan-fight menu is shown if a clan is locked. Containing the active and historical fights. Also a timer is presented showing how long the clan will be locked.

main
hecht 13 years ago
parent 1af670a914
commit 3c68f15b37

@ -358,6 +358,70 @@ function getFightType($id) {
}
}
function displayClanFightMenuWithClanLocked($user) {
$user_clan = getClan($user['clan']);
$active_clan_challange_ids = getActiveChallengeIDs($user_clan['id']);
$old_challenge_ids = getHistoricalChallengeIDs($user_clan['id']);
?>
<div align="center">
<table width="100%" border="1">
<tr>
<th height="30" colspan="3" align="center">Herausforderungen</th>
</tr>
<tr>
<th height="30" colspan="3" align="center">Dein Clan ist leider dezeit Blockiert ( <?php
$time = getClanLockedTime($user['clan']);
if($time >= 86400) { // 24*60*60
echo 'Voraussetzungen nicht erf&uuml;llt!!';
} else {
echo generateTimerHtml('blubb', $time, '<a href=\'\'>Blockade beenden</a>');
}
?>)</th>
</tr>
<tr>
<th height="30" colspan="3" align="center">Laufende Herausforderungen</th>
</tr>
<?php
if(count($active_clan_challange_ids) == 0) {
echo '<td height="20" colspan="3" align="center">Keine</td>';
} else {
foreach ($active_clan_challange_ids as $acci) {
$participating_clan_ids = getParticipatingClanIDs($acci);
foreach ($participating_clan_ids as $pci)
if($pci != $user_clan['id']) {
$challenged_clan = getClan($pci);
echo '<tr><td align="center"> '.$challenged_clan['clanname'].'</td>';
//TODO: hier muss javascript fenster aufgerufen werden
echo '<td align="center"><a href="index.php?as=clan/kampf_info&action=showoldchallenge&challenge='.$acci.'">'.anzeigen.'</a></td></tr>';
}
}
}
?>
<tr>
<th height="30" colspan="3" align="center">Beendete Herausforderungen</th>
</tr>
<tr>
<?php
if(count($old_challenge_ids) == 0) {
echo '<td height="20" colspan="3" 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>';
}
}
}
?>
</tr>
</table>
</div>
<?php
}
function displayClanFightMenu($user) {
$user_clan = getClan($user['clan']);
$clans_tmp = getClanFightCapableClanIds();
@ -498,41 +562,52 @@ function displayClanFightMenu($user) {
<?php
}
switch($action) {
case 'challengeclan':
displayChallengeClan($user_ida, $challangedclan_id);
break;
case 'acceptclanchallenge':
displayChallengeAccepted($user_ida, $inquirychallenge_clanid);
break;
case 'q_denyclanchallenge':
displayDenyChallenge($inquirychallenge_clanid, DENY_CHALLENGE);
break;
case 'q_withdrawclanchallenge':
displayDenyChallenge($inquirychallenge_clanid, WITHDRAW_CHALLENGE);
break;
case 'denychallenge':
denyChallenge($type, $inquirychallenge_clanid, $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;
case 'q_cancelclanchallenge':
displayCancelChallenge($user_ida, $clan_challange_id);
break;
case 'cancelchallenge':
cancelThisChallenge($user_ida, $clan_challange_id);
break;
default:
displayClanFightMenu($user_ida);
if(!isClanLocked($user_ida['clan'])) {
switch($action) {
case 'challengeclan':
displayChallengeClan($user_ida, $challangedclan_id);
break;
case 'acceptclanchallenge':
displayChallengeAccepted($user_ida, $inquirychallenge_clanid);
break;
case 'q_denyclanchallenge':
displayDenyChallenge($inquirychallenge_clanid, DENY_CHALLENGE);
break;
case 'q_withdrawclanchallenge':
displayDenyChallenge($inquirychallenge_clanid, WITHDRAW_CHALLENGE);
break;
case 'denychallenge':
denyChallenge($type, $inquirychallenge_clanid, $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;
case 'q_cancelclanchallenge':
displayCancelChallenge($user_ida, $clan_challange_id);
break;
case 'cancelchallenge':
cancelThisChallenge($user_ida, $clan_challange_id);
break;
default:
displayClanFightMenu($user_ida);
}
} else {
switch($action) {
case 'showoldchallenge':
displayShowOldChallenge($clan_challange_id, $user_ida);
break;
default:
displayClanFightMenuWithClanLocked($user_ida);
}
}
?>

@ -427,6 +427,9 @@ function getParticipatingCharIDs($clan_challenge_id, $clan_id) {
}
function getClanLockedTime($clan_id) {
if(!isClanLocked($clan_id)) {
return 0;
}
$sql = 'SELECT TIMESTAMPDIFF(SECOND, NOW(), locked_until) FROM clan_locked WHERE clanid = ' . $clan_id;
$row = mysql_fetch_row(mysql_query($sql));
if($row)

@ -166,7 +166,7 @@ function displayCount($value){
function generateTimerHtml($timerId, $timeInSeconds, $htmlOnExpire) {
?>
<div align='center' id='timer_<?php echo $timerId; ?>'>
<span id='timer_<?php echo $timerId; ?>'>
<?php
if($timeInSeconds <= 0){
echo $htmlOnExpire;
@ -204,7 +204,7 @@ function generateTimerHtml($timerId, $timeInSeconds, $htmlOnExpire) {
<?php
}
?>
</div>
</span>
<?php
}

Loading…
Cancel
Save