* copy an existing report with the current navigation status * * @NoAdminRequired * @param int $reportId * @param $chartoptions * @param $dataoptions * @param $filteroptions * @return int * @throws Exception */
(int $reportId, $chartoptions, $dataoptions, $filteroptions, $tableoptions)
| 228 | * @throws Exception |
| 229 | */ |
| 230 | public function createCopy(int $reportId, $chartoptions, $dataoptions, $filteroptions, $tableoptions) { |
| 231 | |
| 232 | $template = $this->ReportMapper->readOwn($reportId); |
| 233 | $newId = $this->ReportMapper->create(// TRANSLATORS Noun |
| 234 | $template['name'] . ' - ' . $this->l10n->t('copy'), $template['subheader'], $template['parent'], $template['type'], $template['dataset'], $template['link'], $template['visualization'], $template['chart'], $template['dimension1'], $template['dimension2'], $template['value']); |
| 235 | $this->ReportMapper->updateOptions($newId, $chartoptions, $dataoptions, $filteroptions, $tableoptions); |
| 236 | |
| 237 | // Copy thresholds from original report to the new copy |
| 238 | $sourceThresholds = $this->ThresholdMapper->getThresholdsByReport($reportId); |
| 239 | foreach ($sourceThresholds as $threshold) { |
| 240 | $this->ThresholdMapper->create($newId, $threshold['dimension'], $threshold['value'], // This is 'target' aliased as 'value' in the query |
| 241 | $threshold['option'], $threshold['severity'], $threshold['coloring']); |
| 242 | } |
| 243 | |
| 244 | return $newId; |
| 245 | } |
| 246 | |
| 247 | /** |
| 248 | * create new report |
nothing calls this directly
no test coverage detected