Blame view

backend/views/site/analytics.php 8.01 KB
668f6a77   Alexey Boroda   -Analytics started
1
  <?php
3cae1b75   Alexey Boroda   -Analytics almost...
2
3
4
      /**
       * @var View  $this
       * @var array $data
e01541b2   Alexey Boroda   -Am charts
5
6
7
       * @var array $browsers
       * @var array $cityes
       * @var array $countries
3cae1b75   Alexey Boroda   -Analytics almost...
8
9
       */
      
05a089dd   Alexey Boroda   -Analytics almost...
10
11
      use artbox\gentelella\widgets\XPanel;
      use dosamigos\highcharts\HighCharts;
5e021d7a   Alexey Boroda   -Tabs for analyti...
12
      use yii\bootstrap\Tabs;
3cae1b75   Alexey Boroda   -Analytics almost...
13
      use yii\web\View;
05a089dd   Alexey Boroda   -Analytics almost...
14
15
16
17
  
  ?>
  
  <div class="row">
3cae1b75   Alexey Boroda   -Analytics almost...
18
19
20
21
22
23
24
25
    <div class="animated flipInY col-lg-3 col-md-3 col-sm-6 col-xs-12">
      <div class="tile-stats">
        <div class="icon"><i class="fa fa-clock-o"></i>
        </div>
        <div class="count"><?= $data[ 'sessions' ] ?></div>
        
        <h3>Sessions</h3>
        <p>Lorem ipsum psdea itgum rixt.</p>
05a089dd   Alexey Boroda   -Analytics almost...
26
      </div>
3cae1b75   Alexey Boroda   -Analytics almost...
27
28
29
30
31
32
33
34
35
    </div>
    <div class="animated flipInY col-lg-3 col-md-3 col-sm-6 col-xs-12">
      <div class="tile-stats">
        <div class="icon"><i class="fa fa-user"></i>
        </div>
        <div class="count"><?= $data[ 'users' ] ?></div>
        
        <h3>Users</h3>
        <p>Lorem ipsum psdea itgum rixt.</p>
05a089dd   Alexey Boroda   -Analytics almost...
36
      </div>
3cae1b75   Alexey Boroda   -Analytics almost...
37
38
39
40
41
42
43
44
45
    </div>
    <div class="animated flipInY col-lg-3 col-md-3 col-sm-6 col-xs-12">
      <div class="tile-stats">
        <div class="icon"><i class="fa fa-eye"></i>
        </div>
        <div class="count"><?= $data[ 'views' ] ?></div>
        
        <h3>Page views</h3>
        <p>Lorem ipsum psdea itgum rixt.</p>
05a089dd   Alexey Boroda   -Analytics almost...
46
      </div>
3cae1b75   Alexey Boroda   -Analytics almost...
47
48
49
50
51
52
53
54
55
    </div>
    <div class="animated flipInY col-lg-3 col-md-3 col-sm-6 col-xs-12">
      <div class="tile-stats">
        <div class="icon"><i class="fa fa-plus"></i>
        </div>
        <div class="count"><?= round(intval($data[ 'new' ]), 2) ?> %</div>
        
        <h3>New sessions</h3>
        <p>Lorem ipsum psdea itgum rixt.</p>
05a089dd   Alexey Boroda   -Analytics almost...
56
      </div>
3cae1b75   Alexey Boroda   -Analytics almost...
57
    </div>
05a089dd   Alexey Boroda   -Analytics almost...
58
59
60
  </div>
  
  <div class="row">
3cae1b75   Alexey Boroda   -Analytics almost...
61
62
63
64
    <div class="col-md-12">
        <?php $panel = XPanel::begin(
            [
                'title'         => 'Analytics',
c8500c2f   Alexey Boroda   -Analytics in pro...
65
                'toolbarLayout' => false,
3cae1b75   Alexey Boroda   -Analytics almost...
66
67
68
69
            ]
        ); ?>
        
        <?php
