function display($tpl = null)
    {
        // Assign data to the view
        $this->events = $this->get('Events');
        $this->protocolReminders = $this->get('ProtocolReminders');
        // Check for errors.
        if (count($errors = $this->get('Errors'))) {
            JError::raiseError(500, implode('<br />', $errors));
            return false;
        }
        $document = JFactory::getDocument();
        $this->mapJS($document);
        $totalEvents = $this->get('NumEvents');
        $apiParams = json_encode($this->get('ApiParams'));
        $userID = Jfactory::getUser()->id;
        $canRecordAttendance = SWG_EventsController::canRecordAttendance() ? 'true' : 'false';
        $document->addScript('/components/com_swg_events/views/eventlisting/script/eventlisting.js');
        $document->addScriptDeclaration(<<<MAP
window.addEvent('domready', function()
{
\tregisterMapLinks();
\tdocument.addEvent("scroll",scrolled);
\ttotalEvents = {$totalEvents};
\tapiParams = {$apiParams};
\tcanRecordAttendance = {$canRecordAttendance};
\tuserID = {$userID};
});
MAP
);
        // Display the view
        parent::display($tpl);
    }
                // TODO: Add attendees & tickbox to past events on bottomless page
                ?>
							<p><?php 
                echo $event->numAttendees;
                if ($event->numAttendees == 1) {
                    ?>
 person<?php 
                } else {
                    ?>
 people<?php 
                }
                ?>
 did this</p>
						<?php 
            }
            if (SWG_EventsController::canRecordAttendance()) {
                ?>
							<p>
								<a class="attendance" href="<?php 
                echo JURI::current();
                ?>
?<?php 
                echo JURI::buildQuery(array("task" => "attendance.attend", "evttype" => $event->getType(), "evtid" => $event->id, "set" => (int) (!$attended)));
                ?>
"
									><img src="/images/icons/<?php 
                if ($attended) {
                    ?>
tick<?php 
                } else {
                    ?>