Файл: pages/clan/hall-personal.php
Строк: 151
<?php
// Physical module map v50.6: public URL stays clean while code lives in /pages.
if (!defined('GAME_ROOT')) define('GAME_ROOT', dirname(__DIR__, 2));
chdir(GAME_ROOT);
if (PHP_SAPI !== 'cli') { $_SERVER['PHP_SELF']='/hall-personal.php'; $_SERVER['SCRIPT_NAME']='/hall-personal.php'; }
/* Личный Зал славы доступен только участникам собственного клана. by Метриум (Стэлп) */
require_once './system/common.php';
require_once './system/functions.php';
require_once './system/user.php';
if(!$user){ header('Location:/'); exit; }
game_hall_bootstrap();
$cm=game_hall_user_clan((int)$user['id']);
if(!$cm){ $_SESSION['err']='Зал славы доступен только участникам клана.'; header('Location:/clans/'); exit; }
$cid=(int)$cm['clan']; $uid=(int)$user['id']; $defs=game_hall_personal_defs(); $myRecords=game_hall_my_records($uid,$cid);
$title='Зал славы личных рекордов';
require './system/h.php';
?>
<div class="menu"><a href="/clan/">← <span class="yellow">Назад</span></a></div>
<div class="hall-slogan">Установи рекорд и увековечь своё имя в истории клана!</div>
<div class="hall-banner"><img src="/images/hall/records_banner.jpg" alt="Зал славы"></div>
<div class="hall-classic hall-clan-private">
<?php foreach($defs as $code=>$def):
$best=game_hall_personal_clan_best($cid,$code);
$attempt=game_hall_attempt_row('personal',$code,$uid);
$currentMetric=game_hall_personal_score($user,$def);
$score=$attempt ? max(0,$currentMetric-(int)($attempt['baseline_score']??0)) : (int)($myRecords[$code]['score']??0);
$target=$attempt ? max(1,(int)$attempt['target_score']) : game_hall_required_score('personal',$code,$cid);
$pct=$target>0?min(100,(int)floor($score/$target*100)):0;
$holder=null;
if((int)$best['holder_id']>0) $holder=db_fetch_assoc(db_query('SELECT `id`,`login`,`r` FROM `users` WHERE `id`='.(int)$best['holder_id'].' LIMIT 1'));
?>
<section class="hall-classic-record">
<div class="hall-classic-title"><img src="<?=security_html($def['icon'])?>" alt=""> <?=security_html($def['title'])?></div>
<div><?=security_html($def['description'])?></div>
<?php if($holder): ?><div class="hall-best">Рекорд клана: <img src="/images/icon/race/<?=(int)$holder['r']?>.png" alt=""> <a href="/user/<?=(int)$holder['id']?>/"><?=security_html($holder['login'])?></a> — <span class="dgreen"><?=n_f((int)$best['score'])?></span></div><?php else: ?><div class="grey">Рекорд пока не установлен</div><?php endif; ?>
<div><span class="hall-blue"><?=$attempt?'Прогресс':'Твой рекорд'?>:</span> <?php if(!$attempt && $score<=0): ?><span class="red">не установлен</span><?php else: ?><?=n_f($score)?><?php if($attempt): ?> из <?=n_f($target)?> <span class="grey">(осталось <?=n_f(max(0,$target-$score))?>)</span><?php endif; ?><?php endif; ?></div>
<?php if($attempt): ?><div class="hall-classic-progress"><span style="width:<?=$pct?>%"></span></div><?php endif; ?>
<div><img src="/images/icon/equip.png" alt=""> <b>Бонус за первый установленный рекорд:</b> <span class="dgreen">+200 к сумме параметров</span></div>
<div class="hall-record-form">
<?php if($attempt):
$runner=db_fetch_assoc(db_query('SELECT `id`,`login`,`r` FROM `users` WHERE `id`='.(int)($attempt['actor_user']?:$uid).' LIMIT 1')) ?: $user;
?>
<div class="hall-runner">Выполняет: <img src="/images/icon/race/<?=(int)($runner['r']??0)?>.png" alt=""> <a href="/user/<?=(int)($runner['id']??$uid)?>/"><?=security_html((string)($runner['login']??$user['login']))?></a> <span class="white">(осталось: <b data-hall-until="<?=(int)$attempt['expires_at']?>"><?=_time(max(0,(int)$attempt['expires_at']-time()))?></b>)</span></div>
<a class="btn" href="<?=security_html(game_hall_target('personal',$code))?>"><span class="end"><span class="label">Перейти к выполнению</span></span></a><br>
<a class="hall-cancel-link" href="/hall-confirm/?scope=personal&code=<?=urlencode($code)?>">Отменить задание</a>
<?php else: ?>
<form action="/hall-action/" method="post" class="hall-start-form"><?=security_csrf_field()?>
<input type="hidden" name="scope" value="personal"><input type="hidden" name="code" value="<?=security_html($code)?>">
<button class="btn" type="submit" name="start" value="1"><span class="end"><span class="label"><?=((int)$best['holder_id']>0?'Побить рекорд':'Установить рекорд')?></span></span></button>
</form>
<?php endif; ?>
</div>
</section>
<?php endforeach; ?>
</div>
<div class="menu hall-my-link"><a href="/hall-personal/my/"><img src="/images/hall/book.png" alt=""> <span class="yellow">Мои рекорды</span></a></div>
<div class="menu"><a href="/clan/">← <span class="yellow">Назад</span></a></div>
<?php require './system/f.php'; ?>