<?php

if (!defined('ACCOUNT_AREA')) {
  include(PATH . 'control/system/headers/403.php');
  exit;
}

include(LANG_FLDR . 'footer.php');
include(LANG_FLDR . 'referrals.php');

$loadJS[] = 'sort-table';
$sysTitle = $msw_footer[10] . ': ' . mswCD($SETTINGS->website);

include(PATH . 'control/system/modules/_header.php');

$PGS = new pages(array(
  'count' => $HTML->referrals(array(
    'id' => $loggedInUser['id'],
    'limit' => $limit,
    'count' => 'yes'
  )),
  'text' => $msw_pages,
  'page' => $page,
  'admin' => 'no',
  'flag' => '',
  'limit' => DEF_PER_PAGE,
  's' => $SETTINGS
));

$templateParams = [
  'TEXT' => $msw_referrals,
  'FTEXT' => $msw_footer,
  'REFERRALS' => $HTML->referrals([
    'id' => $loggedInUser['id'],
    'limit' => $limit,
    'lang' => [$msw_common, $msw_common2]
  ]),
  'TOTALS' => array(
    'ref' => $ACC->totals(['area' => 'referrals', 'id' => $loggedInUser['id']]),
    'uni' => $ACC->totals(['area' => 'uni-referrals', 'id' => $loggedInUser['id']])
  ),
  'PAGES' => $PGS->display()
];

// Global..
include(PATH . 'control/system/global.php');

$latte->render('acc-referrals.tpl', $templateParams);

include(PATH . 'control/system/modules/_footer.php');

?>
