<?php
$setup = array();
$setup['title'] = "Bestil";
$setup['headline'] = "Odense Track - Bestil";
$setup['keywords'] = "bestil,bestilnu,betal,order";
$setup['description'] = "Odense Track Bestillingsside";

if (isset($_GET['rem'])) {
    Alter::attentDel($_SESSION['user'],$_GET['rem']);
    header('Location: '.Config::$sys_url.'?page=order&rel=success');
    die();
}

if (isset($_GET['att'])) {
    
    Alter::attentAdd($_SESSION['user'],$_GET['att']);
    
    header('Location: '.Config::$sys_url.'?page=order&rel=success');
    die();
}

Design::header($setup, 25);
?>

<div class="page">
    <h1>Bestil</h1>
    <div class="border"></div>
    <br />
    <p>Bestil en billet til event.</p>
    <?php
    foreach (Get::attentEventList() as $row) {
        ?>
    
        <div class="eventslice">
        <div class="eventslice-top"><img src="<?php echo $row['img']; ?>" alt="" /></div>
        <div class="eventslice-middle"><?php echo $row['title']; ?></div>
        
        <?php
        if (Get::attentDouble($_SESSION['user'],$row['id']) == true){
        ?>
        <div class="eventslice-bottom"><a href="?page=order&rem=<?php echo $row['id']; ?>"><button>Afmeld</button></a></div>
        <?php
        } else {
        ?>
        <div class="eventslice-bottom"><a href="?page=order&att=<?php echo $row['id']; ?>"><button>Tilmeld</button></a></div>
        <?php
        }
        ?>
        
        </div>
        
        
        <?php
    }
    ?>
    <div class="clear"></div>

</div>

<?php
Design::footer(false);
