Passed
Push — master ( 420524...d9222d )
by Paweł
02:51
created

modules/admin/views/account/settings.php (1 issue)

Labels
Severity
1
<?php
2
3
use app\modules\admin\models\Proxy;
4
use kartik\select2\Select2;
5
use yii\helpers\ArrayHelper;
6
use yii\helpers\Html;
7
use yii\widgets\ActiveForm;
8
9
/* @var $this yii\web\View */
10
/* @var $model app\models\Account */
11
/** @var array|\app\modules\admin\models\Proxy $proxies [] */
12
13
$this->title = "{$model->usernamePrefixed} :: Statistics";
14
$this->params['breadcrumbs'][] = ['label' => 'Monitoring', 'url' => ['monitoring/accounts']];
15
$this->params['breadcrumbs'][] = ['label' => $model->usernamePrefixed, 'url' => ['dashboard', 'id' => $model->id]];
16
$this->params['breadcrumbs'][] = 'Statistics';
17
18
$formatter = Yii::$app->formatter;
19
$lastAccountStats = $model->lastAccountStats;
20
?>
21
<div class="account-view">
22
    <div class="row">
23
        <div class="col-lg-3">
24
            <?= $this->render('_profile', ['model' => $model]) ?>
25
        </div>
26
        <div class="col-lg-9">
27
            <div class="nav-tabs-custom">
28
                <?= $this->render('_tabs', ['model' => $model]) ?>
29
                <div class="tab-content">
30
                    <div class="row">
31
                        <div class="col-lg-6">
32
                            <?php $form = ActiveForm::begin(); ?>
33
34
                            <?= $form->field($model, 'name')->textInput(['maxlength' => true]) ?>
35
                            <?= $form->field($model, 'is_valid')->checkbox() ?>
36
                            <?= $form->field($model, 'proxy_id')->widget(Select2::class, [
37
                                'options' => [
38
                                    'prompt' => 'Select dedicated proxy...',
39
                                ],
40
                                'pluginOptions' => [
41
                                    'allowClear' => true,
42
                                ],
43
                                'data' => ArrayHelper::map($proxies, 'id', function (Proxy $proxy) {
0 ignored issues
show
It seems like $proxies can also be of type app\modules\admin\models\Proxy; however, parameter $array of yii\helpers\BaseArrayHelper::map() does only seem to accept array, maybe add an additional type check? ( Ignorable by Annotation )

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

43
                                'data' => ArrayHelper::map(/** @scrutinizer ignore-type */ $proxies, 'id', function (Proxy $proxy) {
Loading history...
44
                                    return "{$proxy->ip}:{$proxy->port}";
45
                                }),
46
                            ]) ?>
47
48
                            <div class="form-group">
49
                                <?= Html::submitButton('Update', ['class' => 'btn btn-success']) ?>
50
                            </div>
51
52
                            <?php ActiveForm::end() ?>
53
                        </div>
54
                        <div class="col-lg-4 col-lg-offset-2">
55
                            <p>
56
                                <?= Html::a('Delete statistics history', ['account/delete-stats', 'id' => $model->id], [
57
                                    'class' => 'btn btn-danger',
58
                                    'data' => [
59
                                        'method' => 'post',
60
                                        'confirm' => 'Statistical data will be permanently deleted, are you sure?',
61
                                    ],
62
                                ]) ?>
63
                            </p>
64
                            <p>
65
                                <?= Html::a('Delete associated data', ['account/delete-associated', 'id' => $model->id], [
66
                                    'class' => 'btn btn-danger',
67
                                    'data' => [
68
                                        'method' => 'post',
69
                                        'confirm' => 'Associated data (media tags, media accounts) will be permanently deleted, are you sure?',
70
                                    ],
71
                                ]) ?>
72
                            </p>
73
                            <p>
74
                                <?= Html::a('Delete account', ['account/delete', 'id' => $model->id], [
75
                                    'class' => 'btn btn-danger',
76
                                    'data' => [
77
                                        'method' => 'post',
78
                                        'confirm' => 'Account and all associated data will be permanently deleted, are you sure?',
79
                                    ],
80
                                ]) ?>
81
                            </p>
82
                        </div>
83
                    </div>
84
                </div>
85
            </div>
86
        </div>
87
    </div>
88
</div>
89