@@ -1,8 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -use Ffcms\Core\Helper\Date; |
|
4 | 3 | use Ffcms\Core\Helper\HTML\Form; |
5 | -use Ffcms\Core\Helper\HTML\Table; |
|
6 | 4 | use Ffcms\Core\Helper\Url; |
7 | 5 | |
8 | 6 | /** @var \Apps\Model\Admin\Feedback\FormUpdate $model */ |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | public function actionIndex() |
33 | 33 | { |
34 | 34 | // set current page and offset |
35 | - $page = (int)App::$Request->query->get('page'); |
|
35 | + $page = (int) App::$Request->query->get('page'); |
|
36 | 36 | $offset = $page * self::ITEM_PER_PAGE; |
37 | 37 | |
38 | 38 | // get feedback posts AR table |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | |
74 | 74 | // initialize model with answer add if thread is not closed |
75 | 75 | $model = null; |
76 | - if ((int)$record->closed !== 1) { |
|
76 | + if ((int) $record->closed !== 1) { |
|
77 | 77 | $model = new FormAnswerAdd($record, App::$User->identity()->getId()); |
78 | 78 | if ($model->send()) { |
79 | 79 | if ($model->validate()) { |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | case 'answer': |
105 | 105 | $record = FeedbackAnswer::find($id); |
106 | 106 | if ($record !== null && $record !== false) { |
107 | - $postId = (int)$record->getFeedbackPost()->id; |
|
107 | + $postId = (int) $record->getFeedbackPost()->id; |
|
108 | 108 | } |
109 | 109 | break; |
110 | 110 | } |
@@ -40,12 +40,12 @@ discard block |
||
40 | 40 | { |
41 | 41 | // get configs |
42 | 42 | $configs = $this->getConfigs(); |
43 | - if (!App::$User->isAuth() && (int)$configs['guestAdd'] !== 1) { |
|
43 | + if (!App::$User->isAuth() && (int) $configs['guestAdd'] !== 1) { |
|
44 | 44 | throw new ForbiddenException(__('Feedback available only for authorized users')); |
45 | 45 | } |
46 | 46 | |
47 | 47 | // initialize model |
48 | - $model = new FormFeedbackAdd((int)$configs['useCaptcha'] === 1); |
|
48 | + $model = new FormFeedbackAdd((int) $configs['useCaptcha'] === 1); |
|
49 | 49 | if ($model->send()) { |
50 | 50 | if ($model->validate()) { |
51 | 51 | // if validation is passed save data to db and get row |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | // render output view |
62 | 62 | return App::$View->render('create', [ |
63 | 63 | 'model' => $model->export(), |
64 | - 'useCaptcha' => (int)$configs['useCaptcha'] === 1 |
|
64 | + 'useCaptcha' => (int) $configs['useCaptcha'] === 1 |
|
65 | 65 | ]); |
66 | 66 | } |
67 | 67 | |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | $userId = App::$User->isAuth() ? App::$User->identity()->getId() : 0; |
93 | 93 | $model = null; |
94 | 94 | // check if feedback post is not closed for answers |
95 | - if ((int)$recordPost->closed === 0) { |
|
95 | + if ((int) $recordPost->closed === 0) { |
|
96 | 96 | // init new answer add model |
97 | 97 | $model = new FormAnswerAdd($recordPost, $userId); |
98 | 98 | // if answer is sender lets try to make it model |
@@ -127,10 +127,10 @@ discard block |
||
127 | 127 | // check if action is submited |
128 | 128 | if (App::$Request->request->get('closeRequest', false)) { |
129 | 129 | // if created by authorized user |
130 | - if ((int)$record->user_id !== 0) { |
|
130 | + if ((int) $record->user_id !== 0) { |
|
131 | 131 | $user = App::$User->identity(); |
132 | 132 | // button is pressed not by request creator |
133 | - if ($user === null || $user->getId() !== (int)$record->user_id) { |
|
133 | + if ($user === null || $user->getId() !== (int) $record->user_id) { |
|
134 | 134 | throw new ForbiddenException(__('This feedback request was created by another user')); |
135 | 135 | } |
136 | 136 | } |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | public function actionList() |
157 | 157 | { |
158 | 158 | // set current page and offset |
159 | - $page = (int)App::$Request->query->get('page'); |
|
159 | + $page = (int) App::$Request->query->get('page'); |
|
160 | 160 | $offset = $page * self::ITEM_PER_PAGE; |
161 | 161 | |
162 | 162 | // check if user is authorized or throw exception |
@@ -34,8 +34,8 @@ discard block |
||
34 | 34 | } |
35 | 35 | |
36 | 36 | /** |
37 | - * Labels to display edit form |
|
38 | - */ |
|
37 | + * Labels to display edit form |
|
38 | + */ |
|
39 | 39 | public function labels() |
40 | 40 | { |
41 | 41 | return [ |
@@ -46,8 +46,8 @@ discard block |
||
46 | 46 | } |
47 | 47 | |
48 | 48 | /** |
49 | - * Rules to validate changes |
|
50 | - */ |
|
49 | + * Rules to validate changes |
|
50 | + */ |
|
51 | 51 | public function rules() |
52 | 52 | { |
53 | 53 | return [ |
@@ -47,8 +47,8 @@ discard block |
||
47 | 47 | } |
48 | 48 | |
49 | 49 | /** |
50 | - * Labels for display form |
|
51 | - */ |
|
50 | + * Labels for display form |
|
51 | + */ |
|
52 | 52 | public function labels() |
53 | 53 | { |
54 | 54 | return [ |
@@ -59,8 +59,8 @@ discard block |
||
59 | 59 | } |
60 | 60 | |
61 | 61 | /** |
62 | - * Form validation rules |
|
63 | - */ |
|
62 | + * Form validation rules |
|
63 | + */ |
|
64 | 64 | public function rules() |
65 | 65 | { |
66 | 66 | return [ |
@@ -29,7 +29,7 @@ |
||
29 | 29 | public function __construct($recordPost, $userId = 0) |
30 | 30 | { |
31 | 31 | $this->_post = $recordPost; |
32 | - $this->_userId = (int)$userId; |
|
32 | + $this->_userId = (int) $userId; |
|
33 | 33 | parent::__construct(); |
34 | 34 | } |
35 | 35 |
@@ -26,8 +26,8 @@ discard block |
||
26 | 26 | |
27 | 27 | |
28 | 28 | /** |
29 | - * Set user data if he is logged in |
|
30 | - */ |
|
29 | + * Set user data if he is logged in |
|
30 | + */ |
|
31 | 31 | public function before() |
32 | 32 | { |
33 | 33 | if (App::$User->isAuth()) { |
@@ -38,8 +38,8 @@ discard block |
||
38 | 38 | } |
39 | 39 | |
40 | 40 | /** |
41 | - * Labels to display form |
|
42 | - */ |
|
41 | + * Labels to display form |
|
42 | + */ |
|
43 | 43 | public function labels() |
44 | 44 | { |
45 | 45 | return [ |
@@ -51,8 +51,8 @@ discard block |
||
51 | 51 | } |
52 | 52 | |
53 | 53 | /** |
54 | - * Rules to validate send form |
|
55 | - */ |
|
54 | + * Rules to validate send form |
|
55 | + */ |
|
56 | 56 | public function rules() |
57 | 57 | { |
58 | 58 | $rules = [ |
@@ -20,7 +20,7 @@ |
||
20 | 20 | |
21 | 21 | public function __construct($captcha = true) |
22 | 22 | { |
23 | - $this->_useCaptcha = (bool)$captcha; |
|
23 | + $this->_useCaptcha = (bool) $captcha; |
|
24 | 24 | parent::__construct(); |
25 | 25 | } |
26 | 26 |
@@ -9,4 +9,4 @@ |
||
9 | 9 | ['type' => 'link', 'text' => __('Group management'), 'link' => ['user/grouplist']], |
10 | 10 | ['type' => 'link', 'text' => __('Settings'), 'link' => ['user/settings']] |
11 | 11 | ] |
12 | -]);?> |
|
13 | 12 | \ No newline at end of file |
13 | +]); ?> |
|
14 | 14 | \ No newline at end of file |
@@ -31,14 +31,13 @@ |
||
31 | 31 | foreach ($records as $item) { |
32 | 32 | /** @var \Apps\ActiveRecord\FeedbackPost $item*/ |
33 | 33 | $items[] = [ |
34 | - ['text' => $item->id . ((int)$item->readed !== 1 ? ' <i class="fa fa-bell alert-info"></i>' : null), 'html' => true], |
|
34 | + ['text' => $item->id . ((int) $item->readed !== 1 ? ' <i class="fa fa-bell alert-info"></i>' : null), 'html' => true], |
|
35 | 35 | ['text' => Url::link(['feedback/read', $item->id], Text::snippet($item->message, 40, false)), 'html' => true], |
36 | 36 | ['text' => $item->getAnswers()->count()], |
37 | 37 | ['text' => $item->email], |
38 | 38 | ['text' => |
39 | - (int)$item->closed === 1 ? |
|
40 | - '<span class="label label-danger">' . __('Closed') . '</span>' : |
|
41 | - '<span class="label label-success">' . __('Opened') . '</span>', |
|
39 | + (int) $item->closed === 1 ? |
|
40 | + '<span class="label label-danger">' . __('Closed') . '</span>' : '<span class="label label-success">' . __('Opened') . '</span>', |
|
42 | 41 | 'html' => true, '!secure' => true], |
43 | 42 | ['text' => Date::convertToDatetime($item->updated_at, Date::FORMAT_TO_HOUR)], |
44 | 43 | ['text' => Url::link(['feedback/read', $item->id], '<i class="fa fa-list fa-lg"></i> ') . |
@@ -28,13 +28,13 @@ discard block |
||
28 | 28 | <div class="panel panel-info"> |
29 | 29 | <div class="panel-heading"> |
30 | 30 | <?php |
31 | - if ((int)$record->readed !== 1) { |
|
31 | + if ((int) $record->readed !== 1) { |
|
32 | 32 | echo '<i class="fa fa-bell"></i> '; |
33 | 33 | } |
34 | 34 | ?> |
35 | 35 | <?= __('Message sent') ?>: <?= Date::convertToDatetime($record->created_at, Date::FORMAT_TO_HOUR) ?>. |
36 | 36 | <?php |
37 | - if ((int)$record->closed !== 1) { |
|
37 | + if ((int) $record->closed !== 1) { |
|
38 | 38 | echo '<span class="label label-success">' . __('Opened') . '</span>'; |
39 | 39 | } else { |
40 | 40 | echo '<span class="label label-danger">' . __('Closed') . '</span>'; |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | </div> |
44 | 44 | <div class="panel-body"> |
45 | 45 | <?php |
46 | - if ((int)$record->closed !== 0) { |
|
46 | + if ((int) $record->closed !== 0) { |
|
47 | 47 | echo '<p class="alert alert-warning">' . __('The feedback request is closed! Thread in only-read mode') . '.</p>'; |
48 | 48 | } |
49 | 49 | ?> |
@@ -51,12 +51,12 @@ discard block |
||
51 | 51 | <hr /> |
52 | 52 | <?php |
53 | 53 | // show "mark as read" button if message is not readed |
54 | - if ((int)$record->readed !== 1) { |
|
54 | + if ((int) $record->readed !== 1) { |
|
55 | 55 | echo Url::link(['feedback/turn', 'read', $record->id], __('Mark as read'), ['class' => 'label label-success']) . ' '; |
56 | 56 | } |
57 | 57 | |
58 | 58 | // show close/open button depend of current status |
59 | - if ((int)$record->closed === 0) { |
|
59 | + if ((int) $record->closed === 0) { |
|
60 | 60 | echo Url::link(['feedback/turn', 'close', $record->id], __('Close'), ['class' => 'label label-warning']) . ' '; |
61 | 61 | } else { |
62 | 62 | echo Url::link(['feedback/turn', 'open', $record->id], __('Open'), ['class' => 'label label-info']) . ' '; |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | <div class="panel-body"> |
77 | 77 | <?php |
78 | 78 | $uInfo = 'no'; |
79 | - if ((int)$record->user_id > 0) { |
|
79 | + if ((int) $record->user_id > 0) { |
|
80 | 80 | $user = \App::$User->identity($record->user_id); |
81 | 81 | if ($user !== null && $user->getId() > 0) { |
82 | 82 | $uInfo = Url::link(['user/update', $user->getId()], $user->getProfile()->nick); |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | |
102 | 102 | <?php if ($record->getAnswers()->count() > 0): ?> |
103 | 103 | <?php foreach ($record->getAnswers()->get() as $answer): ?> |
104 | - <div class="panel <?= (int)$answer->is_admin === 1 ? 'panel-success' : 'panel-default' ?>"> |
|
104 | + <div class="panel <?= (int) $answer->is_admin === 1 ? 'panel-success' : 'panel-default' ?>"> |
|
105 | 105 | <div class="panel-heading"> |
106 | 106 | <?= __('From') ?>: <?= $answer->name . '(' . $answer->email . ')' ?>, |
107 | 107 | <?= Date::convertToDatetime($answer->created_at, Date::FORMAT_TO_HOUR) ?> |