Issues (213)

src/views/rrd/view.php (4 issues)

1
<?php
2
3
use hipanel\helpers\Url;
4
use hipanel\widgets\IndexPage;
5
use hipanel\widgets\Pjax;
6
use yii\grid\GridView;
7
use yii\helpers\Html;
8
use yii\web\View;
9
10
/**
11
 * @var View
12
 * @var \hipanel\modules\server\models\RrdSearch $model
13
 * @var \hiqdev\hiart\ActiveDataProvider $dataProvider
14
 */
15
$searchModel = $model;
16
$models = $dataProvider->getModels();
17
$model = reset($models);
18
19
$this->title = Yii::t('hipanel:server', '{server} - RRD', ['server' => $model->server->name]);
20
$this->params['breadcrumbs'][] = Html::a(Yii::t('hipanel:server', 'Servers'), ['@server']);
21
$this->params['breadcrumbs'][] = Html::a($model->server->name, ['@server/view', 'id' => $model->server->id]);
22
$this->params['breadcrumbs'][] = Yii::t('hipanel:server', 'RRD');
23
24
?>
25
26
<?php Pjax::begin(array_merge(Yii::$app->params['pjax'], ['enablePushState' => true])) ?>
27
    <?php $page = IndexPage::begin(['model' => $searchModel, 'dataProvider' => $dataProvider, 'layout' => 'rrd']) ?>
28
        <?= $page->setSearchFormData(['model' => $model]) ?>
29
        <?= $page->setSearchFormOptions([
30
            'id' => 'rrd-form',
31
            'options' => [
32
                'displayNone' => false,
33
            ],
34
            'action' => ['@rrd/view', 'id' => $model->id],
35
            'submitButtonWrapperOptions' => [
36
                'class' => 'col-md-4',
37
            ],
38
        ]) ?>
39
        <?php $page->beginContent('table') ?>
40
        <?php $page->beginBulkForm() ?>
41
            <?= GridView::widget([
42
                'showHeader' => false,
43
                'options' => [
44
                    'class' => 'table-responsive',
45
                ],
46
                'tableOptions' => [
47
                    'class' => 'table',
48
                ],
49
                'summary' => false,
50
                'dataProvider' => new \yii\data\ArrayDataProvider([
51
                    'allModels' => $model->images,
52
                    'pagination' => false,
53
                    'sort' => false,
54
                ]),
55
                'columns' => [
56
                    [
57
                        'format' => 'raw',
58
                        'value' => function ($model, $key, $index, $widget) {
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

58
                        'value' => function ($model, /** @scrutinizer ignore-unused */ $key, $index, $widget) {

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 $widget 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

58
                        'value' => function ($model, $key, $index, /** @scrutinizer ignore-unused */ $widget) {

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

58
                        'value' => function ($model, $key, /** @scrutinizer ignore-unused */ $index, $widget) {

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...
59
                            $html = Html::tag('img', '', ['src' => 'data:image/png;base64,' . $model->base64]);
60
61
                            if ($model->graph) {
62
                                $html = Html::a($html, Url::current(['graph' => $model->graph]));
63
                            }
64
65
                            return Html::tag('div', $html, ['class' => 'text-center']);
66
                        },
67
                    ],
68
                ],
69
            ]) ?>
70
        <?php $page->endBulkForm() ?>
71
        <?php $page->endContent() ?>
72
    <?php $page->end() ?>
73
<?php Pjax::end() ?>
0 ignored issues
show
It is not recommended to use PHP's closing tag ?> in files other than templates.

Using a closing tag in PHP files that only contain PHP code is not recommended as you might accidentally add whitespace after the closing tag which would then be output by PHP. This can cause severe problems, for example headers cannot be sent anymore.

A simple precaution is to leave off the closing tag as it is not required, and it also has no negative effects whatsoever.

Loading history...
74