Exemple #1
0
 public function report($report_file_signature)
 {
     $reports = $this->db->getReports($report_file_signature);
     //Check if report exists
     if (!empty($reports)) {
         $project = $this->db->getProjectInfo($reports[0]['project_id']);
         $file_name = $reports[0]['report_file'];
         $reports_template = new Views('templates/reports.tpl.php');
         $reports_template->set('header', $reports_template->addHeader());
         $reports_template->set('footer', $reports_template->addFooter());
         $reports_template->set('file_name', $file_name);
         foreach ($project as $key => $value) {
             $reports_template->set($key, $value);
         }
         foreach ($reports as $id => $reports_list) {
             $code = (array) json_decode($reports_list['report_code']);
             $reports_table = new Views('templates/report_info.tpl.php');
             $reports_table->set('report_id', $reports_list['report_id']);
             $reports_table->set('report_language', $reports_list['report_language']);
             $reports_table->set('report_type', $reports_list['report_type']);
             $reports_table->set('report_line', $reports_list['report_line']);
             $reports_table->set('report_code', htmlentities(implode($code)));
             $reports_table->set('report_first_line', key($code));
             $reports_table->set('report_ticket', $reports_list['report_ticket']);
             $reports_table->set('report_false', $reports_list['report_false'] == 0 ? 'false' : '');
             $reports_data[$id] = $reports_table;
         }
         $reports_contest = Views::merge($reports_data);
         $reports_template->set('project_reports', $reports_contest);
         print $reports_template->render();
     }
     //If not redirect to /
     header('Location: /');
     die;
 }