You are here

public function AcquiaLiftReport::buildCampaignReports in Acquia Lift Connector 7

Implements PersonalizeAgentReportInterface::buildCampaignReports().

File

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

Class

AcquiaLiftReport
Responsible retrieving and generating reports on the Acquia Lift agent.

Code

public function buildCampaignReports($options) {
  $report_data = $this
    ->loadReportData($options);
  $reports = array(
    'overview' => $this
      ->buildOverviewReport($report_data),
    'experiment' => $this
      ->buildAllConversionReports($report_data),
    'context' => $this
      ->buildContextReport($report_data),
    'stability' => $this
      ->buildStabilityReport($report_data),
    'targeting' => $this
      ->buildReportContextSelection($report_data),
  );
  $reports['#has_data'] = isset($reports['overview']['shown']['#title']) ? $reports['overview']['shown']['#title'] > 0 : FALSE;
  if (!is_array($report_data['status']) || !is_array($report_data['confidence']) || !is_array($report_data['targeting']) || !is_array($report_data['potential_context'])) {
    drupal_set_message(t('There was a problem retrieving the report data.  Please try again later.'), 'error');
  }
  else {
    if ($reports['#has_data'] && $report_data['status']['all']['total_confident'] == 0) {
      drupal_set_message($this
        ->getLowConfidenceMessage(), 'warning');
    }
  }
  return $reports;
}