Blame view

backend/views/site/analytics.php 7.68 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
      use artbox\gentelella\widgets\XPanel;
c39f00f8   Alexey Boroda   -Am charts ready
11
      use speixoto\amcharts\Widget;
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
            $chartConfiguration = [
                'type'          => 'serial',
                'dataProvider'  => $data[ 'plot' ],
                'categoryField' => 'day',
c39f00f8   Alexey Boroda   -Am charts ready
74
75
76
                'categoryAxis'  => [
                    'labelFrequency' => 5,
                ],
e01541b2   Alexey Boroda   -Am charts
77
78
79
80
81
82
                'graphs'        => [
                    [
                        "balloon"                     => [
                            "drop"              => true,
                            "adjustBorderColor" => false,
                            "color"             => "#ffffff",
3cae1b75   Alexey Boroda   -Analytics almost...
83
                        ],
e01541b2   Alexey Boroda   -Am charts
84
85
86
87
88
89
90
91
92
                        "bullet"                      => "round",
                        "bulletBorderAlpha"           => 1,
                        "bulletColor"                 => "#FFFFFF",
                        "bulletSize"                  => 5,
                        "hideBulletsCount"            => 50,
                        "lineThickness"               => 2,
                        "title"                       => "red line",
                        "useLineColorForBulletBorder" => true,
                        "valueField"                  => "users",
c39f00f8   Alexey Boroda   -Am charts ready
93
94
                        "balloonText"                 => "<span style='font-size:18px;'>Users: [[users]]</span>",
                        "lineColor"                   => '#9ABCC3',
e01541b2   Alexey Boroda   -Am charts
95
96
97
98
99
100
                    ],
                    [
                        "balloon"                     => [
                            "drop"              => true,
                            "adjustBorderColor" => false,
                            "color"             => "#ffffff",
3cae1b75   Alexey Boroda   -Analytics almost...
101
                        ],
e01541b2   Alexey Boroda   -Am charts
102
103
104
105
106
107
108
109
110
                        "bullet"                      => "round",
                        "bulletBorderAlpha"           => 1,
                        "bulletColor"                 => "#FFFFFF",
                        "bulletSize"                  => 5,
                        "hideBulletsCount"            => 50,
                        "lineThickness"               => 2,
                        "title"                       => "red line",
                        "useLineColorForBulletBorder" => true,
                        "valueField"                  => "sessions",
c39f00f8   Alexey Boroda   -Am charts ready
111
112
                        "balloonText"                 => "<span style='font-size:18px;'>Sessions: [[sessions]]</span>",
                        "lineColor"                   => '#A8E3D6',
3cae1b75   Alexey Boroda   -Analytics almost...
113
                    ],
e01541b2   Alexey Boroda   -Am charts
114
                ],
c39f00f8   Alexey Boroda   -Am charts ready
115
116
117
118
119
120
121
122
123
124
                'chartCursor'   => [
                    "pan"                     => true,
                    "valueLineEnabled"        => true,
                    "valueLineBalloonEnabled" => true,
                    "cursorAlpha"             => 1,
                    "cursorColor"             => "#1ABB9C",
                    "limitToGraph"            => "g1",
                    "valueLineAlpha"          => 0.2,
                    "valueZoomable"           => true,
                ],
e01541b2   Alexey Boroda   -Am charts
125
126
            ];
      
c39f00f8   Alexey Boroda   -Am charts ready
127
            echo Widget::widget(
e01541b2   Alexey Boroda   -Am charts
128
129
130
                [
                    'chartConfiguration' => $chartConfiguration,
                    'width'              => '100%',
3cae1b75   Alexey Boroda   -Analytics almost...
131
132
133
134
135
136
137
                ]
            );
        ?>
        
        <?php $panel::end(); ?>
    
    </div>
05a089dd   Alexey Boroda   -Analytics almost...
138
139
140
  </div>
  
  <div class="row">
e01541b2   Alexey Boroda   -Am charts
141
    <div class="col-lg-6 col-md-6 col-sm-12 col-xs-12">
3cae1b75   Alexey Boroda   -Analytics almost...
142
143
144
        <?php $panel = XPanel::begin(
            [
                'title'         => 'Analytics',
c8500c2f   Alexey Boroda   -Analytics in pro...
145
                'toolbarLayout' => false,
3cae1b75   Alexey Boroda   -Analytics almost...
146
147
148
149
            ]
        ); ?>
        
        <?php
c39f00f8   Alexey Boroda   -Am charts ready
150
151
152
153
154
155
156
157
            $chartConfiguration = [
                "type"         => "pie",
                "titleField"   => "category",
                "valueField"   => "column-1",
                "dataProvider" => [
                    [
                        "category" => "New Visitor",
                        "column-1" => round(intval($data[ 'new' ]), 2),
3cae1b75   Alexey Boroda   -Analytics almost...
158
                    ],
c39f00f8   Alexey Boroda   -Am charts ready
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
                    [
                        "category" => "Returning Visitor",
                        "column-1" => 100 - round(intval($data[ 'new' ]), 2),
                    ],
                ],
                "colors"       => [
                    "#A8E3D6",
                    "#9ABCC3",
                ],
            ];
      
            echo Widget::widget(
                [
                    'chartConfiguration' => $chartConfiguration,
                    'width'              => '100%',
3cae1b75   Alexey Boroda   -Analytics almost...
174
175
176
177
178
179
                ]
            );
        ?>
        
        <?php $panel::end(); ?>
    </div>
5e021d7a   Alexey Boroda   -Tabs for analyti...
180
    
e01541b2   Alexey Boroda   -Am charts
181
    <div class="col-lg-6 col-md-6 col-sm-12 col-xs-12">
5e021d7a   Alexey Boroda   -Tabs for analyti...
182
183
184
185
186
187
188
        
        <?php $panel = XPanel::begin(
            [
                'title'         => 'Analytics',
                'toolbarLayout' => false,
            ]
        ); ?>
e01541b2   Alexey Boroda   -Am charts
189
190
191
192
  
        <?php
            echo Tabs::widget(
                [
c716072a   Alexey Boroda   -Bar tabs
193
194
195
196
                    'options' => [
                        'class' => 'bar_tabs',
                    ],
                    'items'   => [
e01541b2   Alexey Boroda   -Am charts
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
                        [
                            '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...
233
234
235
236
        
        <?php $panel::end(); ?>
    
    </div>
05a089dd   Alexey Boroda   -Analytics almost...
237
  
c39f00f8   Alexey Boroda   -Am charts ready
238
  </div>