diff options
Diffstat (limited to 'plugins/CustomVariables/Model.php')
-rw-r--r-- | plugins/CustomVariables/Model.php | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/plugins/CustomVariables/Model.php b/plugins/CustomVariables/Model.php index 235809e1da..5abb327f0e 100644 --- a/plugins/CustomVariables/Model.php +++ b/plugins/CustomVariables/Model.php @@ -12,6 +12,7 @@ use Piwik\Common; use Piwik\DataTable; use Piwik\Db; use Piwik\Log; +use Piwik\Piwik; class Model { @@ -23,6 +24,7 @@ class Model private $scope = null; private $table = null; + private $tableUnprefixed = null; public function __construct($scope) { @@ -31,7 +33,13 @@ class Model } $this->scope = $scope; - $this->table = Common::prefixTable($this->getTableNameFromScope($scope)); + $this->tableUnprefixed = $this->getTableNameFromScope($scope); + $this->table = Common::prefixTable($this->tableUnprefixed); + } + + public function getUnprefixedTableName() + { + return $this->tableUnprefixed; } private function getTableNameFromScope($scope) @@ -47,11 +55,30 @@ class Model } } + public function getScope() + { + return $this->scope; + } + public function getScopeName() { return ucfirst($this->scope); } + public function getScopeDescription() + { + switch ($this->scope) { + case Model::SCOPE_PAGE: + return Piwik::translate('CustomVariables_ScopePage'); + case Model::SCOPE_VISIT: + return Piwik::translate('CustomVariables_ScopeVisit'); + case Model::SCOPE_CONVERSION: + return Piwik::translate('CustomVariables_ScopeConversion'); + } + + return ucfirst($this->scope); + } + /** * @see getHighestCustomVarIndex() * @return int |