Commit 63f22d739f34a70d6204dd305adc1f1aa52b28fc
Merge remote-tracking branch 'origin/master'
Showing
265 changed files
with
605 additions
and
358 deletions
Show diff stats
Too many changes.
To preserve performance only 100 of 265 files are displayed.
... | ... | @@ -15,10 +15,12 @@ |
15 | 15 | public $baseUrl = '@web'; |
16 | 16 | public $css = []; |
17 | 17 | public $js = [ |
18 | + 'js/jquery.animateNumber.js', | |
18 | 19 | 'js/analytics.js', |
19 | 20 | ]; |
20 | 21 | public $depends = [ |
21 | - 'speixoto\amcharts\AmChartAsset', | |
22 | + 'artbox\core\assets\ArtboxAmChartAsset', | |
23 | + 'backend\assets\AppAsset', | |
22 | 24 | ]; |
23 | 25 | } |
24 | 26 | |
25 | 27 | \ No newline at end of file | ... | ... |
1 | +<?php | |
2 | + | |
3 | + namespace backend\controllers; | |
4 | + | |
5 | + use backend\models\Analytics; | |
6 | + use common\models\Settings; | |
7 | + use yii\filters\VerbFilter; | |
8 | + use yii\web\Controller; | |
9 | + use yii\web\Response; | |
10 | + | |
11 | + class AjaxController extends Controller | |
12 | + { | |
13 | + public $enableCsrfValidation = false; | |
14 | + | |
15 | + public function behaviors() | |
16 | + { | |
17 | + return [ | |
18 | + 'verbs' => [ | |
19 | + 'class' => VerbFilter::className(), | |
20 | + 'actions' => [ | |
21 | + 'analytics' => [ 'post' ], | |
22 | + ], | |
23 | + ], | |
24 | + ]; | |
25 | + } | |
26 | + | |
27 | + public function actionAnalytics() | |
28 | + { | |
29 | + \Yii::$app->response->format = Response::FORMAT_JSON; | |
30 | + | |
31 | + $settings = Settings::getInstance(); | |
32 | + | |
33 | + $analytics = new Analytics( | |
34 | + [ | |
35 | + 'viewId' => $settings->analytics_key, | |
36 | + ] | |
37 | + ); | |
38 | + $data = $analytics->generateData(); | |
39 | + | |
40 | + $browsers = $data[ 'table' ][ 0 ]; | |
41 | + arsort($browsers); | |
42 | + | |
43 | + $cityes = $data[ 'table' ][ 1 ]; | |
44 | + arsort($cityes); | |
45 | + | |
46 | + $countries = $data[ 'table' ][ 2 ]; | |
47 | + arsort($countries); | |
48 | + | |
49 | + return [ | |
50 | + 'plot' => $data[ 'plot' ], | |
51 | + 'pie' => [ | |
52 | + [ | |
53 | + "category" => "New Visitor", | |
54 | + "column-1" => round(intval($data[ 'new' ]), 2), | |
55 | + ], | |
56 | + [ | |
57 | + "category" => "Returning Visitor", | |
58 | + "column-1" => 100 - round(intval($data[ 'new' ]), 2), | |
59 | + ], | |
60 | + ], | |
61 | + 'browsers' => $this->renderPartial( | |
62 | + '_table', | |
63 | + [ | |
64 | + 'data' => $browsers, | |
65 | + 'name' => 'Browser', | |
66 | + ] | |
67 | + ), | |
68 | + 'cityes' => $this->renderPartial( | |
69 | + '_table', | |
70 | + [ | |
71 | + 'data' => $cityes, | |
72 | + 'name' => 'City', | |
73 | + ] | |
74 | + ), | |
75 | + 'countries' => $this->renderPartial( | |
76 | + '_table', | |
77 | + [ | |
78 | + 'data' => $countries, | |
79 | + 'name' => 'Country', | |
80 | + ] | |
81 | + ), | |
82 | + 'sessions' => (int) $data[ 'sessions' ], | |
83 | + 'users' => (int) $data[ 'users' ], | |
84 | + 'views' => (int) $data[ 'views' ], | |
85 | + 'newusers' => round(intval($data[ 'new' ]), 2), | |
86 | + ]; | |
87 | + } | |
88 | + | |
89 | + } | |
0 | 90 | \ No newline at end of file | ... | ... |
backend/controllers/SiteController.php
1 | 1 | <?php |
2 | 2 | namespace backend\controllers; |
3 | 3 | |
4 | - use backend\models\Analytics; | |
5 | 4 | use common\models\Settings; |
6 | 5 | use Yii; |
7 | 6 | use yii\web\Controller; |
8 | 7 | use yii\filters\VerbFilter; |
9 | 8 | use yii\filters\AccessControl; |
10 | 9 | use common\models\LoginForm; |
11 | - | |
10 | + | |
12 | 11 | /** |
13 | 12 | * Site controller |
14 | 13 | */ |
... | ... | @@ -34,7 +33,7 @@ |
34 | 33 | 'actions' => [ |
35 | 34 | 'logout', |
36 | 35 | 'index', |
37 | - 'analytic', | |
36 | + 'analytics', | |
38 | 37 | ], |
39 | 38 | 'allow' => true, |
40 | 39 | 'roles' => [ '@' ], |
... | ... | @@ -44,7 +43,8 @@ |
44 | 43 | 'verbs' => [ |
45 | 44 | 'class' => VerbFilter::className(), |
46 | 45 | 'actions' => [ |
47 | - 'logout' => [ 'post' ], | |
46 | + 'logout' => [ 'post' ], | |
47 | + 'analytics' => [ 'post' ], | |
48 | 48 | ], |
49 | 49 | ], |
50 | 50 | ]; |
... | ... | @@ -72,33 +72,9 @@ |
72 | 72 | $settings = Settings::getInstance(); |
73 | 73 | |
74 | 74 | if (empty($settings->analytics_key)) { |
75 | - return $this->render('index'); | |
75 | + return $this->render('instruction'); | |
76 | 76 | } else { |
77 | - $analytics = new Analytics( | |
78 | - [ | |
79 | - 'viewId' => $settings->analytics_key, | |
80 | - ] | |
81 | - ); | |
82 | - $data = $analytics->generateData(); | |
83 | - | |
84 | - $browsers = $data[ 'table' ][ 0 ]; | |
85 | - arsort($browsers); | |
86 | - | |
87 | - $cityes = $data[ 'table' ][ 1 ]; | |
88 | - arsort($cityes); | |
89 | - | |
90 | - $countries = $data[ 'table' ][ 2 ]; | |
91 | - arsort($countries); | |
92 | - | |
93 | - return $this->render( | |
94 | - 'analytics', | |
95 | - [ | |
96 | - 'data' => $data, | |
97 | - 'browsers' => $browsers, | |
98 | - 'cityes' => $cityes, | |
99 | - 'countries' => $countries, | |
100 | - ] | |
101 | - ); | |
77 | + return $this->render('index'); | |
102 | 78 | } |
103 | 79 | } |
104 | 80 | |
... | ... | @@ -137,9 +113,4 @@ |
137 | 113 | |
138 | 114 | return $this->goHome(); |
139 | 115 | } |
140 | - | |
141 | - public function actionAnalytic() | |
142 | - { | |
143 | - return $this->render('analytic'); | |
144 | - } | |
145 | 116 | } | ... | ... |
backend/views/site/_table.php renamed to backend/views/ajax/_table.php
100644 → 100755
backend/views/site/analytics.php deleted
1 | -<?php | |
2 | - /** | |
3 | - * @var View $this | |
4 | - * @var array $data | |
5 | - * @var array $browsers | |
6 | - * @var array $cityes | |
7 | - * @var array $countries | |
8 | - */ | |
9 | - | |
10 | - use speixoto\amcharts\Widget; | |
11 | - use yii\bootstrap\Tabs; | |
12 | - use yii\web\View; | |
13 | - use yiister\gentelella\widgets\Panel; | |
14 | - | |
15 | -?> | |
16 | - | |
17 | -<div class="row"> | |
18 | - <div class="animated flipInY col-lg-3 col-md-3 col-sm-6 col-xs-12"> | |
19 | - <div class="tile-stats"> | |
20 | - <div class="icon"><i class="fa fa-clock-o"></i> | |
21 | - </div> | |
22 | - <div class="count"><?= $data[ 'sessions' ] ?></div> | |
23 | - | |
24 | - <h3>Sessions</h3> | |
25 | - <p>Lorem ipsum psdea itgum rixt.</p> | |
26 | - </div> | |
27 | - </div> | |
28 | - <div class="animated flipInY col-lg-3 col-md-3 col-sm-6 col-xs-12"> | |
29 | - <div class="tile-stats"> | |
30 | - <div class="icon"><i class="fa fa-user"></i> | |
31 | - </div> | |
32 | - <div class="count"><?= $data[ 'users' ] ?></div> | |
33 | - | |
34 | - <h3>Users</h3> | |
35 | - <p>Lorem ipsum psdea itgum rixt.</p> | |
36 | - </div> | |
37 | - </div> | |
38 | - <div class="animated flipInY col-lg-3 col-md-3 col-sm-6 col-xs-12"> | |
39 | - <div class="tile-stats"> | |
40 | - <div class="icon"><i class="fa fa-eye"></i> | |
41 | - </div> | |
42 | - <div class="count"><?= $data[ 'views' ] ?></div> | |
43 | - | |
44 | - <h3>Page views</h3> | |
45 | - <p>Lorem ipsum psdea itgum rixt.</p> | |
46 | - </div> | |
47 | - </div> | |
48 | - <div class="animated flipInY col-lg-3 col-md-3 col-sm-6 col-xs-12"> | |
49 | - <div class="tile-stats"> | |
50 | - <div class="icon"><i class="fa fa-plus"></i> | |
51 | - </div> | |
52 | - <div class="count"><?= round(intval($data[ 'new' ]), 2) ?> %</div> | |
53 | - | |
54 | - <h3>New sessions</h3> | |
55 | - <p>Lorem ipsum psdea itgum rixt.</p> | |
56 | - </div> | |
57 | - </div> | |
58 | -</div> | |
59 | - | |
60 | -<div class="row"> | |
61 | - <div class="col-md-12"> | |
62 | - <?php $panel = Panel::begin( | |
63 | - [ | |
64 | - 'header' => 'Analytics', | |
65 | - ] | |
66 | - ); ?> | |
67 | - | |
68 | - <?php | |
69 | - $chartConfiguration = [ | |
70 | - 'type' => 'serial', | |
71 | - 'dataProvider' => $data[ 'plot' ], | |
72 | - 'categoryField' => 'day', | |
73 | - 'categoryAxis' => [ | |
74 | - 'labelFrequency' => 5, | |
75 | - ], | |
76 | - 'graphs' => [ | |
77 | - [ | |
78 | - "balloon" => [ | |
79 | - "drop" => true, | |
80 | - "adjustBorderColor" => false, | |
81 | - "color" => "#ffffff", | |
82 | - ], | |
83 | - "bullet" => "round", | |
84 | - "bulletBorderAlpha" => 1, | |
85 | - "bulletColor" => "#FFFFFF", | |
86 | - "bulletSize" => 5, | |
87 | - "hideBulletsCount" => 50, | |
88 | - "lineThickness" => 2, | |
89 | - "title" => "red line", | |
90 | - "useLineColorForBulletBorder" => true, | |
91 | - "valueField" => "users", | |
92 | - "balloonText" => "<span style='font-size:18px;'>Users: [[users]]</span>", | |
93 | - "lineColor" => '#9ABCC3', | |
94 | - ], | |
95 | - [ | |
96 | - "balloon" => [ | |
97 | - "drop" => true, | |
98 | - "adjustBorderColor" => false, | |
99 | - "color" => "#ffffff", | |
100 | - ], | |
101 | - "bullet" => "round", | |
102 | - "bulletBorderAlpha" => 1, | |
103 | - "bulletColor" => "#FFFFFF", | |
104 | - "bulletSize" => 5, | |
105 | - "hideBulletsCount" => 50, | |
106 | - "lineThickness" => 2, | |
107 | - "title" => "red line", | |
108 | - "useLineColorForBulletBorder" => true, | |
109 | - "valueField" => "sessions", | |
110 | - "balloonText" => "<span style='font-size:18px;'>Sessions: [[sessions]]</span>", | |
111 | - "lineColor" => '#A8E3D6', | |
112 | - ], | |
113 | - ], | |
114 | - 'chartCursor' => [ | |
115 | - "pan" => true, | |
116 | - "valueLineEnabled" => true, | |
117 | - "valueLineBalloonEnabled" => true, | |
118 | - "cursorAlpha" => 1, | |
119 | - "cursorColor" => "#1ABB9C", | |
120 | - "limitToGraph" => "g1", | |
121 | - "valueLineAlpha" => 0.2, | |
122 | - "valueZoomable" => true, | |
123 | - ], | |
124 | - ]; | |
125 | - | |
126 | - echo Widget::widget( | |
127 | - [ | |
128 | - 'chartConfiguration' => $chartConfiguration, | |
129 | - 'width' => '100%', | |
130 | - ] | |
131 | - ); | |
132 | - ?> | |
133 | - | |
134 | - <?php $panel::end(); ?> | |
135 | - | |
136 | - </div> | |
137 | -</div> | |
138 | - | |
139 | -<div class="row"> | |
140 | - <div class="col-lg-6 col-md-6 col-sm-12 col-xs-12"> | |
141 | - <?php $panel = Panel::begin( | |
142 | - [ | |
143 | - 'header' => 'Analytics', | |
144 | - ] | |
145 | - ); ?> | |
146 | - | |
147 | - <?php | |
148 | - $chartConfiguration = [ | |
149 | - "type" => "pie", | |
150 | - "titleField" => "category", | |
151 | - "valueField" => "column-1", | |
152 | - "dataProvider" => [ | |
153 | - [ | |
154 | - "category" => "New Visitor", | |
155 | - "column-1" => round(intval($data[ 'new' ]), 2), | |
156 | - ], | |
157 | - [ | |
158 | - "category" => "Returning Visitor", | |
159 | - "column-1" => 100 - round(intval($data[ 'new' ]), 2), | |
160 | - ], | |
161 | - ], | |
162 | - "colors" => [ | |
163 | - "#A8E3D6", | |
164 | - "#9ABCC3", | |
165 | - ], | |
166 | - ]; | |
167 | - | |
168 | - echo Widget::widget( | |
169 | - [ | |
170 | - 'chartConfiguration' => $chartConfiguration, | |
171 | - 'width' => '100%', | |
172 | - ] | |
173 | - ); | |
174 | - ?> | |
175 | - | |
176 | - <?php $panel::end(); ?> | |
177 | - </div> | |
178 | - | |
179 | - <div class="col-lg-6 col-md-6 col-sm-12 col-xs-12"> | |
180 | - | |
181 | - <?php $panel = Panel::begin( | |
182 | - [ | |
183 | - 'header' => 'Analytics', | |
184 | - ] | |
185 | - ); ?> | |
186 | - | |
187 | - <?php | |
188 | - echo Tabs::widget( | |
189 | - [ | |
190 | - 'options' => [ | |
191 | - 'class' => 'bar_tabs', | |
192 | - ], | |
193 | - 'items' => [ | |
194 | - [ | |
195 | - 'label' => 'Browsers', | |
196 | - 'content' => $this->render( | |
197 | - '_table', | |
198 | - [ | |
199 | - 'data' => $browsers, | |
200 | - 'name' => 'Browser', | |
201 | - ] | |
202 | - ), | |
203 | - 'active' => true, | |
204 | - ], | |
205 | - [ | |
206 | - 'label' => 'Cities', | |
207 | - 'content' => $this->render( | |
208 | - '_table', | |
209 | - [ | |
210 | - 'data' => $cityes, | |
211 | - 'name' => 'City', | |
212 | - ] | |
213 | - ), | |
214 | - ], | |
215 | - [ | |
216 | - 'label' => 'Countries', | |
217 | - 'content' => $this->render( | |
218 | - '_table', | |
219 | - [ | |
220 | - 'data' => $countries, | |
221 | - 'name' => 'Country', | |
222 | - ] | |
223 | - ), | |
224 | - ], | |
225 | - ], | |
226 | - ] | |
227 | - ); | |
228 | - | |
229 | - ?> | |
230 | - | |
231 | - <?php $panel::end(); ?> | |
232 | - | |
233 | - </div> | |
234 | - | |
235 | -</div> | |
236 | - |
backend/views/site/index.php
... | ... | @@ -5,6 +5,7 @@ |
5 | 5 | */ |
6 | 6 | |
7 | 7 | use backend\assets\AnalyticsAsset; |
8 | + use yii\bootstrap\Tabs; | |
8 | 9 | use yii\web\View; |
9 | 10 | use yiister\gentelella\widgets\Panel; |
10 | 11 | |
... | ... | @@ -12,13 +13,117 @@ |
12 | 13 | |
13 | 14 | AnalyticsAsset::register($this); |
14 | 15 | ?> |
16 | +<div class="animated yt-loader"></div> | |
15 | 17 | |
16 | -<?php $panel = Panel::begin( | |
17 | - [ | |
18 | - 'header' => 'Hello!', | |
19 | - ] | |
20 | -); ?> | |
18 | +<div class="row"> | |
19 | + <div class="animated flipInY col-lg-3 col-md-3 col-sm-6 col-xs-12"> | |
20 | + <div class="tile-stats"> | |
21 | + <div class="icon"><i class="fa fa-clock-o"></i> | |
22 | + </div> | |
23 | + | |
24 | + <div class="count" id="sessions">0</div> | |
25 | + | |
26 | + <h3>Sessions</h3> | |
27 | + <p>Lorem ipsum psdea itgum rixt.</p> | |
28 | + </div> | |
29 | + </div> | |
30 | + <div class="animated flipInY col-lg-3 col-md-3 col-sm-6 col-xs-12"> | |
31 | + <div class="tile-stats"> | |
32 | + <div class="icon"><i class="fa fa-user"></i> | |
33 | + </div> | |
34 | + | |
35 | + <div class="count" id="users">0</div> | |
36 | + | |
37 | + <h3>Users</h3> | |
38 | + <p>Lorem ipsum psdea itgum rixt.</p> | |
39 | + </div> | |
40 | + </div> | |
41 | + <div class="animated flipInY col-lg-3 col-md-3 col-sm-6 col-xs-12"> | |
42 | + <div class="tile-stats"> | |
43 | + <div class="icon"><i class="fa fa-eye"></i> | |
44 | + </div> | |
45 | + | |
46 | + <div class="count" id="views">0</div> | |
47 | + | |
48 | + <h3>Page views</h3> | |
49 | + <p>Lorem ipsum psdea itgum rixt.</p> | |
50 | + </div> | |
51 | + </div> | |
52 | + <div class="animated flipInY col-lg-3 col-md-3 col-sm-6 col-xs-12"> | |
53 | + <div class="tile-stats"> | |
54 | + <div class="icon"><i class="fa fa-plus"></i> | |
55 | + </div> | |
56 | + | |
57 | + <div class="count" id="newusers">0</div> | |
58 | + | |
59 | + <h3>New sessions</h3> | |
60 | + <p>Lorem ipsum psdea itgum rixt.</p> | |
61 | + </div> | |
62 | + </div> | |
63 | +</div> | |
21 | 64 | |
22 | -<div id="chart"></div> | |
65 | +<div class="row"> | |
66 | + <div class="col-md-12"> | |
67 | + <?php $panel = Panel::begin( | |
68 | + [ | |
69 | + 'header' => 'Analytic', | |
70 | + ] | |
71 | + ) ?> | |
72 | + | |
73 | + <div id="chartdiv" style="width: 100%;height: 500px"></div> | |
74 | + | |
75 | + <?php $panel::end(); ?> | |
76 | + </div> | |
77 | +</div> | |
23 | 78 | |
24 | -<?php $panel::end(); ?> | |
79 | +<div class="row"> | |
80 | + <div class="col-lg-6 col-md-6 col-sm-12 col-xs-12"> | |
81 | + <?php $panel = Panel::begin( | |
82 | + [ | |
83 | + 'header' => 'Pie chart', | |
84 | + ] | |
85 | + ) ?> | |
86 | + | |
87 | + <div id="piediv" style="width: 100%;height: 400px"></div> | |
88 | + | |
89 | + <?php $panel::end(); ?> | |
90 | + </div> | |
91 | + | |
92 | + <div class="col-lg-6 col-md-6 col-sm-12 col-xs-12"> | |
93 | + | |
94 | + <?php $panel = Panel::begin( | |
95 | + [ | |
96 | + 'header' => 'Some stats', | |
97 | + ] | |
98 | + ); ?> | |
99 | + | |
100 | + <?php | |
101 | + echo Tabs::widget( | |
102 | + [ | |
103 | + 'options' => [ | |
104 | + 'class' => 'bar_tabs', | |
105 | + ], | |
106 | + 'items' => [ | |
107 | + [ | |
108 | + 'label' => 'Browsers', | |
109 | + 'content' => '<div id="browsers"></div>', | |
110 | + 'active' => true, | |
111 | + ], | |
112 | + [ | |
113 | + 'label' => 'Cities', | |
114 | + 'content' => '<div id="cities"></div>', | |
115 | + ], | |
116 | + [ | |
117 | + 'label' => 'Countries', | |
118 | + 'content' => '<div id="countries"></div>', | |
119 | + ], | |
120 | + ], | |
121 | + ] | |
122 | + ); | |
123 | + | |
124 | + ?> | |
125 | + | |
126 | + <?php $panel::end(); ?> | |
127 | + | |
128 | + </div> | |
129 | +</div> | ... | ... |
1 | +<?php | |
2 | + /** | |
3 | + * @var View $this | |
4 | + * @var array $data | |
5 | + * @var array $browsers | |
6 | + * @var array $cityes | |
7 | + * @var array $countries | |
8 | + */ | |
9 | + | |
10 | + use yii\web\View; | |
11 | + use yiister\gentelella\widgets\Panel; | |
12 | + | |
13 | +?> | |
14 | + | |
15 | +<div class="row"> | |
16 | + <?php $panel = Panel::begin( | |
17 | + [ | |
18 | + 'header' => 'Instruction', | |
19 | + ] | |
20 | + ) ?> | |
21 | + <div class="jumbotron"> | |
22 | + <h1>Hello, world!</h1> | |
23 | + <p>This is a simple hero unit, a simple jumbotron-style component for calling extra attention to featured content or information.</p> | |
24 | + </div> | |
25 | + <?php $panel::end(); ?> | |
26 | +</div> | |
27 | + | ... | ... |
backend/web/css/custom.css
... | ... | @@ -4182,7 +4182,66 @@ ul.notifications { |
4182 | 4182 | .dataTables_length { float:none; } |
4183 | 4183 | } |
4184 | 4184 | |
4185 | +.animated { | |
4186 | + -webkit-animation-duration: 5s; | |
4187 | + animation-duration: 5s; | |
4188 | + -webkit-animation-fill-mode: both; | |
4189 | + animation-fill-mode: both; | |
4190 | + -moz-user-select: none; | |
4191 | + -ms-user-select: none; | |
4192 | + -webkit-user-select: none; | |
4193 | +} | |
4194 | + | |
4195 | +.yt-loader { | |
4196 | + -webkit-animation-name: horizontalProgressBar; | |
4197 | + animation-name: horizontalProgressBar; | |
4198 | + -webkit-animation-timing-function: ease; | |
4199 | + animation-timing-function: ease; | |
4200 | + background: #1abb9c; | |
4201 | + height: 3px; | |
4202 | + left: 0; | |
4203 | + position: fixed; | |
4204 | + top: 0; | |
4205 | + width: 0%; | |
4206 | + z-index: 9999; | |
4207 | +} | |
4208 | + | |
4209 | +@keyframes horizontalProgressBar { | |
4210 | + 0% { | |
4211 | + width: 0%; | |
4212 | + } | |
4213 | + 25% { | |
4214 | + width: 22%; | |
4215 | + } | |
4216 | + 50% { | |
4217 | + width: 55%; | |
4218 | + } | |
4219 | + 75% { | |
4220 | + width: 83%; | |
4221 | + } | |
4222 | + 100% { | |
4223 | + width: 100%; | |
4224 | + } | |
4225 | +} | |
4185 | 4226 | |
4227 | +@-webkit-keyframes horizontalProgressBar /* Safari and Chrome */ | |
4228 | +{ | |
4229 | + 0% { | |
4230 | + width: 0%; | |
4231 | + } | |
4232 | + 25% { | |
4233 | + width: 22%; | |
4234 | + } | |
4235 | + 50% { | |
4236 | + width: 55%; | |
4237 | + } | |
4238 | + 75% { | |
4239 | + width: 83%; | |
4240 | + } | |
4241 | + 100% { | |
4242 | + width: 100%; | |
4243 | + } | |
4244 | +} | |
4186 | 4245 | |
4187 | 4246 | |
4188 | 4247 | /* CSS3 Checkbox */ | ... | ... |
1 | -var chart = AmCharts.makeChart( | |
2 | - "chart", { | |
3 | - "type": "pie", | |
4 | - "dataProvider": [ | |
1 | +$( | |
2 | + function() { | |
3 | + $.ajax( | |
5 | 4 | { |
6 | - "country": "Lithuania", | |
7 | - "litres": 501.9 | |
8 | - }, | |
9 | - { | |
10 | - "country": "Czech Republic", | |
11 | - "litres": 301.9 | |
12 | - }, | |
13 | - { | |
14 | - "country": "Ireland", | |
15 | - "litres": 201.1 | |
16 | - }, | |
17 | - { | |
18 | - "country": "Germany", | |
19 | - "litres": 165.8 | |
20 | - }, | |
21 | - { | |
22 | - "country": "Australia", | |
23 | - "litres": 139.9 | |
24 | - }, | |
25 | - { | |
26 | - "country": "Austria", | |
27 | - "litres": 128.3 | |
28 | - }, | |
29 | - { | |
30 | - "country": "UK", | |
31 | - "litres": 99 | |
32 | - }, | |
33 | - { | |
34 | - "country": "Belgium", | |
35 | - "litres": 60 | |
36 | - }, | |
37 | - { | |
38 | - "country": "The Netherlands", | |
39 | - "litres": 50 | |
5 | + url: "/admin/ajax/analytics", | |
6 | + type: "POST", | |
7 | + success: function(data) { | |
8 | + // Replacing top data | |
9 | + $('#sessions') | |
10 | + .animateNumber({number: data.sessions}, 2000); | |
11 | + $('#users') | |
12 | + .animateNumber({number: data.users}, 2000); | |
13 | + $('#views') | |
14 | + .animateNumber({number: data.views}, 2000); | |
15 | + $('#newusers') | |
16 | + .animateNumber({number: data.newusers}, 2000); | |
17 | + // Building main chart | |
18 | + var chart = AmCharts.makeChart( | |
19 | + "chartdiv", { | |
20 | + "type": "serial", | |
21 | + 'dataProvider': data.plot, | |
22 | + 'categoryField': 'day', | |
23 | + 'categoryAxis': { | |
24 | + 'labelFrequency': 5 | |
25 | + }, | |
26 | + 'graphs': [ | |
27 | + { | |
28 | + 'balloon': { | |
29 | + "drop": true, | |
30 | + "adjustBorderColor": false, | |
31 | + "color": "#ffffff" | |
32 | + }, | |
33 | + "bullet": "round", | |
34 | + "bulletBorderAlpha": 1, | |
35 | + "bulletColor": "#FFFFFF", | |
36 | + "bulletSize": 5, | |
37 | + "hideBulletsCount": 50, | |
38 | + "lineThickness": 2, | |
39 | + "title": "red line", | |
40 | + "useLineColorForBulletBorder": true, | |
41 | + "valueField": "users", | |
42 | + "balloonText": "<span style='font-size:18px;'>Users: [[users]]</span>", | |
43 | + "lineColor": '#9ABCC3' | |
44 | + }, | |
45 | + { | |
46 | + 'balloon': { | |
47 | + "drop": true, | |
48 | + "adjustBorderColor": false, | |
49 | + "color": "#ffffff" | |
50 | + }, | |
51 | + "bullet": "round", | |
52 | + "bulletBorderAlpha": 1, | |
53 | + "bulletColor": "#FFFFFF", | |
54 | + "bulletSize": 5, | |
55 | + "hideBulletsCount": 50, | |
56 | + "lineThickness": 2, | |
57 | + "title": "red line", | |
58 | + "useLineColorForBulletBorder": true, | |
59 | + "valueField": "sessions", | |
60 | + "balloonText": "<span style='font-size:18px;'>Sessions: [[sessions]]</span>", | |
61 | + "lineColor": '#A8E3D6' | |
62 | + } | |
63 | + ], | |
64 | + 'chartCursor': { | |
65 | + "pan": true, | |
66 | + "valueLineEnabled": true, | |
67 | + "valueLineBalloonEnabled": true, | |
68 | + "cursorAlpha": 1, | |
69 | + "cursorColor": "#1ABB9C", | |
70 | + "limitToGraph": "g1", | |
71 | + "valueLineAlpha": 0.2, | |
72 | + "valueZoomable": true | |
73 | + } | |
74 | + } | |
75 | + ); | |
76 | + | |
77 | + // Building pie chart | |
78 | + var pie = AmCharts.makeChart( | |
79 | + "piediv", { | |
80 | + "type": "pie", | |
81 | + 'dataProvider': data.pie, | |
82 | + "titleField": "category", | |
83 | + "valueField": "column-1", | |
84 | + 'colors': [ | |
85 | + "#A8E3D6", | |
86 | + "#9ABCC3" | |
87 | + ] | |
88 | + } | |
89 | + ); | |
90 | + // Replacing table stabs | |
91 | + $('#browsers') | |
92 | + .replaceWith(data.browsers); | |
93 | + $('#cities') | |
94 | + .replaceWith(data.cityes); | |
95 | + $('#countries') | |
96 | + .replaceWith(data.countries); | |
97 | + $('.yt-loader') | |
98 | + .remove(); | |
99 | + } | |
40 | 100 | } |
41 | - ], | |
42 | - "valueField": "litres", | |
43 | - "titleField": "country", | |
44 | - "balloon": { | |
45 | - "fixedPosition": true | |
46 | - }, | |
47 | - "export": { | |
48 | - "enabled": true | |
49 | - } | |
101 | + ) | |
50 | 102 | } |
51 | -); | |
52 | 103 | \ No newline at end of file |
104 | +); | |
105 | + | ... | ... |
backend/web/js/custom.js
... | ... | @@ -5045,7 +5045,7 @@ if (typeof NProgress != 'undefined') { |
5045 | 5045 | init_daterangepicker_reservation(); |
5046 | 5046 | init_SmartWizard(); |
5047 | 5047 | init_EasyPieChart(); |
5048 | - init_charts(); | |
5048 | + // init_charts(); | |
5049 | 5049 | init_echarts(); |
5050 | 5050 | init_morris_charts(); |
5051 | 5051 | init_skycons(); | ... | ... |
1 | +/** @preserve jQuery animateNumber plugin v0.0.14 | |
2 | + * (c) 2013, Alexandr Borisov. | |
3 | + * https://github.com/aishek/jquery-animateNumber | |
4 | + */ | |
5 | + | |
6 | +// ['...'] notation using to avoid names minification by Google Closure Compiler | |
7 | +(function($) { | |
8 | + var reverse = function(value) { | |
9 | + return value.split('') | |
10 | + .reverse() | |
11 | + .join(''); | |
12 | + }; | |
13 | + | |
14 | + var defaults = { | |
15 | + numberStep: function(now, tween) { | |
16 | + var floored_number = Math.floor(now), target = $(tween.elem); | |
17 | + | |
18 | + target.text(floored_number); | |
19 | + } | |
20 | + }; | |
21 | + | |
22 | + var handle = function(tween) { | |
23 | + var elem = tween.elem; | |
24 | + if (elem.nodeType && elem.parentNode) { | |
25 | + var handler = elem._animateNumberSetter; | |
26 | + if (!handler) { | |
27 | + handler = defaults.numberStep; | |
28 | + } | |
29 | + handler(tween.now, tween); | |
30 | + } | |
31 | + }; | |
32 | + | |
33 | + if (!$.Tween || !$.Tween.propHooks) { | |
34 | + $.fx.step.number = handle; | |
35 | + } else { | |
36 | + $.Tween.propHooks.number = { | |
37 | + set: handle | |
38 | + }; | |
39 | + } | |
40 | + | |
41 | + var extract_number_parts = function(separated_number, group_length) { | |
42 | + var numbers = separated_number.split('') | |
43 | + .reverse(), number_parts = [], current_number_part, current_index, q; | |
44 | + | |
45 | + for (var i = 0, l = Math.ceil(separated_number.length / group_length); i < l; i++) { | |
46 | + current_number_part = ''; | |
47 | + for (q = 0; q < group_length; q++) { | |
48 | + current_index = i * group_length + q; | |
49 | + if (current_index === separated_number.length) { | |
50 | + break; | |
51 | + } | |
52 | + | |
53 | + current_number_part = current_number_part + numbers[ current_index ]; | |
54 | + } | |
55 | + number_parts.push(current_number_part); | |
56 | + } | |
57 | + | |
58 | + return number_parts; | |
59 | + }; | |
60 | + | |
61 | + var remove_precending_zeros = function(number_parts) { | |
62 | + var last_index = number_parts.length - 1, last = reverse(number_parts[ last_index ]); | |
63 | + | |
64 | + number_parts[ last_index ] = reverse( | |
65 | + parseInt(last, 10) | |
66 | + .toString() | |
67 | + ); | |
68 | + return number_parts; | |
69 | + }; | |
70 | + | |
71 | + $.animateNumber = { | |
72 | + numberStepFactories: { | |
73 | + /** | |
74 | + * Creates numberStep handler, which appends string to floored animated number on each step. | |
75 | + * | |
76 | + * @example | |
77 | + * // will animate to 100 with "1 %", "2 %", "3 %", ... | |
78 | + * $('#someid').animateNumber({ | |
79 | + * number: 100, | |
80 | + * numberStep: $.animateNumber.numberStepFactories.append(' %') | |
81 | + * }); | |
82 | + * | |
83 | + * @params {String} suffix string to append to animated number | |
84 | + * @returns {Function} numberStep-compatible function for use in animateNumber's parameters | |
85 | + */ | |
86 | + append: function(suffix) { | |
87 | + return function(now, tween) { | |
88 | + var floored_number = Math.floor(now), target = $(tween.elem); | |
89 | + | |
90 | + target.prop('number', now) | |
91 | + .text(floored_number + suffix); | |
92 | + }; | |
93 | + }, | |
94 | + | |
95 | + /** | |
96 | + * Creates numberStep handler, which format floored numbers by separating them to groups. | |
97 | + * | |
98 | + * @example | |
99 | + * // will animate with 1 ... 217,980 ... 95,217,980 ... 7,095,217,980 | |
100 | + * $('#world-population').animateNumber({ | |
101 | + * number: 7095217980, | |
102 | + * numberStep: $.animateNumber.numberStepFactories.separator(',') | |
103 | + * }); | |
104 | + * @example | |
105 | + * // will animate with 1% ... 217,980% ... 95,217,980% ... 7,095,217,980% | |
106 | + * $('#salesIncrease').animateNumber({ | |
107 | + * number: 7095217980, | |
108 | + * numberStep: $.animateNumber.numberStepFactories.separator(',', 3, '%') | |
109 | + * }); | |
110 | + * | |
111 | + * @params {String} [separator=' '] string to separate number groups | |
112 | + * @params {String} [group_length=3] number group length | |
113 | + * @params {String} [suffix=''] suffix to append to number | |
114 | + * @returns {Function} numberStep-compatible function for use in animateNumber's parameters | |
115 | + */ | |
116 | + separator: function(separator, group_length, suffix) { | |
117 | + separator = separator || ' '; | |
118 | + group_length = group_length || 3; | |
119 | + suffix = suffix || ''; | |
120 | + | |
121 | + return function(now, tween) { | |
122 | + var negative = now < 0, floored_number = Math.floor((negative ? -1 : 1) * now), separated_number = floored_number.toString(), target = $(tween.elem); | |
123 | + | |
124 | + if (separated_number.length > group_length) { | |
125 | + var number_parts = extract_number_parts(separated_number, group_length); | |
126 | + | |
127 | + separated_number = remove_precending_zeros(number_parts) | |
128 | + .join(separator); | |
129 | + separated_number = reverse(separated_number); | |
130 | + } | |
131 | + | |
132 | + target.prop('number', now) | |
133 | + .text((negative ? '-' : '') + separated_number + suffix); | |
134 | + }; | |
135 | + } | |
136 | + } | |
137 | + }; | |
138 | + | |
139 | + $.fn.animateNumber = function() { | |
140 | + var options = arguments[ 0 ], settings = $.extend({}, defaults, options), | |
141 | + | |
142 | + target = $(this), args = [ settings ]; | |
143 | + | |
144 | + for (var i = 1, l = arguments.length; i < l; i++) { | |
145 | + args.push(arguments[ i ]); | |
146 | + } | |
147 | + | |
148 | + // needs of custom step function usage | |
149 | + if (options.numberStep) { | |
150 | + // assigns custom step functions | |
151 | + var items = this.each( | |
152 | + function() { | |
153 | + this._animateNumberSetter = options.numberStep; | |
154 | + } | |
155 | + ); | |
156 | + | |
157 | + // cleanup of custom step functions after animation | |
158 | + var generic_complete = settings.complete; | |
159 | + settings.complete = function() { | |
160 | + items.each( | |
161 | + function() { | |
162 | + delete this._animateNumberSetter; | |
163 | + } | |
164 | + ); | |
165 | + | |
166 | + if (generic_complete) { | |
167 | + generic_complete.apply(this, arguments); | |
168 | + } | |
169 | + }; | |
170 | + } | |
171 | + | |
172 | + return target.animate.apply(target, args); | |
173 | + }; | |
174 | + | |
175 | +}(jQuery)); | ... | ... |
common/config/settings.php
1 | 1 | <?php |
2 | - | |
3 | - return [ | |
4 | - 1 => [ | |
5 | - 'phone' => '', | |
6 | - 'phone2' => '', | |
7 | - 'skype' => '', | |
8 | - 'email' => '', | |
9 | - 'house' => '', | |
10 | - 'street' => '', | |
11 | - 'office' => '', | |
12 | - 'city' => '', | |
13 | - 'country' => '', | |
14 | - 'lat' => '', | |
15 | - 'lon' => '', | |
16 | - 'facebook' => '', | |
17 | - 'vk' => '', | |
18 | - 'ok' => '', | |
19 | - 'google' => '', | |
20 | - 'twitter' => '', | |
21 | - 'name' => '', | |
22 | - 'logo' => null, | |
23 | - 'about' => '', | |
24 | - 'analytics_key' => '', | |
25 | - 'robots' => '', | |
26 | - 'ga_code' => '', | |
27 | - 'ya_code' => '', | |
28 | - 'tag_manager' => '', | |
29 | - 'id' => 1, | |
30 | - ], | |
31 | - ]; | |
32 | 2 | \ No newline at end of file |
3 | + | |
4 | +return [ | |
5 | + 1 => [ | |
6 | + 'phone' => '+38 (044) 593-73-76', | |
7 | + 'phone2' => '+38 (098) 468-07-64', | |
8 | + 'skype' => 'artwebstudio', | |
9 | + 'email' => 'artweb.ua@gmail.com', | |
10 | + 'house' => '1-М', | |
11 | + 'street' => 'пр. М. Бажана', | |
12 | + 'office' => '25', | |
13 | + 'city' => 'Киев', | |
14 | + 'country' => 'Украина', | |
15 | + 'lat' => '50.403696', | |
16 | + 'lon' => '30.641481', | |
17 | + 'facebook' => 'https://www.facebook.com/ArtWeb.ua/', | |
18 | + 'vk' => 'https://vk.com/artwebua', | |
19 | + 'ok' => 'https://ok.ru/artwebua', | |
20 | + 'google' => 'https://plus.google.com/+ArtwebUaAgency', | |
21 | + 'twitter' => 'https://twitter.com/ArtWeb_ua', | |
22 | + 'name' => 'Artweb', | |
23 | + 'logo' => '11', | |
24 | + 'about' => 'Строим бизнес в онлайне', | |
25 | + 'analytics_key' => '119240817', | |
26 | + 'robots' => 'User-agent: Google | |
27 | +Disallow: | |
28 | +', | |
29 | + 'ga_code' => '796967', | |
30 | + 'ya_code' => '08908908', | |
31 | + 'tag_manager' => '', | |
32 | + 'id' => 1, | |
33 | + ], | |
34 | +]; | |
33 | 35 | \ No newline at end of file | ... | ... |
environments/dev/backend/config/main-local.php
100644 → 100755
environments/dev/backend/config/params-local.php
100644 → 100755
environments/dev/backend/config/test-local.php
100644 → 100755
environments/dev/common/config/params-local.php
100644 → 100755
environments/dev/console/config/main-local.php
100644 → 100755
environments/dev/console/config/params-local.php
100644 → 100755
environments/dev/frontend/config/main-local.php
100644 → 100755
environments/dev/frontend/config/params-local.php
100644 → 100755
environments/dev/frontend/config/test-local.php
100644 → 100755
environments/prod/backend/config/main-local.php
100644 → 100755
environments/prod/backend/config/params-local.php
100644 → 100755
environments/prod/common/config/main-local.php
100644 → 100755
environments/prod/common/config/params-local.php
100644 → 100755
environments/prod/console/config/main-local.php
100644 → 100755
environments/prod/console/config/params-local.php
100644 → 100755
environments/prod/frontend/config/main-local.php
100644 → 100755
environments/prod/frontend/config/params-local.php
100644 → 100755