/** * Contains the logic to render a report and its children. * * @param common_report_Report $report A report to be rendered. * @param array $childRenderedReports An array of strings containing the separate rendering of $report's child reports. * @param integer $nesting The current nesting level (root = 0). * @return string The HTML output of $report. */ private static function renderReport(common_report_Report $report, array $childRenderedReports = array(), $nesting = 0, $leaf = false) { switch ($report->getType()) { case common_report_Report::TYPE_SUCCESS: $typeClass = 'success'; break; case common_report_Report::TYPE_WARNING: $typeClass = 'warning'; break; case common_report_Report::TYPE_ERROR: $typeClass = 'error'; break; default: $typeClass = 'info'; break; } $openingTag = '<div class="feedback-' . $typeClass . ' feedback-nesting-' . $nesting . ' ' . ($leaf === true ? 'leaf' : 'hierarchical') . ' tao-scope">'; $leafIcon = $leaf === true ? ' leaf-icon' : ' hierarchical-icon'; $icon = '<span class="icon-' . $typeClass . $leafIcon . '"></span>'; $message = nl2br(_dh($report->__toString())); $endingTag = '</div>'; $okButton = '<p><button id="import-continue" class="btn-info"><span class="icon-right"></span>' . __("Continue") . '</button></p>'; // Put all the children renderings together. $content = implode('', $childRenderedReports); return $openingTag . $icon . $message . $content . ($nesting != 0 ? '' : $okButton) . $endingTag; }