private function setEditGoalsViewVariables($view)
{
$goals = $this->goals;
$view->goals = $goals;
$idGoal = Common::getRequestVar('idGoal', 0, 'int');
$view->idGoal = 0;
if ($idGoal && array_key_exists($idGoal, $goals)) {
$view->idGoal = $idGoal;
}
// unsanitize goal names and other text data (not done in API so as not to break
// any other code/cause security issues)
foreach ($goals as &$goal) {
$goal['name'] = Common::unsanitizeInputValue($goal['name']);
if (isset($goal['pattern'])) {
$goal['pattern'] = Common::unsanitizeInputValue($goal['pattern']);
}
}
$view->goalsJSON = json_encode($goals);
$view->ecommerceEnabled = $this->site->isEcommerceEnabled();
}