public function generate($id = 0)
 {
     $data = array();
     $data['reports'] = Reports::getList();
     $reports = Reports::getList();
     $data['reports'] = $reports;
     # report
     $report = Reports::getReportById($id);
     $data['report'] = $report;
     if (count($report) > 0) {
         # get all files under this report
         $reportFiles = ReportFile::getReportFilesById($report->report_id);
         # get all version and sheets under this report
         for ($i = 0; $i < count($reportFiles); $i++) {
             // get current version
             $currentFileVersion = ReportFileVersion::getCurrentVersion($reportFiles[$i]->file_id);
             $reportFiles[$i]->currentFileVersion = $currentFileVersion;
             // get all file versions
             $allFileVersion = ReportFileVersion::getAllVersion($reportFiles[$i]->file_id);
             $reportFiles[$i]->allFileVersion = $allFileVersion;
             // get sheets
             $reportSheets = ReportFileSheets::getSheetsByVersionId($currentFileVersion->version_id);
             $reportFiles[$i]->reportSheets = $reportSheets;
         }
     } else {
         $reportFiles = array();
     }
     $data['report_files'] = $reportFiles;
     return view($this->viewPath . 'generate', $data);
 }
Пример #2
0
 /**
  * Shows the list of reports
  *
  * @return Response
  */
 public function index()
 {
     $data = array();
     $data['records'] = Reports::getList();
     return view($this->viewPath . 'list', $data);
 }