Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PPCDEV-379 Added possibility to modify visualizations of VisitorLog w…
…idget/view and Visitors Real-time widget. Refactored getLastVisitsStart() action to render report instead of using an API.
- Loading branch information
1 parent
f8d3e6f
commit 1ab7e73
Showing
5 changed files
with
105 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
<?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\Live\Reports; | ||
|
||
use Piwik\Plugin\ViewDataTable; | ||
use Piwik\Plugins\Live\Visualizations\VisitorsInRealTime; | ||
use Piwik\ViewDataTable\Factory as ViewDataTableFactory; | ||
|
||
class GetVisitorsInRealTime extends Base | ||
{ | ||
|
||
protected function init() | ||
{ | ||
parent::init(); | ||
} | ||
|
||
public function getDefaultTypeViewDataTable() | ||
{ | ||
return VisitorsInRealTime::ID; | ||
} | ||
|
||
public function alwaysUseDefaultViewDataTable() | ||
{ | ||
return true; | ||
} | ||
|
||
public function configureView(ViewDataTable $view) | ||
{ | ||
$view->requestConfig->apiMethodToRequestDataTable = 'Live.getLastVisitsDetails'; | ||
} | ||
|
||
public function render() | ||
{ | ||
$view = ViewDataTableFactory::build(null, 'Live.getVisitorsInRealTime', 'Live.getVisitorsInRealTime'); | ||
|
||
$rendered = $view->render(); | ||
|
||
return $rendered; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<?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\Live\Visualizations; | ||
|
||
use Piwik\Plugin\Visualization; | ||
|
||
class VisitorsInRealTime extends Visualization | ||
{ | ||
const ID = 'VisitorLogWidget'; | ||
const TEMPLATE_FILE = '@Live/getLastVisitsStart.twig'; | ||
const FOOTER_ICON_TITLE = ''; | ||
const FOOTER_ICON = ''; | ||
|
||
|
||
/** | ||
* Configure visualization. | ||
*/ | ||
public function beforeRender() | ||
{ | ||
$this->config->show_visualization_only = true; | ||
} | ||
|
||
public function beforeLoadDataTable() | ||
{ | ||
$this->requestConfig->addPropertiesThatShouldBeAvailableClientSide(array( | ||
'filter_limit', | ||
'filter_offset', | ||
'filter_sort_column', | ||
'filter_sort_order', | ||
)); | ||
|
||
if (!is_numeric($this->requestConfig->filter_limit)) { | ||
$this->requestConfig->filter_limit = 10; | ||
} | ||
|
||
$this->requestConfig->disable_generic_filters = true; | ||
$this->requestConfig->filter_sort_column = false; | ||
} | ||
|
||
public static function canDisplayViewDataTable(ViewDataTable $view) | ||
{ | ||
return ($view->requestConfig->getApiModuleToRequest() === 'Live'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters