Blame view

backend/views/site/analytics.php 8.08 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
       */
      
c39f00f8   Alexey Boroda   -Am charts ready
10
      use speixoto\amcharts\Widget;
5e021d7a   Alexey Boroda   -Tabs for analyti...
11
      use yii\bootstrap\Tabs;
3cae1b75   Alexey Boroda   -Analytics almost...
12
      use yii\web\View;
8b3dc47b   Yarik   XPanel removed
13
      use yiister\gentelella\widgets\Panel;
05a089dd   Alexey Boroda   -Analytics almost...
14
15
16
17
  
  ?>
  
  <div class="row">
8b3dc47b   Yarik   XPanel removed
18
19
20
21
22
23
24
25
26
      <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>
          </div>
05a089dd   Alexey Boroda   -Analytics almost...
27
      </div>
8b3dc47b   Yarik   XPanel removed
28
29
30
31
32
33
34
35
36
      <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>
          </div>
05a089dd   Alexey Boroda   -Analytics almost...
37
      </div>
8b3dc47b   Yarik   XPanel removed
38
39
40
41
42
43
44
45
46
      <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>
          </div>
05a089dd   Alexey Boroda   -Analytics almost...
47
      </div>
8b3dc47b   Yarik   XPanel removed
48
49
50
51
52
53
54
55
56
      <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>
          </div>
05a089dd   Alexey Boroda   -Analytics almost...
57
      </div>
05a089dd   Alexey Boroda   -Analytics almost...
58
59
60
  </div>
  
  <div class="row">
8b3dc47b   Yarik   XPanel removed
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
124
125
126
127
128
129
130
131
132
133
134
      <div class="col-md-12">
          <?php $panel = Panel::begin(
              [
                  'header' => 'Analytics',
              ]
          ); ?>
          
          <?php
              $chartConfiguration = [
                  'type'          => 'serial',
                  'dataProvider'  => $data[ 'plot' ],
                  'categoryField' => 'day',
                  'categoryAxis'  => [
                      'labelFrequency' => 5,
                  ],
                  'graphs'        => [
                      [
                          "balloon"                     => [
                              "drop"              => true,
                              "adjustBorderColor" => false,
                              "color"             => "#ffffff",
                          ],
                          "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: [[users]]</span>",
                          "lineColor"                   => '#9ABCC3',
                      ],
                      [
                          "balloon"                     => [
                              "drop"              => true,
                              "adjustBorderColor" => false,
                              "color"             => "#ffffff",
                          ],
                          "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: [[sessions]]</span>",
                          "lineColor"                   => '#A8E3D6',
                      ],
                  ],
                  'chartCursor'   => [
                      "pan"                     => true,
                      "valueLineEnabled"        => true,
                      "valueLineBalloonEnabled" => true,
                      "cursorAlpha"             => 1,
                      "cursorColor"             => "#1ABB9C",
                      "limitToGraph"            => "g1",
                      "valueLineAlpha"          => 0.2,
                      "valueZoomable"           => true,
                  ],
              ];
              
              echo Widget::widget(
                  [
                      'chartConfiguration' => $chartConfiguration,
                      'width'              => '100%',
                  ]
              );
          ?>
          
          <?php $panel::end(); ?>
e01541b2   Alexey Boroda   -Am charts
135
      
8b3dc47b   Yarik   XPanel removed
136
      </div>
05a089dd   Alexey Boroda   -Analytics almost...
137
138
139
  </div>
  
  <div class="row">
8b3dc47b   Yarik   XPanel removed
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
      <div class="col-lg-6 col-md-6 col-sm-12 col-xs-12">
          <?php $panel = Panel::begin(
              [
                  'header' => 'Analytics',
              ]
          ); ?>
          
          <?php
              $chartConfiguration = [
                  "type"         => "pie",
                  "titleField"   => "category",
                  "valueField"   => "column-1",
                  "dataProvider" => [
                      [
                          "category" => "New Visitor",
                          "column-1" => round(intval($data[ 'new' ]), 2),
                      ],
                      [
                          "category" => "Returning Visitor",
                          "column-1" => 100 - round(intval($data[ 'new' ]), 2),
                      ],
                  ],
                  "colors"       => [
                      "#A8E3D6",
                      "#9ABCC3",
                  ],
              ];
              
              echo Widget::widget(
                  [
                      'chartConfiguration' => $chartConfiguration,
                      'width'              => '100%',
                  ]
              );
          ?>
          
          <?php $panel::end(); ?>
      </div>
c39f00f8   Alexey Boroda   -Am charts ready
178
      
8b3dc47b   Yarik   XPanel removed
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
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
      <div class="col-lg-6 col-md-6 col-sm-12 col-xs-12">
          
          <?php $panel = Panel::begin(
              [
                  'header' => 'Analytics',
              ]
          ); ?>
          
          <?php
              echo Tabs::widget(
                  [
                      'options' => [
                          'class' => 'bar_tabs',
                      ],
                      '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',
                                  ]
                              ),
                          ],
                      ],
                  ]
              );
          
          ?>
          
          <?php $panel::end(); ?>
      
      </div>
05a089dd   Alexey Boroda   -Analytics almost...
234
  
c39f00f8   Alexey Boroda   -Am charts ready
235
  </div>