idSite = $idSite; $this->idGoal = $idGoal; } protected function getColumnPrefix() { return 'goal_' . $this->idGoal; } protected function getGoalMetrics(Row $row) { $allGoalMetrics = $this->getMetric($row, 'goals'); if (isset($allGoalMetrics[$this->idGoal])) { return $allGoalMetrics[$this->idGoal]; } else { $alternateKey = 'idgoal=' . $this->idGoal; if (isset($allGoalMetrics[$alternateKey])) { return $allGoalMetrics[$alternateKey]; } elseif ($this->idGoal === Piwik::LABEL_ID_GOAL_IS_ECOMMERCE_ORDER) { $alternateKey = GoalManager::IDGOAL_ORDER; if (isset($allGoalMetrics[$alternateKey])) { return $allGoalMetrics[$alternateKey]; } } elseif ($this->idGoal === Piwik::LABEL_ID_GOAL_IS_ECOMMERCE_CART) { $alternateKey = GoalManager::IDGOAL_CART; if (isset($allGoalMetrics[$alternateKey])) { return $allGoalMetrics[$alternateKey]; } } else { return array(); } } } protected function getGoalName() { if ($this->idGoal == Piwik::LABEL_ID_GOAL_IS_ECOMMERCE_ORDER) { return Piwik::translate('Goals_EcommerceOrder'); } if (isset($this->idSite)) { $allGoals = GoalsAPI::getInstance()->getGoals($this->idSite); $goalName = @$allGoals[$this->idGoal]['name']; return Common::sanitizeInputValue($goalName); } else { return ""; } } protected function getGoalNameForDocs() { $goalName = $this->getGoalName(); if ($goalName == Piwik::LABEL_ID_GOAL_IS_ECOMMERCE_ORDER) { $goalName = '"' . $goalName . '"'; } return $goalName; } }