/** * Export report data as CSV * * @param void * @return null */ function report_export() { if ($this->active_report->isNew()) { $this->httpError(HTTP_ERR_NOT_FOUND); } // if if (!$this->active_report->canView($this->logged_user)) { $this->httpError(HTTP_ERR_FORBIDDEN); } // if download_contents(array_to_csv(TimeReports::executeReportForExport($this->logged_user, $this->active_report, $this->active_project)), 'text/csv', "time-report.csv", true); }
/** * Delete existing report * * @param void * @return null */ function delete() { if ($this->active_report->isNew()) { $this->httpError(HTTP_ERR_NOT_FOUND); } // if if (!$this->active_report->canDelete($this->logged_user)) { $this->httpError(HTTP_ERR_FORBIDDEN); } // if if ($this->request->isSubmitted()) { $delete = $this->active_report->delete(); if ($delete && !is_error($delete)) { flash_success("Report ':name' has been deleted", array('name' => $this->active_report->getName())); } else { flash_error("Failed to delete ':name' report", array('name' => $this->active_report->getName())); } // if $this->redirectTo('global_time'); } // if }