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:
authorThomas Steur <thomas.steur@googlemail.com>2014-03-03 06:37:44 +0400
committerThomas Steur <thomas.steur@googlemail.com>2014-03-03 06:37:44 +0400
commit8110e9db5c6589e7f426b2aec6a4f7ccb2e6146e (patch)
treef9b6428e6d18894e6ec044c97a50c42d0e94f22e /plugins/Insights/API.php
parentb6473579fd9de9d9860c62b1644b155370ca729e (diff)
refs #57 added possibility to place a widget multiple times (in case you want to see the same wdget with different visualizations and/or different parameters like different filters to make it easier comparable), removed some controls and save parameter changes in dashboard
Diffstat (limited to 'plugins/Insights/API.php')
-rw-r--r--plugins/Insights/API.php34
1 files changed, 20 insertions, 14 deletions
diff --git a/plugins/Insights/API.php b/plugins/Insights/API.php
index ad7f780f1f..e69f494f0d 100644
--- a/plugins/Insights/API.php
+++ b/plugins/Insights/API.php
@@ -22,8 +22,14 @@ use Piwik\Plugins\VisitsSummary\API as VisitsSummaryAPI;
*/
class API extends \Piwik\Plugin\API
{
-
- public function getOverallMoversAndShakers($idSite, $period, $date)
+ const FILTER_BY_NEW = 'new';
+ const FILTER_BY_MOVERS = 'movers';
+ const FILTER_BY_DISAPPEARED = 'disappeared';
+ const ORDER_BY_RELATIVE = 'relative';
+ const ORDER_BY_ABSOLUTE = 'absolute';
+ const ORDER_BY_IMPORTANCE = 'importance';
+
+ public function getInsightsOverview($idSite, $period, $date)
{
/** @var DataTable[] $tables */
$tables = array(
@@ -35,6 +41,7 @@ class API extends \Piwik\Plugin\API
);
// post event to add other reports?
+ // display new and disappeared only if very high impact
$map = new DataTable\Map();
@@ -48,8 +55,8 @@ class API extends \Piwik\Plugin\API
// force $limitX and ignore minVisitsPercent, minGrowthPercent
public function getInsights(
$idSite, $period, $date, $reportUniqueId, $limitIncreaser = 5, $limitDecreaser = 5,
- $basedOnTotalMetric = false, $minVisitsPercent = 2, $minGrowthPercent = 20,
- $comparedToXPeriods = 1, $orderBy = 'absolute', $filterBy = '', $segment = false)
+ $filterBy = '', $basedOnTotalMetric = false, $minVisitsPercent = 2, $minGrowthPercent = 20,
+ $comparedToXPeriods = 1, $orderBy = 'absolute', $segment = false)
{
Piwik::checkUserHasViewAccess(array($idSite));
@@ -71,20 +78,19 @@ class API extends \Piwik\Plugin\API
$considerDisappeared = false;
switch ($filterBy) {
- case '':
+ case self::FILTER_BY_MOVERS:
$considerMovers = true;
+ break;
+ case self::FILTER_BY_NEW:
$considerNew = true;
+ break;
+ case self::FILTER_BY_DISAPPEARED:
$considerDisappeared = true;
break;
- case 'movers':
+ default:
$considerMovers = true;
- break;
- case 'new':
$considerNew = true;
- break;
- case 'disappeared':
$considerDisappeared = true;
- break;
}
$dataTable = new DataTable();
@@ -202,11 +208,11 @@ class API extends \Piwik\Plugin\API
private function getOrderByColumn($orderBy)
{
- if ('relative' == $orderBy) {
+ if (self::ORDER_BY_RELATIVE == $orderBy) {
$orderByColumn = 'growth_percent_numeric';
- } elseif ('absolute' == $orderBy) {
+ } elseif (self::ORDER_BY_ABSOLUTE == $orderBy) {
$orderByColumn = 'difference';
- } elseif ('importance' == $orderBy) {
+ } elseif (self::ORDER_BY_IMPORTANCE == $orderBy) {
$orderByColumn = 'importance';
} else {
throw new \Exception('Unsupported orderBy');