function _build_overview_report in Acquia Lift Connector 7.2
Returns a render array representing the overview report for the given dates.
Parameters
DateInterval $interval: The length of the period this report represents, as a DateInterval object.
string $type: THe type of personalization, e.g. 'A/B test'
int $session_count: The total number of sessions.
int $goal_count: The total number of goals received.
Return value
array A render array representing the overview report.
2 calls to _build_overview_report()
- acquia_lift_report in ./
acquia_lift.admin.inc - acquia_lift_report_audience in ./
acquia_lift.admin.inc - Builds the audience-specific report.
File
- ./
acquia_lift.admin.inc, line 2468 - acquia_lift.admin.inc Provides functions needed for the admin UI.
Code
function _build_overview_report($session_count, $goal_count, DateInterval $interval = null, $type = null) {
// Create report renderable.
$build = array();
$is_audience_report = empty($interval);
if (!empty($type)) {
$build['test_type'] = array(
'#type' => 'container',
'#theme' => 'acquia_lift_report_overview',
'#title' => $type,
'#description' => t('test type'),
'#attributes' => array(
'id' => 'acquia-lift-overview-type',
),
);
}
if (!empty($interval)) {
$build['total_running'] = array(
'#type' => 'container',
'#theme' => 'acquia_lift_report_overview',
'#attributes' => array(
'id' => 'acquia-lift-overview-running',
),
'#title' => $interval
->format('%d days, %h hours'),
'#description' => t('total time running'),
);
}
$formatted_session_count = _format_report_number($session_count, FALSE, 0);
$build['shown'] = array(
'#type' => 'container',
'#theme' => 'acquia_lift_report_overview',
'#attributes' => array(
'id' => $is_audience_report ? 'acquia-lift-audience-overview-shown' : 'acquia-lift-overview-shown',
),
'#title' => $formatted_session_count,
'#description' => format_plural($session_count, 'time shown', 'times shown'),
);
$formatted_goal_count = _format_report_number($goal_count, FALSE, 0);
$build['goals'] = array(
'#type' => 'container',
'#theme' => 'acquia_lift_report_overview',
'#attributes' => array(
'id' => $is_audience_report ? 'acquia-lift-audience-overview-goals' : 'acquia-lift-overview-goals',
),
'#title' => $formatted_goal_count,
'#description' => t('goals met'),
);
if ($goal_count > 0) {
$build['goals']['#attributes']['class'] = array(
'acquia-lift-report-positive',
);
}
return $build;
}