@@ -20,7 +20,7 @@ |
||
20 | 20 | { |
21 | 21 | use _generated\WebGuyActions; |
22 | 22 | |
23 | - /** |
|
24 | - * Define custom actions here |
|
25 | - */ |
|
23 | + /** |
|
24 | + * Define custom actions here |
|
25 | + */ |
|
26 | 26 | } |
@@ -20,7 +20,7 @@ |
||
20 | 20 | { |
21 | 21 | use _generated\WebGuyActions; |
22 | 22 | |
23 | - /** |
|
24 | - * Define custom actions here |
|
25 | - */ |
|
23 | + /** |
|
24 | + * Define custom actions here |
|
25 | + */ |
|
26 | 26 | } |
@@ -20,7 +20,7 @@ |
||
20 | 20 | { |
21 | 21 | use _generated\WebGuyActions; |
22 | 22 | |
23 | - /** |
|
24 | - * Define custom actions here |
|
25 | - */ |
|
23 | + /** |
|
24 | + * Define custom actions here |
|
25 | + */ |
|
26 | 26 | } |
@@ -20,7 +20,7 @@ |
||
20 | 20 | { |
21 | 21 | use _generated\WebGuyActions; |
22 | 22 | |
23 | - /** |
|
24 | - * Define custom actions here |
|
25 | - */ |
|
23 | + /** |
|
24 | + * Define custom actions here |
|
25 | + */ |
|
26 | 26 | } |
@@ -20,7 +20,7 @@ |
||
20 | 20 | { |
21 | 21 | use _generated\WebGuyActions; |
22 | 22 | |
23 | - /** |
|
24 | - * Define custom actions here |
|
25 | - */ |
|
23 | + /** |
|
24 | + * Define custom actions here |
|
25 | + */ |
|
26 | 26 | } |
@@ -72,7 +72,7 @@ |
||
72 | 72 | |
73 | 73 | // render view |
74 | 74 | return App::$View->render($this->tpl, [ |
75 | - 'records' => $query |
|
75 | + 'records' => $query |
|
76 | 76 | ]); |
77 | 77 | } |
78 | 78 |
@@ -25,8 +25,8 @@ discard block |
||
25 | 25 | } |
26 | 26 | |
27 | 27 | /** |
28 | - * Set default values from configs |
|
29 | - */ |
|
28 | + * Set default values from configs |
|
29 | + */ |
|
30 | 30 | public function before() |
31 | 31 | { |
32 | 32 | $this->categories = Serialize::decode($this->_configs['categories']); |
@@ -35,8 +35,8 @@ discard block |
||
35 | 35 | } |
36 | 36 | |
37 | 37 | /** |
38 | - * Labels for form |
|
39 | - */ |
|
38 | + * Labels for form |
|
39 | + */ |
|
40 | 40 | public function labels() |
41 | 41 | { |
42 | 42 | return [ |
@@ -47,8 +47,8 @@ discard block |
||
47 | 47 | } |
48 | 48 | |
49 | 49 | /** |
50 | - * Validation rules |
|
51 | - */ |
|
50 | + * Validation rules |
|
51 | + */ |
|
52 | 52 | public function rules() |
53 | 53 | { |
54 | 54 | return [ |
@@ -10,12 +10,12 @@ discard block |
||
10 | 10 | |
11 | 11 | class Contenttag extends AbstractWidget |
12 | 12 | { |
13 | - use OopTools; |
|
13 | + use OopTools; |
|
14 | 14 | |
15 | - public $count; |
|
16 | - public $cache; |
|
15 | + public $count; |
|
16 | + public $cache; |
|
17 | 17 | |
18 | - public $tpl = 'widgets/contenttag/default'; |
|
18 | + public $tpl = 'widgets/contenttag/default'; |
|
19 | 19 | |
20 | 20 | public function init() |
21 | 21 | { |
@@ -33,39 +33,39 @@ discard block |
||
33 | 33 | public function display() |
34 | 34 | { |
35 | 35 | // get special properties hash |
36 | - $classHash = $this->createStringClassSnapshotHash(); |
|
36 | + $classHash = $this->createStringClassSnapshotHash(); |
|
37 | 37 | |
38 | - // get records rows from cache or directly from db |
|
39 | - $records = null; |
|
40 | - if ($this->cache === 0) { |
|
41 | - $records = $this->makeQuery(); |
|
42 | - } else { |
|
43 | - $records === App::$Cache->get('widget.contenttag.' . $classHash); |
|
44 | - if ($records === null) { |
|
45 | - $records = $this->makeQuery(); |
|
46 | - App::$Cache->set('widget.contenttag' . $classHash, $records, $this->cache); |
|
47 | - } |
|
48 | - } |
|
38 | + // get records rows from cache or directly from db |
|
39 | + $records = null; |
|
40 | + if ($this->cache === 0) { |
|
41 | + $records = $this->makeQuery(); |
|
42 | + } else { |
|
43 | + $records === App::$Cache->get('widget.contenttag.' . $classHash); |
|
44 | + if ($records === null) { |
|
45 | + $records = $this->makeQuery(); |
|
46 | + App::$Cache->set('widget.contenttag' . $classHash, $records, $this->cache); |
|
47 | + } |
|
48 | + } |
|
49 | 49 | |
50 | - // check if result is not empty |
|
50 | + // check if result is not empty |
|
51 | 51 | if ($records === null || $records->count() < 1) { |
52 | 52 | return __('Content tags is not found'); |
53 | 53 | } |
54 | 54 | |
55 | 55 | // render view |
56 | - return App::$View->render($this->tpl, [ |
|
57 | - 'records' => $records |
|
58 | - ]); |
|
56 | + return App::$View->render($this->tpl, [ |
|
57 | + 'records' => $records |
|
58 | + ]); |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | private function makeQuery() |
62 | 62 | { |
63 | 63 | return TagRecord::select([ |
64 | - App::$Database->getConnection()->raw('SQL_CALC_FOUND_ROWS tag'), |
|
65 | - App::$Database->getConnection()->raw('COUNT(*) AS count') |
|
66 | - ])->groupBy('tag') |
|
67 | - ->orderBy('count', 'DESC') |
|
68 | - ->take($this->count) |
|
69 | - ->get(); |
|
64 | + App::$Database->getConnection()->raw('SQL_CALC_FOUND_ROWS tag'), |
|
65 | + App::$Database->getConnection()->raw('COUNT(*) AS count') |
|
66 | + ])->groupBy('tag') |
|
67 | + ->orderBy('count', 'DESC') |
|
68 | + ->take($this->count) |
|
69 | + ->get(); |
|
70 | 70 | } |
71 | 71 | } |
72 | 72 | \ No newline at end of file |
@@ -29,7 +29,7 @@ |
||
29 | 29 | |
30 | 30 | // render view output |
31 | 31 | return App::$View->render('index', [ |
32 | - 'model' => $model |
|
32 | + 'model' => $model |
|
33 | 33 | ]); |
34 | 34 | } |
35 | 35 | } |
36 | 36 | \ No newline at end of file |