/** * @return string */ protected function renderFiltersContent($form) { assert('$form instanceof ZurmoActiveForm'); $content = null; $report = SavedCalendarToReportAdapter::makeReportBySavedCalendar($this->model); $adapter = new ReportToWizardFormAdapter($report); $reportWizardForm = $adapter->makeRowsAndColumnsWizardForm(); $filtersForReportWizardViewClassName = static::getFiltersForReportWizardViewClassName(); $filtersForReportWizardView = new $filtersForReportWizardViewClassName($reportWizardForm, $form, false); $content .= $filtersForReportWizardView->render(); $this->registerFiltersScripts(); $this->registerModuleClassNameChangeScript(); $this->registerFiltersCss(); return $content; }
/** * @param Report $report * @param bool $isBeingCopied - whether the model is being copied to 'Save As' or not. * @return View * @throws NotSupportedException if the type provided is not valid */ public static function makeViewFromReport(Report $report, $isBeingCopied = false) { assert('is_bool($isBeingCopied)'); $type = $report->getType(); $reportToWizardFormAdapter = new ReportToWizardFormAdapter($report); if ($type == Report::TYPE_ROWS_AND_COLUMNS) { $viewClassName = 'RowsAndColumnsReportWizardView'; $form = $reportToWizardFormAdapter->makeRowsAndColumnsWizardForm(); } elseif ($type == Report::TYPE_SUMMATION) { $viewClassName = 'SummationReportWizardView'; $form = $reportToWizardFormAdapter->makeSummationWizardForm(); } elseif ($type == Report::TYPE_MATRIX) { $viewClassName = 'MatrixReportWizardView'; $form = $reportToWizardFormAdapter->makeMatrixWizardForm(); } else { throw new NotSupportedException(); } return new $viewClassName($form, $isBeingCopied); }