Skip to content

Commit

Permalink
Initial support for defining dynamic headers for a dataset.
Browse files Browse the repository at this point in the history
  • Loading branch information
jdorn committed Nov 12, 2013
1 parent a956e30 commit e61ed71
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
8 changes: 8 additions & 0 deletions classes/headers/FormattingHeader.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
14 changes: 14 additions & 0 deletions lib/PhpReports/Report.php
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down

0 comments on commit e61ed71

Please sign in to comment.