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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
|
<?php
/**
* Piwik - Open source web analytics
*
* @link http://piwik.org
* @license http://www.gnu.org/licenses/gpl-3.0.html Gpl v3 or later
* @version $Id$
*
* @package Piwik_UserSettings
*/
require_once "DataFiles/Browsers.php";
require_once "DataFiles/OS.php";
require_once "UserSettings/functions.php";
/**
* @package Piwik_UserSettings
*/
class Piwik_UserSettings_API
{
static private $instance = null;
static public function getInstance()
{
if (self::$instance == null)
{
$c = __CLASS__;
self::$instance = new $c();
}
return self::$instance;
}
public function getResolution( $idSite, $period, $date )
{
Piwik::checkUserHasViewAccess( $idSite );
$archive = Piwik_Archive::build($idSite, $period, $date );
$dataTable = $archive->getDataTable('UserSettings_resolution');
$dataTable->queueFilter('Piwik_DataTable_Filter_ReplaceColumnNames');
return $dataTable;
}
public function getConfiguration( $idSite, $period, $date )
{
Piwik::checkUserHasViewAccess( $idSite );
$archive = Piwik_Archive::build($idSite, $period, $date );
$dataTable = $archive->getDataTable('UserSettings_configuration');
$dataTable->queueFilter('Piwik_DataTable_Filter_ColumnCallbackReplace', array('label', 'Piwik_getConfigurationLabel'));
$dataTable->queueFilter('Piwik_DataTable_Filter_ReplaceColumnNames');
return $dataTable;
}
public function getOS( $idSite, $period, $date )
{
Piwik::checkUserHasViewAccess( $idSite );
$archive = Piwik_Archive::build($idSite, $period, $date );
$dataTable = $archive->getDataTable('UserSettings_os');
$dataTable->queueFilter('Piwik_DataTable_Filter_ReplaceColumnNames');
$dataTable->queueFilter('Piwik_DataTable_Filter_ColumnCallbackAddMetadata', array('label', 'logo', 'Piwik_getOSLogo'));
$dataTable->queueFilter('Piwik_DataTable_Filter_ColumnCallbackAddMetadata', array( 'label', 'shortLabel', 'Piwik_getOSShortLabel') );
$dataTable->queueFilter('Piwik_DataTable_Filter_ColumnCallbackReplace', array( 'label', 'Piwik_getOSLabel') );
return $dataTable;
}
public function getBrowser( $idSite, $period, $date )
{
Piwik::checkUserHasViewAccess( $idSite );
$archive = Piwik_Archive::build($idSite, $period, $date );
$dataTable = $archive->getDataTable('UserSettings_browser');
$dataTable->queueFilter('Piwik_DataTable_Filter_ReplaceColumnNames');
$dataTable->queueFilter('Piwik_DataTable_Filter_ColumnCallbackAddMetadata', array('label', 'logo', 'Piwik_getBrowsersLogo'));
$dataTable->queueFilter('Piwik_DataTable_Filter_ColumnCallbackAddMetadata', array('label', 'shortLabel', 'Piwik_getBrowserShortLabel'));
$dataTable->queueFilter('Piwik_DataTable_Filter_ColumnCallbackReplace', array('label', 'Piwik_getBrowserLabel'));
return $dataTable;
}
public function getBrowserType( $idSite, $period, $date )
{
Piwik::checkUserHasViewAccess( $idSite );
$archive = Piwik_Archive::build($idSite, $period, $date );
$dataTable = $archive->getDataTable('UserSettings_browserType');
$dataTable->queueFilter('Piwik_DataTable_Filter_ReplaceColumnNames');
$dataTable->queueFilter('Piwik_DataTable_Filter_ColumnCallbackAddMetadata', array('label', 'shortLabel', 'ucfirst'));
$dataTable->queueFilter('Piwik_DataTable_Filter_ColumnCallbackReplace', array('label', 'Piwik_getBrowserTypeLabel'));
return $dataTable;
}
public function getWideScreen( $idSite, $period, $date )
{
Piwik::checkUserHasViewAccess( $idSite );
$archive = Piwik_Archive::build($idSite, $period, $date );
$dataTable = $archive->getDataTable('UserSettings_wideScreen');
$dataTable->queueFilter('Piwik_DataTable_Filter_ReplaceColumnNames');
$dataTable->queueFilter('Piwik_DataTable_Filter_ColumnCallbackAddMetadata', array('label', 'logo', 'Piwik_getScreensLogo'));
$dataTable->queueFilter('Piwik_DataTable_Filter_ColumnCallbackReplace', array('label', 'ucfirst'));
return $dataTable;
}
public function getPlugin( $idSite, $period, $date )
{
Piwik::checkUserHasViewAccess( $idSite );
$archive = Piwik_Archive::build($idSite, $period, $date );
$dataTable = $archive->getDataTable('UserSettings_plugin');
$dataTable->queueFilter('Piwik_DataTable_Filter_ReplaceColumnNames');
$dataTable->queueFilter('Piwik_DataTable_Filter_ColumnCallbackAddMetadata', array('label', 'logo', 'Piwik_getPluginsLogo'));
$dataTable->queueFilter('Piwik_DataTable_Filter_ColumnCallbackReplace', array('label', 'ucfirst'));
return $dataTable;
}
}
|