Issues (1256)

views/admin/feedback/index.php (6 issues)

1
<?php
2
3
use yii\helpers\{Url, Html};
4
use yii\grid\GridView;
5
use yii\widgets\{LinkPager, ActiveForm};
6
use app\models\FeedbackSearch;
7
8
/* @var $searchModel FeedbackSearch */
9
/* @var $dataProvider yii\data\ActiveDataProvider */
10
/* @var $this Itstructure\AdminModule\components\AdminView */
11
12
$this->title = Yii::t('feedback', 'Feedback');
13
$this->params['breadcrumbs'][] = $this->title;
14
?>
15
<div class="feedback-index">
16
17
    <?php  echo $this->render('_search', ['model' => $searchModel]); ?>
18
19
    <?php echo LinkPager::widget(['pagination' => $dataProvider->getPagination()]) ?>
20
21
    <?php $form = ActiveForm::begin([
22
        'action' => [
23
            $this->params['urlPrefix'].'delete-selected'
24
        ],
25
        'method' => 'post',
26
    ]); ?>
27
28
        <?php echo GridView::widget([
29
            'dataProvider' => $dataProvider,
30
            //'filterModel' => $searchModel,
31
            'columns' => [
32
33
                'id',
34
                'name' => [
35
                    'label' => Yii::t('feedback', 'Name'),
36
                    'value' => function($searchModel) {
37
                        /* @var $searchModel FeedbackSearch */
38
                        return $searchModel->name;
39
                    },
40
                ],
41
                'email' => [
42
                    'label' => Yii::t('feedback', 'Email'),
43
                    'value' => function($searchModel) {
44
                        /* @var $searchModel FeedbackSearch */
45
                        return $searchModel->email;
46
                    },
47
                ],
48
                'phone' => [
49
                    'label' => Yii::t('feedback', 'Phone'),
50
                    'value' => function($searchModel) {
51
                        /* @var $searchModel FeedbackSearch */
52
                        return $searchModel->phone;
53
                    },
54
                ],
55
                'subject' => [
56
                    'label' => Yii::t('feedback', 'Subject'),
57
                    'value' => function($searchModel) {
58
                        /* @var $searchModel FeedbackSearch */
59
                        return $searchModel->subject;
60
                    },
61
                ],
62
                [
63
                    'attribute' => 'created_at',
64
                    'format' =>  ['date', 'dd.MM.Y HH:mm:ss'],
65
                    'label' => Yii::t('app', 'Created date'),
66
                ],
67
                [
68
                    'attribute' => 'updated_at',
69
                    'format' =>  ['date', 'dd.MM.Y HH:mm:ss'],
70
                    'label' => Yii::t('app', 'Updated date'),
71
                ],
72
                'read' => [
73
                    'label' => Yii::t('feedback', 'Read status'),
74
                    'value' => function($searchModel) {
75
                        /* @var $searchModel FeedbackSearch */
76
                        return $searchModel->read === 1 ?
77
                            '<i class="fa fa-check-circle text-success"> ' . Yii::t('feedback', 'Read') . '</i>' :
78
                            '<i class="text-danger">' . Yii::t('feedback', 'New') . '</i>';
79
                    },
80
                    'format' => 'raw',
81
                ],
82
                [
83
                    'class' => 'yii\grid\ActionColumn',
84
                    'header' => Yii::t('app', 'Actions'),
85
                    'template' => '{view} {delete}',
86
                    'urlCreator'=>function($action, $model, $key, $index){
0 ignored issues
show
The parameter $key is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

86
                    'urlCreator'=>function($action, $model, /** @scrutinizer ignore-unused */ $key, $index){

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
The parameter $index is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

86
                    'urlCreator'=>function($action, $model, $key, /** @scrutinizer ignore-unused */ $index){

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
87
                        return Url::to([
88
                            $this->params['urlPrefix'].$action,
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable $this seems to be never defined.
Loading history...
89
                            'id' => $model->id
90
                        ]);
91
                    }
92
                ],
93
                [
94
                    'class' => 'yii\grid\CheckboxColumn',
95
                    'header' => Yii::t('app', 'Delete'),
96
                    'multiple' => true,
97
                    'name' => Html::getInputName($searchModel, 'delete_items'),
98
                    'checkboxOptions' => function ($searchModel, $key, $index, $column) use ($form) {
0 ignored issues
show
The parameter $key is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

98
                    'checkboxOptions' => function ($searchModel, /** @scrutinizer ignore-unused */ $key, $index, $column) use ($form) {

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
The parameter $column is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

98
                    'checkboxOptions' => function ($searchModel, $key, $index, /** @scrutinizer ignore-unused */ $column) use ($form) {

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
The parameter $index is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

98
                    'checkboxOptions' => function ($searchModel, $key, /** @scrutinizer ignore-unused */ $index, $column) use ($form) {

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
99
                        return ['form' => $form->id, 'value' => $searchModel->id];
100
                    }
101
                ],
102
            ],
103
        ]); ?>
104
105
    <?php if ($dataProvider->count > 0): ?>
106
        <div class="form-group">
107
            <?php echo Html::submitButton(Yii::t('app', 'Delete selected'), ['class' => 'btn btn-primary']) ?>
108
        </div>
109
    <?php endif; ?>
110
111
    <?php ActiveForm::end(); ?>
112
</div>
113