Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/UserId/API.php')
-rw-r--r--plugins/UserId/API.php46
1 files changed, 46 insertions, 0 deletions
diff --git a/plugins/UserId/API.php b/plugins/UserId/API.php
new file mode 100644
index 0000000000..932e19b113
--- /dev/null
+++ b/plugins/UserId/API.php
@@ -0,0 +1,46 @@
+<?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\UserId;
+
+use Piwik\Archive;
+use Piwik\Metrics;
+use Piwik\Piwik;
+use Piwik\DataTable;
+use Piwik\DataTable\Row;
+
+/**
+ * API for plugin UserId. Allows to get User IDs table.
+ *
+ * @method static \Piwik\Plugins\UserId\API getInstance()
+ */
+class API extends \Piwik\Plugin\API
+{
+ /**
+ * Get a report of all User Ids.
+ *
+ * @param int $idSite
+ *
+ * @param string $period
+ * @param int $date
+ * @param string|bool $segment
+ *
+ * @return DataTable
+ */
+ public function getUsers($idSite, $period, $date, $segment = false)
+ {
+ Piwik::checkUserHasViewAccess($idSite);
+ $archive = Archive::build($idSite, $period, $date, $segment);
+ $dataTable = $archive->getDataTable(Archiver::USERID_ARCHIVE_RECORD);
+
+ $dataTable->queueFilter('ReplaceColumnNames');
+ $dataTable->queueFilter('ReplaceSummaryRowLabel');
+
+ return $dataTable;
+ }
+}