Issues (1256)

views/admin/technologies/index.php (5 issues)

1
<?php
2
3
use yii\grid\GridView;
4
use yii\helpers\{Url, Html};
5
use app\models\TechnologySearch;
6
7
/* @var $searchModel TechnologySearch */
8
/* @var $dataProvider yii\data\ActiveDataProvider */
9
/* @var $this Itstructure\AdminModule\components\AdminView */
10
11
$this->title = Yii::t('technologies', 'Technologies');
12
$this->params['breadcrumbs'][] = $this->title;
13
?>
14
<div class="technologies-index">
15
16
    <?php  //echo $this->render('_search', ['model' => $searchModel]); ?>
17
18
    <p>
19
        <?php echo Html::a(Yii::t('technologies', 'Create technology'), [
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
            'icon' => [
33
                'label' => Yii::t('app', 'Icon'),
34
                'value' => function($searchModel) {
35
                    /* @var $searchModel TechnologySearch */
36
                    return Html::a(
37
                        Html::tag('i', '', ['class' => empty($searchModel->icon) ? 'fa fa-file fa-2x' : $searchModel->icon]),
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
            'name' => [
44
                'label' => Yii::t('technologies', 'Name'),
45
                'value' => function($searchModel) {
46
                    /* @var $searchModel TechnologySearch */
47
                    return Html::a(
48
                        Html::encode($searchModel->name),
49
                        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...
50
                    );
51
                },
52
                'format' => 'raw',
53
            ],
54
            [
55
                'attribute' => 'share',
56
                'label' => Yii::t('technologies', 'Share'),
57
            ],
58
            'about' => [
59
                'label' => Yii::t('technologies', 'Parent about records'),
60
                'value' => function ($searchModel) {
61
                    /* @var $searchModel TechnologySearch */
62
                    $aboutRecords = '';
63
                    foreach ($searchModel->about as $aboutRecord) {
64
                        $aboutRecords .= Html::tag('li',
65
                            Html::a($aboutRecord->title,
66
                                Url::to(['/admin/about/view', 'id' => $aboutRecord->id]),
67
                                [
68
                                    'target' => '_blank'
69
                                ]
70
                            )
71
                        );
72
                    }
73
74
                    return empty($aboutRecords) ? '' : Html::tag('ul', $aboutRecords, [
75
                        'style' => 'margin-left: 10px; padding-left: 10px;'
76
                    ]);
77
                },
78
                'format' => 'raw',
79
            ],
80
            [
81
                'attribute' => 'created_at',
82
                'format' =>  ['date', 'dd.MM.Y HH:mm:ss'],
83
                'label' => Yii::t('app', 'Created date'),
84
            ],
85
            [
86
                'attribute' => 'updated_at',
87
                'format' =>  ['date', 'dd.MM.Y HH:mm:ss'],
88
                'label' => Yii::t('app', 'Updated date'),
89
            ],
90
            [
91
                'class' => 'yii\grid\ActionColumn',
92
                'header' => Yii::t('app', 'Actions'),
93
                'template' => '{view} {update} {delete}',
94
                '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

94
                '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

94
                '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...
95
                    return Url::to([
96
                        $this->params['urlPrefix'].$action,
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable $this seems to be never defined.
Loading history...
97
                        'id' => $model->id
98
                    ]);
99
                }
100
            ],
101
        ],
102
    ]); ?>
103
</div>
104