/** * * @return \CsvWriter */ protected function get_writer() { if ($this->writer) { return $this->writer; } $writer = \CsvWriter::create(new \FileWriter($this->path)); $this->writer = $writer; return $writer; }
public function export_csv() { $c_id = Request::get_c_id(); $session_id = Request::get_session_id(); $course = (object) array(); $course->c_id = $c_id; $course->session_id = $session_id; $descriptions = CourseDescription::repository()->find_by_course($course); $writer = new CsvWriter(); $writer->add($descriptions); $path = $writer->get_path(); \DocumentManager::file_send_for_download($path, true, get_lang('CourseDescriptions') . '.csv'); }