You are here

public function AcquiaLiftReportBase::buildConversionReport in Acquia Lift Connector 7

Implements AcquiaLiftReportInterface()::buildConversionReport().

Overrides AcquiaLiftReportInterface::buildConversionReport

File

plugins/agent_types/AcquiaLiftAgent.inc, line 1232
Provides an agent type for Acquia Lift

Class

AcquiaLiftReportBase
Base class providing report data loading functionality common to all Acquia Lift Reports.

Code

public function buildConversionReport($options) {
  $report_data = $this
    ->generateReportConfiguration($options);
  $report_name = t('All goals');
  $report_options = array();
  if (!empty($options['goal'])) {

    // Get the summary data for the whole campaign in order to have overall
    // statistics.
    $this
      ->loadConversionReportHelper($report_data, FALSE, $options);
    $report_options['goal'] = $options['goal'];
    $actions = visitor_actions_get_actions();

    // If the action still exists, use the label, otherwise just use the goal
    // machine name.
    if (isset($actions[$options['goal']])) {
      $report_name = $actions[$options['goal']]['label'];
    }
    else {
      $report_name = $options['goal'];
    }
  }
  $this
    ->loadConversionReportHelper($report_data, TRUE, $report_options);
  $this
    ->loadConversionReportHelper($report_data, FALSE, $report_options);
  $reports = $this
    ->buildConversionReports(array(
    'name' => $report_name,
    'detail' => empty($options['goal']) ? $report_data['conversion_all']['detail'] : $report_data['conversion_goals'][$options['goal']]['detail'],
    'summary' => empty($options['goal']) ? $report_data['conversion_all']['summary'] : $report_data['conversion_goals'][$options['goal']]['summary'],
  ), $report_data);
  return $reports;
}