$user = cmsUser::getInstance();
$this->setPageTitle(LANG_BILLING_REFS);
$this->addBreadcrumb(LANG_USERS, href_to('users'));
$this->addBreadcrumb($user->nickname, href_to('users', $user->id));
$this->addBreadcrumb(LANG_BILLING_BALANCE, href_to('users', $user->id, 'balance'));
$this->addBreadcrumb(LANG_BILLING_REFS);
$ref_url = sprintf(href_to_abs('r', '%d'), $user->id);
$terms_url = $this->controller->options['ref_terms'];
$ref_bonus = $this->controller->options['ref_bonus'];
$ref_levels = $this->controller->options['ref_levels'];
$ref_mode = $this->controller->options['ref_mode'];
$b_spellcount = $this->controller->options['currency'];
?>
<h1><?php echo LANG_BILLING_REFS; ?></h1>
<div id="billing-refs">
<div class="note">
<?php echo LANG_BILLING_REFS_NOTE; ?>
</div>
<div class="link gui-panel">
<h4><?php echo LANG_BILLING_REFS_LINK; ?></h4>
<div class="url">
<a href="<?php echo $ref_url; ?>"><?php echo $ref_url; ?></a>
</div>
</div>
<div class="income">
<p><?php echo LANG_BILLING_REFS_INCOME; ?>:</p>
<ul>
<?php if ($ref_bonus) { ?>
<li><?php printf(LANG_BILLING_REFS_INCOME_REG, html_spellcount($ref_bonus, $b_spellcount)); ?></li>
<?php } ?>
<?php foreach($ref_levels as $level=>$percent) {?>
<?php if ($ref_mode == 'dep') { ?>
<li><?php printf(LANG_BILLING_REFS_INCOME_DEP, $percent.'%', $level+1); ?></li>
<?php } ?>
<?php if ($ref_mode == 'all') { ?>
<li><?php printf(LANG_BILLING_REFS_INCOME_ALL, $percent.'%', $level+1); ?></li>
<?php } ?>
<?php } ?>
</ul>
</div>
<div class="legal">
<p><?php echo LANG_BILLING_REFS_LEGAL; ?></p>
<?php if ($terms_url){ ?>
<p><a href="<?php echo $terms_url; ?>"><?php echo LANG_BILLING_REFS_TERMS; ?></a></p>
<?php } ?>
</div>
</div>
<?php if ($refs) { ?>
<div class="billing-history">
<?php
$this->renderChild('refs_history', array(
'refs' => $refs,
'total' => $total,
'page' => $page,
'perpage' => $perpage
));
?>
</div>
<?php } ?>