You are here

function acquia_lift_report in Acquia Lift Connector 7

Same name and namespace in other branches
  1. 7.2 acquia_lift.admin.inc \acquia_lift_report()

Form build function for the Acquia Lift report, which has filters.

Parameters

stdClass $agent_data: The campaign agent data for this report.

stdClass $option_set: (optional) The content variation to show in the default view.

1 string reference to 'acquia_lift_report'
acquia_lift_personalize_campaign_report in ./acquia_lift.module
Implements hook_personalize_campaign_report().

File

./acquia_lift.admin.inc, line 306
acquia_lift.admin.inc Provides functions needed for the admin UI.

Code

function acquia_lift_report($form, &$form_state, $agent_data, $option_set) {
  if (!($agent = personalize_agent_load_agent($agent_data->machine_name))) {
    return array();
  }
  if (!$agent instanceof AcquiaLiftAgent) {
    return array();
  }
  if ($agent_data->started == 0) {
    return array(
      'no_report' => array(
        '#markup' => t('This agent has not started running yet, no reports to show.'),
      ),
    );
  }

  // If this agent is not currently enabled in Acquia Lift, there are no reports
  // to show.
  $errors = $agent
    ->errors();
  if (!empty($errors)) {
    return array(
      'no_report' => array(
        '#markup' => t('This agent is not properly configured, no reports to show.'),
      ),
    );
  }

  // If this agent doesn't implement the reporting interface then there are no
  // reports to show.
  if (!$agent instanceof PersonalizeAgentReportInterface) {
    return array(
      'no_report' => array(
        '#markup' => t('This agent does not support reporting.'),
      ),
    );
  }
  if ($agent instanceof AcquiaLiftSimpleAB) {
    return acquia_lift_report_ab($form, $form_state, $agent, $agent_data);
  }
  else {
    return acquia_lift_report_custom($form, $form_state, $agent, $agent_data, $option_set);
  }
}