1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
<?php
/**
* Matomo - free/libre analytics platform
*
* @link https://matomo.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*
*/
namespace Piwik\Plugins\Actions\Reports;
use Piwik\Common;
use Piwik\Piwik;
use Piwik\Plugin\ViewDataTable;
use Piwik\Plugins\Actions\Actions;
abstract class SiteSearchBase extends Base
{
protected function init()
{
parent::init();
$this->categoryId = 'General_Actions';
$this->onlineGuideUrl = 'https://matomo.org/docs/site-search/';
}
public function isEnabled()
{
$idSites = Common::getRequestVar('idSites', '', 'string');
$idSite = Common::getRequestVar('idSite', 0, 'int');
return $this->isEnabledForIdSites($idSites, $idSite);
}
protected function isEnabledForIdSites($idSites, $idSite)
{
$actions = new Actions();
return $actions->isSiteSearchEnabled($idSites, $idSite);
}
public function configureReportMetadata(&$availableReports, $infos)
{
$idSite = array($infos['idSite']);
if (!$this->isEnabledForIdSites($idSite, Common::getRequestVar('idSite', 0, 'int'))) {
return;
}
$report = $this->buildReportMetadata();
if (!empty($report)) {
$availableReports[] = $report;
}
}
protected function addSiteSearchDisplayProperties(ViewDataTable $view)
{
$view->config->addTranslations(array(
'nb_visits' => Piwik::translate('Actions_ColumnSearches'),
'exit_rate' => str_replace("% ", "% ", Piwik::translate('Actions_ColumnSearchExits')),
'nb_pages_per_search' => Piwik::translate('Actions_ColumnPagesPerSearch')
));
$view->config->show_bar_chart = false;
$view->config->show_table_all_columns = false;
}
}
|