You are here

protected function AcquiaLiftReport::buildOverviewReport in Acquia Lift Connector 7

Returns a render array representing the overview report for the given dates.

Parameters

array $report_data: All of the reporting data for the campaign.

Return value

array A render array representing the overview report.

1 call to AcquiaLiftReport::buildOverviewReport()
AcquiaLiftReport::buildCampaignReports in plugins/agent_types/AcquiaLiftAgent.inc
Implements PersonalizeAgentReportInterface::buildCampaignReports().

File

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

Class

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

Code

protected function buildOverviewReport($report_data) {
  $report = $report_data['status'];
  if ($report === FALSE) {
    return array();
  }
  if ($report_data['today_only']) {
    $overview_report = $report_data['status']['today'];
  }
  else {
    $overview_report = $report_data['status']['all'];
  }

  // Create report renderable.
  $build = array();
  $build['test_type'] = array(
    '#type' => 'container',
    '#theme' => 'acquia_lift_report_overview',
    '#title' => $overview_report['test_type'],
    '#description' => t('test type'),
    '#attributes' => array(
      'id' => 'acquia-lift-overview-type',
    ),
  );
  if (isset($overview_report['time_running'])) {
    $build['total_running'] = array(
      '#type' => 'container',
      '#theme' => 'acquia_lift_report_overview',
      '#attributes' => array(
        'id' => 'acquia-lift-overview-running',
      ),
      '#title' => $overview_report['time_running'],
      '#description' => t('total time running'),
    );
  }
  $build['shown'] = array(
    '#type' => 'container',
    '#theme' => 'acquia_lift_report_overview',
    '#attributes' => array(
      'id' => 'acquia-lift-overview-shown',
    ),
    '#title' => $overview_report['total_shown'],
    '#description' => format_plural($overview_report['total_shown'], 'time shown', 'times shown'),
  );
  $build['goals'] = array(
    '#type' => 'container',
    '#theme' => 'acquia_lift_report_overview',
    '#attributes' => array(
      'id' => 'acquia-lift-overview-goals',
    ),
    '#title' => $overview_report['total_goals'],
    '#description' => t('goals met'),
  );
  if ($overview_report['total_goals_positive']) {
    $build['goals']['#attributes']['class'] = array(
      'acquia-lift-report-positive',
    );
  }

  /*
   * @todo: Figure out a way to present and explain this information so
   * that we can include these figures.
  $build['lift'] = array(
    '#type' => 'container',
    '#theme' => 'acquia_lift_report_overview',
    '#attributes' => array(
      'id' => 'acquia-lift-overview-lift',
    ),
    '#title' => $overview_report['total_lift'],
    '#description' => t('Predicted lift/control'),
    '#attributes' => array(
      'class' => array(
        $overview_report['total_lift_positive'] ? 'acquia-lift-report-positive' : 'acquia-lift-report-negative',
      ),
    ),
  );
  $build['confidence'] = array(
    '#type' => 'container',
    '#theme' => 'acquia_lift_report_overview',
    '#attributes' => array(
      'id' => 'acquia-lift-overview-confidence',
    ),
    '#title' => t('Confidence'),
    '#description' =>  $overview_report['confidence_level'] == 'high' ? format_plural($overview_report['total_confident'], 'High confidence, 1 var.', 'High confidence, @count vars.') : t('Low confidence'),
    '#attributes' => array(
      'class' => array(
        $overview_report['confidence_level'] == 'high' ? 'acquia-lift-report-positive' : 'acquia-lift-report-negative',
      ),
    ),
    '#total_confident' => $overview_report['total_confident'],
  );
  */
  return $build;
}