diff options
author | sgiehl <stefan@piwik.org> | 2014-12-09 00:50:44 +0300 |
---|---|---|
committer | sgiehl <stefan@piwik.org> | 2014-12-09 00:50:44 +0300 |
commit | e7325c72565a92cc7ff6c6eabdbff885d9158f97 (patch) | |
tree | a72b385e75d835c2c916510f519c31ba6393831d /plugins/Resolution/API.php | |
parent | d974ea9bbb567b860a17c5267c04cee3613ae6dd (diff) |
moved resolution and configuration reports to a new plugin
Diffstat (limited to 'plugins/Resolution/API.php')
-rw-r--r-- | plugins/Resolution/API.php | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/plugins/Resolution/API.php b/plugins/Resolution/API.php new file mode 100644 index 0000000000..8fc33efddb --- /dev/null +++ b/plugins/Resolution/API.php @@ -0,0 +1,49 @@ +<?php +/** + * Piwik - free/libre analytics platform + * + * @link http://piwik.org + * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later + * + */ +namespace Piwik\Plugins\Resolution; + +use Piwik\Archive; +use Piwik\DataTable; +use Piwik\Metrics; +use Piwik\Piwik; + +/** + * @see plugins/Resolution/functions.php + */ +require_once PIWIK_INCLUDE_PATH . '/plugins/Resolution/functions.php'; + +/** + * @method static \Piwik\Plugins\Resolution\API getInstance() + */ +class API extends \Piwik\Plugin\API +{ + protected function getDataTable($name, $idSite, $period, $date, $segment) + { + Piwik::checkUserHasViewAccess($idSite); + $archive = Archive::build($idSite, $period, $date, $segment); + $dataTable = $archive->getDataTable($name); + $dataTable->filter('Sort', array(Metrics::INDEX_NB_VISITS)); + $dataTable->queueFilter('ReplaceColumnNames'); + $dataTable->queueFilter('ReplaceSummaryRowLabel'); + return $dataTable; + } + + public function getResolution($idSite, $period, $date, $segment = false) + { + $dataTable = $this->getDataTable(Archiver::RESOLUTION_RECORD_NAME, $idSite, $period, $date, $segment); + return $dataTable; + } + + public function getConfiguration($idSite, $period, $date, $segment = false) + { + $dataTable = $this->getDataTable(Archiver::CONFIGURATION_RECORD_NAME, $idSite, $period, $date, $segment); + $dataTable->queueFilter('ColumnCallbackReplace', array('label', __NAMESPACE__ . '\getConfigurationLabel')); + return $dataTable; + } +} |