<?php
require("inc/include.php");
require "inc/header.php";
?>
<div class="b-container">
    <div class="b-items-group b-items-5 b-items-cases">
    	<div class="b-trade-url-input-wrapper">
    		<nav class="b-breadcrumbs">

<h1><i class="fa fa-users" aria-hidden="true"></i> <?php echo $l->getString("Your referral link"); ?></h1>
</nav>

	        
	       <input value="http://www.skinbox.me/?ref=<?php echo $user->getId(); ?>" name="referralLink" id="referralLink" type="url" readonly> 
			
        </div>
		<div class="b-trade-url-input-wrapper">
    		<nav class="b-breadcrumbs">

<h1><i class="fa fa-key" aria-hidden="true"></i> <?php echo $l->getString("Your referral code"); ?></h1>
</nav>

	        
	       <input value="<?php echo $user->getId(); ?>" name="referralLink" id="referralLink" type="url" readonly> 
			
        </div>
        <br><br>
        <table id="referralsTable" style="color:#e88d1e">
        	<thead>
        		<tr>
        			<th><?php echo $l->getString("Date"); ?></th>
        			<th><?php echo $l->getString("Username"); ?></th>
        			<th><?php echo $l->getString("Status"); ?></th>
        		</tr>
        	</thead>
        	<tbody >
        		<?php
        		$referrals = $db->getUserReferrals($user->getId());
				foreach($referrals as $referral)
				{
					?>
					<tr style="background-color:#212327">
						<td><?php echo date("d/m/Y H:i", $referral['dateRegistered']); ?></td>
						<td><?php echo $referral['username']; ?></td>
						<td><?php echo ($db->isReferrerRewarded($referral['id']) ? $l->getString("Validated") : $l->getString("Registered")); ?></td>
					</tr>
					<?php
				}
				?>
        	</tbody>
        </table><br>
    </div>
    <div style="width:50%;float: left;text-align:center;">
		<iframe id="vid" style="width:100%;height:100%" src="https://www.youtube.com/embed/2JO3laumji8" frameborder="0" allowfullscreen></iframe>
    </div>
    <div class="b-footer-wrapper">
<?php
$additionnalScripts = '<script src="templates/default/js/referrals.js"></script>';
require "inc/footer.php";