public function exportAction() { $_type = $this->getRequest()->getParam("type"); $_table = null; if ($_type === "p") { $_table = new ParticipantsTable(); } else { if ($_type === "v") { $_table = new VoteTable(); } else { throw new Exception("What the hell? What do you mean with that?"); } } //TODO: Find the ZF equivalent... header("Content-type: application/csv"); header("Content-Disposition: attachment; filename=export.csv"); header("Pragma: no-cache"); header("Expires: 0"); $_result = $_table->toCsv(); echo $_result; exit; }