@@ -1,7 +1,7 @@ |
||
1 | 1 | <?php return [ |
2 | - 'Alias' => [ |
|
3 | - 'Front' => [ |
|
4 | - '/' => '/content/list/news' |
|
5 | - ] |
|
6 | - ] |
|
2 | + 'Alias' => [ |
|
3 | + 'Front' => [ |
|
4 | + '/' => '/content/list/news' |
|
5 | + ] |
|
6 | + ] |
|
7 | 7 | ]; |
8 | 8 | \ No newline at end of file |
@@ -22,8 +22,8 @@ discard block |
||
22 | 22 | public $captcha; |
23 | 23 | |
24 | 24 | /** |
25 | - * Labels for visual display |
|
26 | - */ |
|
25 | + * Labels for visual display |
|
26 | + */ |
|
27 | 27 | public function labels() |
28 | 28 | { |
29 | 29 | return [ |
@@ -33,8 +33,8 @@ discard block |
||
33 | 33 | } |
34 | 34 | |
35 | 35 | /** |
36 | - * Validation rules |
|
37 | - */ |
|
36 | + * Validation rules |
|
37 | + */ |
|
38 | 38 | public function rules() |
39 | 39 | { |
40 | 40 | return [ |
@@ -38,8 +38,8 @@ discard block |
||
38 | 38 | } |
39 | 39 | |
40 | 40 | /** |
41 | - * Set default data |
|
42 | - */ |
|
41 | + * Set default data |
|
42 | + */ |
|
43 | 43 | public function before() |
44 | 44 | { |
45 | 45 | $profile = $this->_user->getProfile()->toArray(); // object to array (property's is protected of access) |
@@ -60,8 +60,8 @@ discard block |
||
60 | 60 | } |
61 | 61 | |
62 | 62 | /** |
63 | - * Form display labels |
|
64 | - */ |
|
63 | + * Form display labels |
|
64 | + */ |
|
65 | 65 | public function labels() |
66 | 66 | { |
67 | 67 | $labels = [ |
@@ -83,8 +83,8 @@ discard block |
||
83 | 83 | } |
84 | 84 | |
85 | 85 | /** |
86 | - * Rules for validation |
|
87 | - */ |
|
86 | + * Rules for validation |
|
87 | + */ |
|
88 | 88 | public function rules() |
89 | 89 | { |
90 | 90 | $rules = [ |
@@ -21,8 +21,8 @@ |
||
21 | 21 | |
22 | 22 | |
23 | 23 | /** |
24 | - * Load default properties into the model |
|
25 | - */ |
|
24 | + * Load default properties into the model |
|
25 | + */ |
|
26 | 26 | public function before() |
27 | 27 | { |
28 | 28 | $this->cfg = App::$Properties->getAll('Routing'); |
@@ -36,8 +36,8 @@ discard block |
||
36 | 36 | public $trustedProxy; |
37 | 37 | |
38 | 38 | /** |
39 | - * Set property values from configurations |
|
40 | - */ |
|
39 | + * Set property values from configurations |
|
40 | + */ |
|
41 | 41 | public function before() |
42 | 42 | { |
43 | 43 | // set default values |
@@ -49,8 +49,8 @@ discard block |
||
49 | 49 | } |
50 | 50 | |
51 | 51 | /** |
52 | - * Set translation helpers |
|
53 | - */ |
|
52 | + * Set translation helpers |
|
53 | + */ |
|
54 | 54 | public function labels() |
55 | 55 | { |
56 | 56 | return [ |
@@ -39,8 +39,8 @@ |
||
39 | 39 | } |
40 | 40 | |
41 | 41 | /** |
42 | - * Load user data on before method |
|
43 | - */ |
|
42 | + * Load user data on before method |
|
43 | + */ |
|
44 | 44 | public function before() |
45 | 45 | { |
46 | 46 | foreach ($this->getAllProperties() as $property => $old_data) { |
@@ -31,8 +31,8 @@ discard block |
||
31 | 31 | } |
32 | 32 | |
33 | 33 | /** |
34 | - * Parse public attribute values from input object data |
|
35 | - */ |
|
34 | + * Parse public attribute values from input object data |
|
35 | + */ |
|
36 | 36 | public function before() |
37 | 37 | { |
38 | 38 | $this->name = $this->_role->name; |
@@ -42,9 +42,9 @@ discard block |
||
42 | 42 | } |
43 | 43 | |
44 | 44 | /** |
45 | - * Display labels data |
|
45 | + * Display labels data |
|
46 | 46 | * @return array |
47 | - */ |
|
47 | + */ |
|
48 | 48 | public function labels() |
49 | 49 | { |
50 | 50 | return [ |
@@ -10,18 +10,18 @@ discard block |
||
10 | 10 | |
11 | 11 | class Contenttag extends AbstractWidget |
12 | 12 | { |
13 | - use ClassTools; |
|
13 | + use ClassTools; |
|
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 | - /** |
|
21 | - * Set default configurations if not defined |
|
22 | - * {@inheritDoc} |
|
23 | - * @see \Ffcms\Core\Arch\Widget::init() |
|
24 | - */ |
|
20 | + /** |
|
21 | + * Set default configurations if not defined |
|
22 | + * {@inheritDoc} |
|
23 | + * @see \Ffcms\Core\Arch\Widget::init() |
|
24 | + */ |
|
25 | 25 | public function init() |
26 | 26 | { |
27 | 27 | $cfg = $this->getConfigs(); |
@@ -43,29 +43,29 @@ discard block |
||
43 | 43 | public function display() |
44 | 44 | { |
45 | 45 | // get special properties hash |
46 | - $classHash = $this->createStringClassSnapshotHash(); |
|
46 | + $classHash = $this->createStringClassSnapshotHash(); |
|
47 | 47 | |
48 | - // get records rows from cache or directly from db |
|
49 | - $records = null; |
|
50 | - if ($this->cache === 0) { |
|
51 | - $records = $this->makeQuery(); |
|
52 | - } else { |
|
53 | - $records = App::$Cache->get('widget.contenttag.' . $classHash); |
|
54 | - if ($records === null) { |
|
55 | - $records = $this->makeQuery(); |
|
56 | - App::$Cache->set('widget.contenttag' . $classHash, $records, $this->cache); |
|
57 | - } |
|
58 | - } |
|
48 | + // get records rows from cache or directly from db |
|
49 | + $records = null; |
|
50 | + if ($this->cache === 0) { |
|
51 | + $records = $this->makeQuery(); |
|
52 | + } else { |
|
53 | + $records = App::$Cache->get('widget.contenttag.' . $classHash); |
|
54 | + if ($records === null) { |
|
55 | + $records = $this->makeQuery(); |
|
56 | + App::$Cache->set('widget.contenttag' . $classHash, $records, $this->cache); |
|
57 | + } |
|
58 | + } |
|
59 | 59 | |
60 | - // check if result is not empty |
|
60 | + // check if result is not empty |
|
61 | 61 | if ($records === null || $records->count() < 1) { |
62 | 62 | return __('Content tags is not found'); |
63 | 63 | } |
64 | 64 | |
65 | 65 | // render view |
66 | - return App::$View->render($this->tpl, [ |
|
67 | - 'records' => $records |
|
68 | - ]); |
|
66 | + return App::$View->render($this->tpl, [ |
|
67 | + 'records' => $records |
|
68 | + ]); |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | /** |
@@ -75,11 +75,11 @@ discard block |
||
75 | 75 | private function makeQuery() |
76 | 76 | { |
77 | 77 | return TagRecord::select([ |
78 | - App::$Database->getConnection()->raw('SQL_CALC_FOUND_ROWS tag'), |
|
79 | - App::$Database->getConnection()->raw('COUNT(*) AS count') |
|
80 | - ])->groupBy('tag') |
|
81 | - ->orderBy('count', 'DESC') |
|
82 | - ->take($this->count) |
|
83 | - ->get(); |
|
78 | + App::$Database->getConnection()->raw('SQL_CALC_FOUND_ROWS tag'), |
|
79 | + App::$Database->getConnection()->raw('COUNT(*) AS count') |
|
80 | + ])->groupBy('tag') |
|
81 | + ->orderBy('count', 'DESC') |
|
82 | + ->take($this->count) |
|
83 | + ->get(); |
|
84 | 84 | } |
85 | 85 | } |
86 | 86 | \ No newline at end of file |