e01541b2   Alexey Boroda   -Am charts
70
71
72
73
74
75
76
77
78
79
            $chartConfiguration = [
                'type'          => 'serial',
                'dataProvider'  => $data[ 'plot' ],
                'categoryField' => 'day',
                'graphs'        => [
                    [
                        "balloon"                     => [
                            "drop"              => true,
                            "adjustBorderColor" => false,
                            "color"             => "#ffffff",
3cae1b75   Alexey Boroda   -Analytics almost...
80
                        ],
e01541b2   Alexey Boroda   -Am charts
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
                        "bullet"                      => "round",
                        "bulletBorderAlpha"           => 1,
                        "bulletColor"                 => "#FFFFFF",
                        "bulletSize"                  => 5,
                        "hideBulletsCount"            => 50,
                        "lineThickness"               => 2,
                        "title"                       => "red line",
                        "useLineColorForBulletBorder" => true,
                        "valueField"                  => "users",
                        "balloonText"                 => "<span style='font-size:18px;'>[[users]]</span>",
                        "lineColors"                  => '#9ABCC3',
                    ],
                    [
                        "balloon"                     => [
                            "drop"              => true,
                            "adjustBorderColor" => false,
                            "color"             => "#ffffff",
3cae1b75   Alexey Boroda   -Analytics almost...
98
                        ],
e01541b2   Alexey Boroda   -Am charts
99
100
101
102
103
104
105
106
107
108
109
                        "bullet"                      => "round",
                        "bulletBorderAlpha"           => 1,
                        "bulletColor"                 => "#FFFFFF",
                        "bulletSize"                  => 5,
                        "hideBulletsCount"            => 50,
                        "lineThickness"               => 2,
                        "title"                       => "red line",
                        "useLineColorForBulletBorder" => true,
                        "valueField"                  => "sessions",
                        "balloonText"                 => "<span style='font-size:18px;'>[[sessions]]</span>",
                        "lineColors"                  => '#A8E3D6',
3cae1b75   Alexey Boroda   -Analytics almost...
110
                    ],
e01541b2   Alexey Boroda   -Am charts
111
112
113
114
115
116
117
                ],
            ];
      
            echo speixoto\amcharts\Widget::widget(
                [
                    'chartConfiguration' => $chartConfiguration,
                    'width'              => '100%',
3cae1b75   Alexey Boroda   -Analytics almost...
118
119
120
121
122
123
124
                ]
            );
        ?>
        
        <?php $panel::end(); ?>
    
    </div>
05a089dd   Alexey Boroda   -Analytics almost...
125
126
127
  </div>
  
  <div class="row">
e01541b2   Alexey Boroda   -Am charts
128
    <div class="col-lg-6 col-md-6 col-sm-12 col-xs-12">
3cae1b75   Alexey Boroda   -Analytics almost...
129
130
131
        <?php $panel = XPanel::begin(
            [
                'title'         => 'Analytics',
c8500c2f   Alexey Boroda   -Analytics in pro...
132
                'toolbarLayout' => false,
3cae1b75   Alexey Boroda   -Analytics almost...
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
            ]
        ); ?>
        
        <?php
            echo HighCharts::widget(
                [
                    'clientOptions' => [
                        'exporting'   => [
                            'enabled' => false,
                        ],
                        'colors'      => [
                            '#9ABCC3',
                            '#A8E3D6',
                        ],
                        'chart'       => [
                            'plotBackgroundColor' => null,
                            'plotBorderWidth'     => null,
                            'plotShadow'          => false,
                            'type'                => 'pie',
                        ],
                        'title'       => [
                            'text' => 'Analytics',
                        ],
                        'series'      => [
                            [
                                'name' => 'Sessions',
                                'data' => [
                                    [
                                        'name' => 'New visitor',
                                        'y'    => round(intval($data[ 'new' ]), 2),
                                    ],
                                    [
                                        'name' => 'Returning Visitor',
                                        'y'    => 100 - round(intval($data[ 'new' ]), 2),
                                    ],
                                ],
                            ],
                        ],
                        'credits'     => [
                            'enabled' => false,
                        ],
                        'plotOptions' => [
                            'pie' => [
                                'allowPointSelect' => true,
                                'cursor'           => 'pointer',
                            ],
                        ],
                    ],
                ]
            );
        ?>
        
        <?php $panel::end(); ?>
    </div>
5e021d7a   Alexey Boroda   -Tabs for analyti...
187
    
e01541b2   Alexey Boroda   -Am charts
188
    <div class="col-lg-6 col-md-6 col-sm-12 col-xs-12">
5e021d7a   Alexey Boroda   -Tabs for analyti...
189
190
191
192
193
194
195
        
        <?php $panel = XPanel::begin(
            [
                'title'         => 'Analytics',
                'toolbarLayout' => false,
            ]
        ); ?>
e01541b2   Alexey Boroda   -Am charts
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
  
        <?php
            echo Tabs::widget(
                [
                    'items' => [
                        [
                            'label'   => 'Browsers',
                            'content' => $this->render(
                                '_table',
                                [
                                    'data' => $browsers,
                                    'name' => 'Browser',
                                ]
                            ),
                            'active'  => true,
                        ],
                        [
                            'label'   => 'Cities',
                            'content' => $this->render(
                                '_table',
                                [
                                    'data' => $cityes,
                                    'name' => 'City',
                                ]
                            ),
                        ],
                        [
                            'label'   => 'Countries',
                            'content' => $this->render(
                                '_table',
                                [
                                    'data' => $countries,
                                    'name' => 'Country',
                                ]
                            ),
                        ],
                    ],
                ]
            );
  
        ?>
5e021d7a   Alexey Boroda   -Tabs for analyti...
237
238
239
240
        
        <?php $panel::end(); ?>
    
    </div>
05a089dd   Alexey Boroda   -Analytics almost...
241
242
  
  </div>