diff --git a/classes/headers/FormattingHeader.php b/classes/headers/FormattingHeader.php index f0cda581..f5e9edf3 100644 --- a/classes/headers/FormattingHeader.php +++ b/classes/headers/FormattingHeader.php @@ -34,12 +34,20 @@ class FormattingHeader extends HeaderBase { 'dataset'=>array( 'required'=>true, 'default'=>true + ), + 'has_charts'=>array( + 'type'=>'boolean' ) ); public static function init($params, &$report) { if(!isset($report->options['Formatting'])) $report->options['Formatting'] = array(); $report->options['Formatting'][] = $params; + + if(isset($params['has_charts']) && $params['has_charts']) { + $report->options['has_charts'] = true; + if(!isset($report->options['Charts'])) $report->options['Charts'] = array(); + } } public static function parseShortcut($value) { diff --git a/lib/PhpReports/Report.php b/lib/PhpReports/Report.php index f4a4af07..3c8ef478 100644 --- a/lib/PhpReports/Report.php +++ b/lib/PhpReports/Report.php @@ -412,6 +412,20 @@ protected function _runReport() { } $this->options['DataSets'] = $datasets; + + $this->parseDynamicHeaders(); + } + + protected function parseDynamicHeaders() { + foreach($this->options['DataSets'] as $i=>&$dataset) { + if(isset($dataset['headers'])) { + foreach($dataset['headers'] as $j=>$header) { + if(isset($header['header']) && isset($header['value'])) { + $this->parseHeader($header['header'],$header['value']); + } + } + } + } } protected function getTimeEstimate() {