Skip to content

Commit

Permalink
refs #4199 added method to get all reports with goal metrics, otherwi…
Browse files Browse the repository at this point in the history
…se it appears twice in the hooks documentation
  • Loading branch information
tsteur committed Oct 8, 2013
1 parent 4b74c5c commit 0c9cf80
Showing 1 changed file with 16 additions and 17 deletions.
33 changes: 16 additions & 17 deletions plugins/Goals/Goals.php
Expand Up @@ -43,13 +43,8 @@ public function getInformation()

static public function getReportsWithGoalMetrics()
{
$dimensions = array();
$dimensions = self::getAllReportsWithGoalMetrics();

/**
* This event is triggered to define available goal segments.
* @matt
*/
Piwik_PostEvent('Goals.getReportsWithGoalMetrics', array(&$dimensions));
$dimensionsByGroup = array();
foreach ($dimensions as $dimension) {
$group = $dimension['category'];
Expand Down Expand Up @@ -339,17 +334,8 @@ public function getReportMetadata(&$reports, $info)

unset($goalMetrics['nb_visits_converted']);

$reportsWithGoals = array();

/*
* Add the metricsGoal and processedMetricsGoal entry
* to all reports that have Goal segmentation
*
* @matt is this same event as triggered above? Do we need two names? Currently they appear twice in the
* generated documentation. Maybe we can create a private/protected function to trigger this event to have it
* defined only once?
*/
Piwik_PostEvent('Goals.getReportsWithGoalMetrics', array(&$reportsWithGoals));
$reportsWithGoals = self::getAllReportsWithGoalMetrics();

foreach ($reportsWithGoals as $reportWithGoals) {
// Select this report from the API metadata array
// and add the Goal metrics to it
Expand All @@ -365,6 +351,19 @@ public function getReportMetadata(&$reports, $info)
}
}

static private function getAllReportsWithGoalMetrics()
{
$reportsWithGoals = array();

/*
* This event is triggered to define available goal segments.
* @matt
*/
Piwik_PostEvent('Goals.getReportsWithGoalMetrics', array(&$reportsWithGoals));

return $reportsWithGoals;
}

static public function getProductReportColumns()
{
return array(
Expand Down

0 comments on commit 0c9cf80

Please sign in to comment.