function display($tpl = null) { // Assign data to the view $this->event = $this->get('Event'); $this->forceMapOpen = true; // Check for errors. if (count($errors = $this->get('Errors'))) { JError::raiseError(500, implode('<br />', $errors)); return false; } $document = JFactory::getDocument(); $this->mapJS($document); $containerID = strtolower($this->event->type) . "_" . $this->event->id; $document->addScriptDeclaration(<<<MAP window.addEvent('domready', function() { \tsetupEventsShared(); \tvar event= new Event(); \tevent.populateFromHTML({$containerID}); \tevent.setupMap(); \tevent.mapContainer.style.height = "400px"; \tevent.mapOpen = true; }); MAP ); // Display the view parent::display($tpl); }
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); }