1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
use hipanel\modules\hosting\grid\IpGridLegend; |
4
|
|
|
use hipanel\modules\hosting\grid\IpGridView; |
5
|
|
|
use hipanel\widgets\gridLegend\GridLegend; |
6
|
|
|
use hipanel\widgets\IndexPage; |
7
|
|
|
use hipanel\widgets\Pjax; |
8
|
|
|
use yii\helpers\Html; |
9
|
|
|
|
10
|
|
|
$this->title = Yii::t('hipanel:hosting', 'IP addresses'); |
11
|
|
|
$this->params['subtitle'] = array_filter(Yii::$app->request->get($model->formName(), [])) ? Yii::t('hipanel', 'filtered list') : Yii::t('hipanel', 'full list'); |
12
|
|
|
$this->params['breadcrumbs'][] = $this->title; |
13
|
|
|
|
14
|
|
|
?> |
15
|
|
|
|
16
|
|
|
<?php Pjax::begin(array_merge(Yii::$app->params['pjax'], ['enablePushState' => true])) ?> |
17
|
|
|
<?php $page = IndexPage::begin(compact('model', 'dataProvider')) ?> |
18
|
|
|
|
19
|
|
|
<?php $page->setSearchFormData(compact(['ipTags'])) ?> |
20
|
|
|
|
21
|
|
|
<?php $page->beginContent('main-actions') ?> |
22
|
|
View Code Duplication |
<?php if (Yii::$app->user->can('support')) : ?> |
|
|
|
|
23
|
|
|
<?= Html::a(Yii::t('hipanel:hosting', 'Create IP'), ['@ip/create'], ['class' => 'btn btn-sm btn-success']) ?> |
24
|
|
|
<?php endif; ?> |
25
|
|
|
<?php $page->endContent() ?> |
26
|
|
|
|
27
|
|
|
<?php if (Yii::$app->user->can('support')) : ?> |
28
|
|
|
<?php $page->beginContent('legend') ?> |
29
|
|
|
<?= GridLegend::widget(['legendItem' => new IpGridLegend($model)]) ?> |
30
|
|
|
<?php $page->endContent() ?> |
31
|
|
|
<?php endif ?> |
32
|
|
|
|
33
|
|
|
<?php $page->beginContent('sorter-actions') ?> |
34
|
|
|
<?= $page->renderSorter([ |
35
|
|
|
'attributes' => [ |
36
|
|
|
'ip', |
37
|
|
|
], |
38
|
|
|
]) ?> |
39
|
|
|
<?php $page->endContent() ?> |
40
|
|
|
|
41
|
|
|
<?php $page->beginContent('table') ?> |
42
|
|
|
<?php $page->beginBulkForm() ?> |
43
|
|
|
<?php echo IpGridView::widget([ |
44
|
|
|
'dataProvider' => $dataProvider, |
45
|
|
|
'filterModel' => $model, |
46
|
|
|
'boxed' => false, |
47
|
|
|
'ipTags' => $ipTags, |
48
|
|
|
'rowOptions' => function ($model) { |
49
|
|
|
return GridLegend::create(new IpGridLegend($model))->gridRowOptions(); |
50
|
|
|
}, |
51
|
|
|
'columns' => $representationCollection->getByName($uiModel->representation)->getColumns(), |
52
|
|
|
]) ?> |
53
|
|
|
<?php $page->endBulkForm() ?> |
54
|
|
|
<?php $page->endContent() ?> |
55
|
|
|
<?php $page->end() ?> |
56
|
|
|
<?php Pjax::end() ?> |
57
|
|
|
|
58
|
|
|
|
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.