protected function AcquiaLiftReportBase::formatReportPercentage in Acquia Lift Connector 7
Formats a percentage value for use in reports.
Parameters
$value: The number to show as a percentage.
bool $include_sign: True to include positive/negative sign indicators.
$trim: Boolean indicating whether the number should be trimmed of trailing 0s.
$decimals: The number of decimal places to display.
$padding: The total number of characters (including decimal) for padding of the final number. This allows numbers to align properly in column views. This will have no effect if trim is set to true.
Return value
string The formatted number to display.
4 calls to AcquiaLiftReportBase::formatReportPercentage()
- AcquiaLiftReport::extractConfidenceReportData in plugins/
agent_types/ AcquiaLiftAgent.inc - Extracts the required confidence report data from the items returned by Acquia Lift.
- AcquiaLiftReport::extractTargetingReportData in plugins/
agent_types/ AcquiaLiftAgent.inc - Extracts the required targeting report data from the items returned by Acquia Lift.
- AcquiaLiftReportBase::extractConversionSummaryData in plugins/
agent_types/ AcquiaLiftAgent.inc - Extracts data from the raw aggregate confidence report that is prepared for use within the report rendering process.
- AcquiaLiftReportBase::extractOverviewReportData in plugins/
agent_types/ AcquiaLiftAgent.inc - Extracts the required overview data from the report data returned by Acquia Lift.
File
- plugins/
agent_types/ AcquiaLiftAgent.inc, line 1508 - Provides an agent type for Acquia Lift
Class
- AcquiaLiftReportBase
- Base class providing report data loading functionality common to all Acquia Lift Reports.
Code
protected function formatReportPercentage($value, $include_sign = FALSE, $trim = TRUE, $decimals = 2, $padding = 1) {
$percent = (double) $value * 100;
if ($percent > 0 && $include_sign) {
return '+' . $this
->formatReportNumber($percent, $trim, $decimals, $padding) . '%';
}
return $this
->formatReportNumber($percent, $trim, $decimals, $padding) . '%';
}