/** * Exports a task in either GanttProject or MSProject format * */ public function exportAction() { $project = $this->byId(null, 'Project'); $includeComplete = $this->_getParam('includecompleted', false); $type = $this->_getParam('importtype'); $from = $this->_getParam('from'); $to = $this->_getParam('to'); $export = $this->projectService->exportTasks($project, $type, $includeComplete, $from, $to); $template = ''; switch ($type) { case 'gp': $template = 'task/export-gp.php'; break; case 'ms': $template = 'task/export-ms.php'; break; default: throw new Exception("Invalid export type"); } $this->view->export = $export; $this->_response->setHeader('Content-type', 'text/csv'); $this->_response->setHeader("Content-Disposition", "inline; filename=\"export-{$type}.csv\""); $this->renderRawView($template); }