/** * Download SensorData * * @access public * @return void */ public function download() { if ($this->input->post()) { $data["dateFrom"] = $this->input->post("from"); $data["dateTo"] = $this->input->post("to"); $data["interval"] = $this->input->post("interval"); $data["download"] = true; if ($this->input->post("region")) { $data["region"] = $this->input->post("region"); $data["station"] = null; $data["measurement"] = null; $data["multiple"] = true; } if ($this->input->post("station")) { $data["region"] = null; $data["station"] = $this->input->post("station"); $data["measurement"] = $this->input->post("measurement"); $data["multiple"] = false; } $result = (new Source($data))->get($this->_user); if (is_array($result)) { GlobalHelper::outputCsv("export-stations", $result, $data["station"]); exit; } else { redirect("/graph"); } } else { redirect("/graph"); } }