protected function AcquiaLiftReportDataFromFile::getReport in Acquia Lift Connector 7
Retrieves a particular report for the specifed agent.
Parameters
$agent_name: The name of the agent to retrieve a report for.
$report_name: The name of teh report to retrieve, one of 'targeting-impact', 'confidence', 'agent-status', 'raw-learning', or 'context-filters'.
Return value
array An array representing the report.
5 calls to AcquiaLiftReportDataFromFile::getReport()
- AcquiaLiftReportDataFromFile::getAgentStatusReport in includes/
acquia_lift.classes.inc - Implements AcquiaLiftReportDataSourceInterface::getAgentStatusReport().
- AcquiaLiftReportDataFromFile::getConfidenceReport in includes/
acquia_lift.classes.inc - Implements AcquiaLiftReportDataSourceInterface::getConfidenceReport().
- AcquiaLiftReportDataFromFile::getContextFilters in includes/
acquia_lift.classes.inc - Implements AcquiaLiftReportDataSourceInterface::getContextFilters().
- AcquiaLiftReportDataFromFile::getRawLearningReport in includes/
acquia_lift.classes.inc - Implements AcquiaLiftReportDataSourceInterface::getRawLearningReport().
- AcquiaLiftReportDataFromFile::getTargetingImpactReport in includes/
acquia_lift.classes.inc - Implements AcquiaLiftReportDataSourceInterface::getTargetingImpactReport().
File
- includes/
acquia_lift.classes.inc, line 1570 - Provides an agent type for Acquia Lift
Class
Code
protected function getReport($agent_name, $report_name) {
// First see if we already have the reports in memory.
if ($this->reports) {
return isset($this->reports[$report_name]) ? $this->reports[$report_name] : array();
}
// Check the cache if available
if ($this->cache && ($reports = $this->cache
->getCachedReports($agent_name))) {
$this->reports = $reports;
return isset($reports[$report_name]) ? $reports[$report_name] : array();
}
else {
$file_name = $this->fileLocation;
if (strpos($file_name, '://') === FALSE) {
// If not given full URL, assume it's an absolute path for
// the current site.
global $base_url;
$file_name = $base_url . $file_name;
}
if ($str = file_get_contents($file_name)) {
$parsed = json_decode($str, TRUE);
$this->reports = $parsed['reports'];
if ($this->cache) {
$this->cache
->cacheReports($agent_name, $this->reports);
}
return isset($this->reports[$report_name]) ? $this->reports[$report_name] : array();
}
}
return array();
}