public function __construct($events)
 {
     parent::__construct('addToBasket', 'Add event to Basket');
     $this->eventsSel = new ElementSelect('event', 'Event');
     $events = $this->removeEventsAlreadyInBasket($events);
     $events = $this->removeEventsAlreadySignedupFor($events);
     $this->hasEvents = false;
     $this->ticketCosts = $this->getTicketCosts();
     foreach ($events as $event) {
         $this->hasEvents = true;
         $this->eventsSel->addOption($event['name'] . ' - ' . doubleToGbp($this->ticketCosts[$event['id']]), $event['id']);
     }
     $this->addElement(new ElementHtml('desc', null, 'If you cannot see the event you want in the list, you need to sign up to it first!'));
     $this->addElement($this->eventsSel);
     $this->addElement(new ElementHidden('action', null, 'add'));
     $this->addDefaultButtons('Add ticket for myself to basket');
 }
        break;
    case 'paypalFail':
        logAndRedirect('account.php', 'Paypal transaction failed.');
        break;
    case 'paypalComplete':
        logActivity('Started processing PayPal payment notification');
        foreach (Basket::getContents() as $ticket) {
            logActivity('PayPal transaction processing - setting status to PAID for event. Ticket owner _u_, event _e_', $ticket['userId'], array('event' => $ticket['eventId'], 'user' => Session::getUser()->getId()));
            Events::setSignupStatus($ticket['userId'], $ticket['eventId'], 'PAID');
        }
        logActivity('Finished processing PayPal payment notification.');
        Basket::clear();
        redirect('account.php', 'Thanks, payment complete!');
        break;
    default:
        require_once 'includes/widgets/header.php';
        require_once 'includes/widgets/sidebar.php';
        startBox();
        echo str_replace('%BASKETTOTAL%', doubleToGbp($cost), getContent('selectPaymentMethod'));
        $tpl->assign('cost', $cost);
        $tpl->assign('costPaypal', getPaypalCommission($cost));
        $tpl->assign('paypalEmail', getSiteSetting('paypalEmail'));
        $tpl->assign('listBasketContents', Basket::getContents());
        $tpl->assign('baseUrl', getSiteSetting('baseUrl'));
        $tpl->assign('currency', getSiteSetting('currency'));
        $tpl->display('checkout.tpl');
        echo getContent('commissionDisclaimer');
        stopBox('Checkout');
}
box('If you are not yet finished, pop back to your <a href = "basket.php">basket</a>.', 'Agh, no!');
require_once 'includes/widgets/footer.php';
<?php

require_once 'includes/common.php';
require_once 'includes/classes/Events.php';
require_once 'includes/classes/Schedule.php';
use libAllure\Session;
use libAllure\Sanitizer;
$id = Sanitizer::getInstance()->filterUint('id');
try {
    $event = Events::getById($id);
} catch (Exception $e) {
    $tpl->error('Could not get event');
}
$event['priceInAdvWithCurrency'] = doubleToGbp($event['priceInAdv']);
$event['priceOnDoorWithCurrency'] = doubleToGbp($event['priceOnDoor']);
//$tpl->clear_assign('form');
if (Session::hasPriv('FORCE_SIGNUP')) {
    require_once 'includes/classes/FormForceSignup.php';
    $formForceSignup = new FormForceSignup($event['id']);
    if ($formForceSignup->validate()) {
        $formForceSignup->process();
    }
}
require_once 'includes/widgets/header.php';
if (!Session::hasPriv('VIEW_SIGNUP_COMMENTS')) {
    require_once 'includes/widgets/sidebar.php';
}
if (Session::isLoggedIn()) {
    $notifications = array();
    checkNotificationNotGuarenteedSeats($notifications);
    $tpl->assign('notifications', $notifications);