Issues (213)

src/views/hub/index.php (1 issue)

1
<?php
2
/**
3
 * @var \yii\web\View $this
4
 * @var \hipanel\modules\server\models\HubSearch $model
5
 * @var \hipanel\models\IndexPageUiOptions $uiModel
6
 * @var \hipanel\modules\server\grid\HubRepresentations $representationCollection
7
 * @var \yii\data\ActiveDataProvider $dataProvider
8
 * @var array $types
9
 */
10
use hipanel\modules\server\grid\HubGridLegend;
11
use hipanel\modules\server\grid\HubGridView;
12
use hipanel\widgets\AjaxModal;
13
use hipanel\widgets\gridLegend\GridLegend;
14
use hipanel\widgets\IndexPage;
15
use hipanel\widgets\Pjax;
16
use yii\bootstrap\Modal;
17
use yii\helpers\Html;
18
use yii\helpers\Url;
19
20
$this->title = Yii::t('hipanel:server', 'Switches');
21
$this->params['breadcrumbs'][] = $this->title;
22
$subtitle = array_filter(Yii::$app->request->get($model->formName(), [])) ? Yii::t('hipanel', 'filtered list') : Yii::t('hipanel', 'full list');
23
$this->registerCss('
24
    .sale-flex-cnt {
25
        display: flex;
26
        flex-direction: row;
27
        justify-content: space-between;
28
        flex-wrap: wrap;
29
    }
30
');
31
32
?>
33
34
<?php Pjax::begin(array_merge(Yii::$app->params['pjax'], ['enablePushState' => true])) ?>
35
    <?php $page = IndexPage::begin(compact('model', 'dataProvider')) ?>
36
37
        <?php $page->setSearchFormData(['types' => $types]) ?>
38
39
        <?php $page->beginContent('main-actions') ?>
40
            <?php if (Yii::$app->user->can('hub.create')) : ?>
0 ignored issues
show
The method can() does not exist on null. ( Ignorable by Annotation )

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

40
            <?php if (Yii::$app->user->/** @scrutinizer ignore-call */ can('hub.create')) : ?>

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
41
                <?= Html::a(Yii::t('hipanel:server:hub', 'Create switch'), ['@hub/create'], ['class' => 'btn btn-sm btn-success']) ?>
42
            <?php endif; ?>
43
        <?php $page->endContent() ?>
44
45
        <?php $page->beginContent('legend') ?>
46
            <?= GridLegend::widget(['legendItem' => new HubGridLegend($model)]) ?>
47
        <?php $page->endContent() ?>
48
49
        <?php $page->beginContent('sorter-actions') ?>
50
            <?= $page->renderSorter(['attributes' => ['id']]) ?>
51
        <?php $page->endContent() ?>
52
53
        <?php $page->beginContent('representation-actions') ?>
54
            <?= $page->renderRepresentations($representationCollection) ?>
55
        <?php $page->endContent() ?>
56
57
        <?php $page->beginContent('bulk-actions') ?>
58
            <?php if (Yii::$app->user->can('hub.sell')) : ?>
59
                <?= AjaxModal::widget([
60
                    'bulkPage' => true,
61
                    'id' => 'hubs-sell',
62
                    'scenario' => 'sell',
63
                    'actionUrl' => ['sell'],
64
                    'handleSubmit' => Url::toRoute('sell'),
65
                    'size' => Modal::SIZE_LARGE,
66
                    'header' => Html::tag('h4', Yii::t('hipanel:server:hub', 'Sell switches'), ['class' => 'modal-title']),
67
                    'toggleButton' => ['label' => Yii::t('hipanel:server:hub', 'Sell switches'), 'class' => 'btn btn-default btn-sm'],
68
                ]) ?>
69
            <?php endif; ?>
70
            <?php if (Yii::$app->user->can('hub.update')) : ?>
71
                <?= $page->renderBulkButton('update', '<i class="fa fa-pencil"></i>&nbsp;&nbsp;' . Yii::t('hipanel', 'Update'))?>
72
                <?= $page->renderBulkButton('assign-switches', '<i class="fa fa-plug"></i>&nbsp;&nbsp;' . Yii::t('hipanel:server:hub', 'Switches')) ?>
73
            <?php endif ?>
74
        <?php $page->endContent('bulk-actions') ?>
75
76
        <?php $page->beginContent('table') ?>
77
            <?php $page->beginBulkForm() ?>
78
                <?= HubGridView::widget([
79
                    'boxed' => false,
80
                    'colorize' => true,
81
                    'dataProvider' => $dataProvider,
82
                    'filterModel' => $model,
83
                    'rowOptions' => function ($model) {
84
                        return GridLegend::create(new HubGridLegend($model))->gridRowOptions();
85
                    },
86
                    'columns' => $representationCollection->getByName($uiModel->representation)->getColumns(),
87
                ]) ?>
88
            <?php $page->endBulkForm() ?>
89
        <?php $page->endContent() ?>
90
    <?php $page->end() ?>
91
<?php Pjax::end() ?>
92