Welcome to mirror list, hosted at ThFree Co, Russian Federation.

Live.php « Live « plugins - github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: f309877ce00bfdc5e02f6dbfdf40fff85bdb8c56 (plain)
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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
<?php
/**
 * Piwik - Open source web analytics
 *
 * @link http://piwik.org
 * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
 *
 * @category Piwik_Plugins
 * @package Live
 */
namespace Piwik\Plugins\Live;


use Piwik\Common;
use Piwik\Menu\MenuMain;
use Piwik\Piwik;
use Piwik\WidgetsList;

/**
 *
 * @package Live
 */
class Live extends \Piwik\Plugin
{

    /**
     * @see Piwik_Plugin::getListHooksRegistered
     */
    public function getListHooksRegistered()
    {
        return array(
            'AssetManager.getJavaScriptFiles'          => 'getJsFiles',
            'AssetManager.getStylesheetFiles'          => 'getStylesheetFiles',
            'WidgetsList.addWidgets'                   => 'addWidget',
            'Menu.Reporting.addItems'                  => 'addMenu',
            'Visualization.getReportDisplayProperties' => 'getReportDisplayProperties',
            'Translate.getClientSideTranslationKeys'   => 'getClientSideTranslationKeys',
        );
    }

    public function getStylesheetFiles(&$stylesheets)
    {
        $stylesheets[] = "plugins/Live/stylesheets/live.less";
        $stylesheets[] = "plugins/Live/stylesheets/visitor_profile.less";
    }

    public function getJsFiles(&$jsFiles)
    {
        $jsFiles[] = "plugins/Live/javascripts/live.js";
        $jsFiles[] = "plugins/Live/javascripts/visitorProfile.js";
        $jsFiles[] = "plugins/Live/javascripts/visitorLog.js";
    }

    public function addMenu()
    {
        MenuMain::getInstance()->add('General_Visitors', 'Live_VisitorLog', array('module' => 'Live', 'action' => 'indexVisitorLog'), true, $order = 5);
    }

    public function addWidget()
    {
        WidgetsList::add('Live!', 'Live_VisitorsInRealTime', 'Live', 'widget');
        WidgetsList::add('Live!', 'Live_VisitorLog', 'Live', 'getVisitorLog');
        WidgetsList::add('Live!', 'Live_RealTimeVisitorCount', 'Live', 'getSimpleLastVisitCount');
        WidgetsList::add('Live!', 'Live_VisitorProfile', 'Live', 'getVisitorProfilePopup');
    }

    public function getClientSideTranslationKeys(&$translationKeys)
    {
        $translationKeys[] = "Live_VisitorProfile";
        $translationKeys[] = "Live_NoMoreVisits";
        $translationKeys[] = "Live_ShowMap";
        $translationKeys[] = "Live_HideMap";
        $translationKeys[] = "Live_PageRefreshed";
    }

    public function getReportDisplayProperties(&$properties)
    {
        $properties['Live.getLastVisitsDetails'] = $this->getDisplayPropertiesForGetLastVisitsDetails();
    }

    private function getDisplayPropertiesForGetLastVisitsDetails()
    {
        return array(
            'default_view_type'           => 'Piwik\\Plugins\\Live\\VisitorLog',
            'disable_generic_filters'     => true,
            'enable_sort'                 => false,
            'filter_sort_column'          => 'idVisit',
            'filter_sort_order'           => 'asc',
            'show_search'                 => false,
            'filter_limit'                => 20,
            'show_offset_information'     => false,
            'show_exclude_low_population' => false,
            'show_all_views_icons'        => false,
            'show_table_all_columns'      => false,
            'show_export_as_rss_feed'     => false,
            'documentation'               => Piwik::translate('Live_VisitorLogDocumentation', array('<br />', '<br />')),
            'custom_parameters'           => array(
                // set a very high row count so that the next link in the footer of the data table is always shown
                'totalRows'         => 10000000,

                'filterEcommerce'   => Common::getRequestVar('filterEcommerce', 0, 'int'),
                'pageUrlNotDefined' => Piwik::translate('General_NotDefined', Piwik::translate('Actions_ColumnPageURL'))
            ),
            'footer_icons'                => array(
                array(
                    'class'   => 'tableAllColumnsSwitch',
                    'buttons' => array(
                        array(
                            'id'    => 'Piwik\\Plugins\\Live\\VisitorLog',
                            'title' => Piwik::translate('Live_LinkVisitorLog'),
                            'icon'  => 'plugins/Zeitgeist/images/table.png'
                        )
                    )
                )
            ),
            'visualization_properties'    => array(
                'table' => array(
                    'disable_row_actions' => true,
                )
            )
        );
    }
}