Passed
Push — master ( 1a706b...988f2a )
by Paweł
02:31
created

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

Severity
1
<?php
2
3
use jakim\ig\Url;
4
use yii\helpers\Html;
5
use app\modules\admin\widgets\InvalidAccountAlert;
6
use app\modules\admin\widgets\OnOffMonitoringButton;
7
use app\modules\admin\widgets\favorites\ProfileButton;
8
use app\modules\admin\widgets\TagsSideWidget;
9
use app\modules\admin\widgets\NotesSideWidget;
10
11
12
/* @var $this yii\web\View */
13
/* @var $model app\models\Account */
14
15
$formatter = Yii::$app->formatter;
16
$lastAccountStats = $model->lastAccountStats;
17
18
?>
19
<?php if (!$model->is_valid): ?>
20
    <?= InvalidAccountAlert::widget([
21
        'model' => $model,
22
    ]) ?>
23
<?php endif; ?>
24
25
<div class="box box-primary">
26
27
28
    <div class="box-body box-profile">
29
        <?php if ($model->profile_pic_url): ?>
30
            <?= Html::img($model->profile_pic_url, ['class' => 'profile-user-img img-responsive img-circle']) ?>
31
        <?php endif; ?>
32
        <h3 class="profile-username text-center">
33
            <?= Html::encode($model->displayName) ?>
34
            <?= Html::a('<span class="fa fa-external-link text-sm"></span>', Url::account($model->username), ['target' => '_blank']) ?>
35
        </h3>
36
        <p class="text-muted text-center">
37
            <?php if ($model->name): ?>
38
                <?= Html::encode($model->usernamePrefixed) ?><br>
39
            <?php endif; ?>
40
            <?= Html::encode($model->full_name) ?>
41
        </p>
42
        <?php if ($lastAccountStats): ?>
0 ignored issues
show
$lastAccountStats is of type app\models\AccountStats, thus it always evaluated to true. If $lastAccountStats can have other possible types, add them to models/Account.php:44
Loading history...
43
            <ul class="list-group list-group-unbordered">
44
                <li class="list-group-item">
45
                    <b><?= $lastAccountStats->getAttributeLabel('followed_by') ?></b>
46
                    <a class="pull-right">
47
                        <?= $formatter->asInteger($lastAccountStats->followed_by) ?>
48
                    </a>
49
                </li>
50
                <li class="list-group-item">
51
                    <b><?= $lastAccountStats->getAttributeLabel('follows') ?></b>
52
                    <a class="pull-right">
53
                        <?= $formatter->asInteger($lastAccountStats->follows) ?>
54
                    </a>
55
                </li>
56
                <li class="list-group-item">
57
                    <b><?= $lastAccountStats->getAttributeLabel('media') ?></b>
58
                    <a class="pull-right">
59
                        <?= $formatter->asInteger($lastAccountStats->media) ?>
60
                    </a>
61
                </li>
62
                <li class="list-group-item">
63
                    <b><?= $lastAccountStats->getAttributeLabel('er') ?></b>
64
                    <a class="pull-right">
65
                        <?= $formatter->asPercent($lastAccountStats->er, 2) ?>
66
                    </a>
67
                </li>
68
                <li class="list-group-item">
69
                    <b><?= $model->getAttributeLabel('updated_at') ?></b>
70
                    <a class="pull-right">
71
                        <?= $formatter->asDatetime($lastAccountStats->created_at) ?>
72
                    </a>
73
                </li>
74
            </ul>
75
        <?php endif; ?>
76
        <?= OnOffMonitoringButton::widget([
77
            'model' => $model,
78
        ]) ?>
79
80
        <?= ProfileButton::widget([
81
            'model' => $model,
82
        ]) ?>
83
        <?= Html::a('<span class="fa fa-external-link"></span> Public url', ['/preview/account', 'uid' => $model->uid], ['class' => 'btn btn-default btn-block btn-sm', 'target' => '_blank']) ?>
84
    </div>
85
</div>
86
87
<div class="box box-primary">
88
    <div class="box-header with-border">
89
        <h3 class="box-title">Description</h3>
90
    </div>
91
    <!-- /.box-header -->
92
    <div class="box-body">
93
        <?php if ($model->external_url): ?>
94
            <strong><i class="fa fa-external-link margin-r-5"></i>
95
                <?= $model->getAttributeLabel('external_url') ?>
96
            </strong>
97
            <p class="text-muted">
98
                <?= Html::a($model->external_url, $model->external_url, ['target' => '_blank']) ?>
99
            </p>
100
            <hr>
101
        <?php endif; ?>
102
        <?php if ($model->biography): ?>
103
            <strong><i class="fa fa-book margin-r-5"></i>
104
                <?= $model->getAttributeLabel('biography') ?>
105
            </strong>
106
            <p class="text-muted">
107
                <?= $formatter->asNtext($model->biography) ?>
108
            </p>
109
            <hr>
110
        <?php endif; ?>
111
112
        <?= TagsSideWidget::widget([
113
            'model' => $model,
114
        ]); ?>
115
        <hr>
116
        <?= NotesSideWidget::widget([
117
            'model' => $model,
118
        ]); ?>
119
    </div>
120
    <!-- /.box-body -->
121
</div>