Issues (1256)

views/admin/positions/index.php (4 issues)

1
<?php
2
3
use yii\grid\GridView;
4
use yii\helpers\{Url, Html};
5
use app\models\PositionSearch;
6
7
/* @var $searchModel PositionSearch */
8
/* @var $dataProvider yii\data\ActiveDataProvider */
9
/* @var $this Itstructure\AdminModule\components\AdminView */
10
11
$this->title = Yii::t('positions', 'Positions');
12
$this->params['breadcrumbs'][] = $this->title;
13
?>
14
<div class="positions-index">
15
16
    <?php  //echo $this->render('_search', ['model' => $searchModel]); ?>
17
18
    <p>
19
        <?php echo Html::a(Yii::t('positions', 'Create position'), [
20
            $this->params['urlPrefix'].'create'
21
        ], [
22
            'class' => 'btn btn-success'
23
        ]) ?>
24
    </p>
25
26
    <?php echo GridView::widget([
27
        'dataProvider' => $dataProvider,
28
        //'filterModel' => $searchModel,
29
        'columns' => [
30
31
            'id',
32
            'name' => [
33
                'label' => Yii::t('positions', 'Name'),
34
                'value' => function($searchModel) {
35
                    /* @var $searchModel PositionSearch */
36
                    return Html::a(
37
                        Html::encode($searchModel->name),
38
                        Url::to([$this->params['urlPrefix'].'view', 'id' => $searchModel->id])
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable $this seems to be never defined.
Loading history...
39
                    );
40
                },
41
                'format' => 'raw',
42
            ],
43
            [
44
                'attribute' => 'created_at',
45
                'format' =>  ['date', 'dd.MM.Y HH:mm:ss'],
46
                'label' => Yii::t('app', 'Created date'),
47
            ],
48
            [
49
                'attribute' => 'updated_at',
50
                'format' =>  ['date', 'dd.MM.Y HH:mm:ss'],
51
                'label' => Yii::t('app', 'Updated date'),
52
            ],
53
            [
54
                'class' => 'yii\grid\ActionColumn',
55
                'header' => Yii::t('app', 'Actions'),
56
                'template' => '{view} {update} {delete}',
57
                'urlCreator'=>function($action, $model, $key, $index){
0 ignored issues
show
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

57
                '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...
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

57
                '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...
58
                    return Url::to([
59
                        $this->params['urlPrefix'].$action,
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable $this seems to be never defined.
Loading history...
60
                        'id' => $model->id
61
                    ]);
62
                }
63
            ],
64
        ],
65
    ]); ?>
66
</div>
67