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-05-06 08:15:24 +0400
committerThomas Steur <thomas.steur@googlemail.com>2014-05-06 08:15:24 +0400
commit95d93acd47674431d820143af0377959de48662f (patch)
treead8353076c977736c6ef1a6bcc6e72cffac970ce /plugins/Live/API.php
parentc828a73d78250daa45834b911af175412904139f (diff)
fixes #4992 added support for filter_sort_order in Live.getLastVisitsDetails API
Diffstat (limited to 'plugins/Live/API.php')
-rw-r--r--plugins/Live/API.php15
1 files changed, 11 insertions, 4 deletions
diff --git a/plugins/Live/API.php b/plugins/Live/API.php
index ce9dcb729c..bbc23cc08c 100644
--- a/plugins/Live/API.php
+++ b/plugins/Live/API.php
@@ -145,8 +145,10 @@ class API extends \Piwik\Plugin\API
$countVisitorsToFetch = $filter_limit + $filter_offset;
}
+ $filterSortOrder = Common::getRequestVar('filter_sort_order', false, 'string');
+
Piwik::checkUserHasViewAccess($idSite);
- $dataTable = $this->loadLastVisitorDetailsFromDatabase($idSite, $period, $date, $segment, $countVisitorsToFetch, $visitorId = false, $minTimestamp);
+ $dataTable = $this->loadLastVisitorDetailsFromDatabase($idSite, $period, $date, $segment, $countVisitorsToFetch, $visitorId = false, $minTimestamp, $filterSortOrder);
$this->addFilterToCleanVisitors($dataTable, $idSite, $flat, $doNotFetchActions);
return $dataTable;
@@ -576,7 +578,7 @@ class API extends \Piwik\Plugin\API
});
}
- private function loadLastVisitorDetailsFromDatabase($idSite, $period, $date, $segment = false, $countVisitorsToFetch = 100, $visitorId = false, $minTimestamp = false)
+ private function loadLastVisitorDetailsFromDatabase($idSite, $period, $date, $segment = false, $countVisitorsToFetch = 100, $visitorId = false, $minTimestamp = false, $filterSortOrder = false)
{
$where = $whereBind = array();
@@ -585,8 +587,13 @@ class API extends \Piwik\Plugin\API
$where[] = $whereClause;
$whereBind = $idSites;
- $orderBy = "idsite, visit_last_action_time DESC";
- $orderByParent = "sub.visit_last_action_time DESC";
+ if (strtolower($filterSortOrder) !== 'asc') {
+ $filterSortOrder = 'DESC';
+ }
+
+ $orderBy = "idsite, visit_last_action_time " . $filterSortOrder;
+ $orderByParent = "sub.visit_last_action_time " . $filterSortOrder;
+
if (!empty($visitorId)) {
$where[] = "log_visit.idvisitor = ? ";
$whereBind[] = @Common::hex2bin($visitorId);