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:
authormattab <matthieu.aubry@gmail.com>2014-04-09 10:20:40 +0400
committermattab <matthieu.aubry@gmail.com>2014-04-09 10:20:40 +0400
commit836cfc64da116304fd8f8cdbbea2b47b4171d156 (patch)
tree6d049d323d3d43eaa6193e27b001ab72383315b4 /plugins/Events/API.php
parente591e5066a2a1217c7901f921db0813ed03bea74 (diff)
Refs #472 Add metadata for Custom Events reports (for scheduled reports, piwik mobile)
Diffstat (limited to 'plugins/Events/API.php')
-rw-r--r--plugins/Events/API.php49
1 files changed, 40 insertions, 9 deletions
diff --git a/plugins/Events/API.php b/plugins/Events/API.php
index 2d8b24919e..241d0bf915 100644
--- a/plugins/Events/API.php
+++ b/plugins/Events/API.php
@@ -22,6 +22,37 @@ use Piwik\Piwik;
*/
class API extends \Piwik\Plugin\API
{
+ protected $mappingApiToApiLoadsubtables = array(
+ 'getCategory' => 'getActionFromCategoryId',
+ 'getAction' => 'getNameFromActionId',
+ 'getName' => 'getActionFromNameId',
+ );
+
+ protected $mappingApiToRecord = array(
+ 'getCategory' => Archiver::EVENTS_CATEGORY_ACTION_RECORD_NAME,
+ 'getAction' => Archiver::EVENTS_ACTION_NAME_RECORD_NAME,
+ 'getName' => Archiver::EVENTS_NAME_ACTION_RECORD_NAME,
+ 'getActionFromCategoryId' => Archiver::EVENTS_CATEGORY_ACTION_RECORD_NAME,
+ 'getNameFromCategoryId' => Archiver::EVENTS_CATEGORY_NAME_RECORD_NAME,
+ 'getCategoryFromActionId' => Archiver::EVENTS_ACTION_CATEGORY_RECORD_NAME,
+ 'getNameFromActionId' => Archiver::EVENTS_ACTION_NAME_RECORD_NAME,
+ 'getActionFromNameId' => Archiver::EVENTS_NAME_ACTION_RECORD_NAME,
+ 'getCategoryFromNameId' => Archiver::EVENTS_NAME_CATEGORY_RECORD_NAME,
+ );
+
+ /**
+ * @ignore
+ */
+ public function getSubtableAction($api)
+ {
+ return $this->mappingApiToApiLoadsubtables[$api];
+ }
+
+ protected function getRecordNameForAction($method)
+ {
+ return $this->mappingApiToRecord[$method];
+ }
+
protected function getDataTable($name, $idSite, $period, $date, $segment, $expanded = false, $idSubtable = null)
{
Piwik::checkUserHasViewAccess($idSite);
@@ -40,46 +71,46 @@ class API extends \Piwik\Plugin\API
public function getCategory($idSite, $period, $date, $segment = false, $expanded = false)
{
- return $this->getDataTable(Archiver::EVENTS_CATEGORY_ACTION_RECORD_NAME, $idSite, $period, $date, $segment, $expanded);
+ return $this->getDataTable($this->getRecordNameForAction(__FUNCTION__), $idSite, $period, $date, $segment, $expanded);
}
public function getAction($idSite, $period, $date, $segment = false, $expanded = false)
{
- return $this->getDataTable(Archiver::EVENTS_ACTION_NAME_RECORD_NAME, $idSite, $period, $date, $segment, $expanded);
+ return $this->getDataTable($this->getRecordNameForAction(__FUNCTION__), $idSite, $period, $date, $segment, $expanded);
}
public function getName($idSite, $period, $date, $segment = false, $expanded = false)
{
- return $this->getDataTable(Archiver::EVENTS_NAME_ACTION_RECORD_NAME, $idSite, $period, $date, $segment, $expanded);
+ return $this->getDataTable($this->getRecordNameForAction(__FUNCTION__), $idSite, $period, $date, $segment, $expanded);
}
public function getActionFromCategoryId($idSite, $period, $date, $idSubtable, $segment = false)
{
- return $this->getDataTable(Archiver::EVENTS_CATEGORY_ACTION_RECORD_NAME, $idSite, $period, $date, $segment, $expanded = false, $idSubtable);
+ return $this->getDataTable($this->getRecordNameForAction(__FUNCTION__), $idSite, $period, $date, $segment, $expanded = false, $idSubtable);
}
public function getNameFromCategoryId($idSite, $period, $date, $idSubtable, $segment = false)
{
- return $this->getDataTable(Archiver::EVENTS_CATEGORY_NAME_RECORD_NAME, $idSite, $period, $date, $segment, $expanded = false, $idSubtable);
+ return $this->getDataTable($this->getRecordNameForAction(__FUNCTION__), $idSite, $period, $date, $segment, $expanded = false, $idSubtable);
}
public function getCategoryFromActionId($idSite, $period, $date, $idSubtable, $segment = false)
{
- return $this->getDataTable(Archiver::EVENTS_ACTION_CATEGORY_RECORD_NAME, $idSite, $period, $date, $segment, $expanded = false, $idSubtable);
+ return $this->getDataTable($this->getRecordNameForAction(__FUNCTION__), $idSite, $period, $date, $segment, $expanded = false, $idSubtable);
}
public function getNameFromActionId($idSite, $period, $date, $idSubtable, $segment = false)
{
- return $this->getDataTable(Archiver::EVENTS_ACTION_NAME_RECORD_NAME, $idSite, $period, $date, $segment, $expanded = false, $idSubtable);
+ return $this->getDataTable($this->getRecordNameForAction(__FUNCTION__), $idSite, $period, $date, $segment, $expanded = false, $idSubtable);
}
public function getActionFromNameId($idSite, $period, $date, $idSubtable, $segment = false)
{
- return $this->getDataTable(Archiver::EVENTS_NAME_ACTION_RECORD_NAME, $idSite, $period, $date, $segment, $expanded = false, $idSubtable);
+ return $this->getDataTable($this->getRecordNameForAction(__FUNCTION__), $idSite, $period, $date, $segment, $expanded = false, $idSubtable);
}
public function getCategoryFromNameId($idSite, $period, $date, $idSubtable, $segment = false)
{
- return $this->getDataTable(Archiver::EVENTS_NAME_CATEGORY_RECORD_NAME, $idSite, $period, $date, $segment, $expanded = false, $idSubtable);
+ return $this->getDataTable($this->getRecordNameForAction(__FUNCTION__), $idSite, $period, $date, $segment, $expanded = false, $idSubtable);
}
} \ No newline at end of file