Jaxel
Well-known member
How do I get XenForo to export files?
For instance, I have event details, and I would like to export those event details in a CSV file.
I have tried the following with no luck:
Controller:
View:
For instance, I have event details, and I would like to export those event details in a CSV file.
I have tried the following with no luck:
Controller:
Code:
$this->_routeMatch->setResponseType('raw');
Code:
public function renderRaw()
{
$this->_params['ical'] = "BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//project/author//NONSGML v1.0//EN
CALSCALE:GREGORIAN
BEGIN:VEVENT
DTSTAMP:" . date('Ymd\Tgis\Z', XenForo_Application::$time) . "
DTSTART:" . date('Ymd\Tgis\Z', $this->_params['occur']['occur_start']) . "
DTEND:" . date('Ymd\Tgis\Z', $this->_params['occur']['occur_end']) . "
UID:" . $this->_params['occur']['occur_id'] . "
SUMMARY:" . htmlspecialchars($this->_params['occur']['event_title']) . "
END:VEVENT
END:VCALENDAR";
$this->_response->setHeader('Content-type: text/calendar; charset=utf-8', true);
$this->setDownloadFileName($this->_params['occur']['occur_id'] . '.ics');
return $this->_params['ical']->saveRaw();
}
Last edited: