anonymous()
last analyzed

Size

Total Lines 2
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 2
c 0
b 0
f 0
nc 1
nop 3
dl 0
loc 2
ccs 0
cts 1
cp 0
1
<?php
2
/**
3
 * @copyright Copyright(c) 2018 Thamtech, LLC
4
 * @link https://github.com/thamtech/yii2-scheduler
5
 * @license https://opensource.org/licenses/MIT
6
 *
7
 *
8
 * Task View
9
 *
10
 * @var yii\web\View $this
11
 * @var thamtech\scheduler\models\SchedulerTask $model
12
 */
13
14
use yii\helpers\Html;
15
use thamtech\scheduler\models\SchedulerTask;
16
use yii\bootstrap\Tabs;
0 ignored issues
show
Bug introduced by
The type yii\bootstrap\Tabs was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
17
use yii\grid\GridView;
18
use yii\widgets\DetailView;
19
20
21
$this->title = $model->__toString();
22
$this->params['breadcrumbs'][] = ['label' => SchedulerTask::label(2), 'url' => ['index']];
23
$this->params['breadcrumbs'][] = $model->__toString();
24
?>
25
<div class="task-view">
26
27
    <h1><?=$this->title ?></h1>
28
29
    <?php $this->beginBlock('main'); ?>
30
    <?= DetailView::widget([
31
        'model' => $model,
32
        'attributes' => [
33
            'id',
34
            'name',
35
            'display_name',
36
            'description',
37
            'schedule',
38
            'status',
39
            [
40
                'attribute' => 'started_at',
41
                'format' => 'raw',
42
                'value' => $model->status_id == SchedulerTask::STATUS_RUNNING ? $model->started_at : '',
43
            ],
44
            'last_run',
45
            'next_run',
46
        ],
47
    ]) ?>
48
    <?php $this->endBlock(); ?>
49
50
51
52
    <?php $this->beginBlock('logs'); ?>
53
    <div class="table-responsive">
54
        <?php \yii\widgets\Pjax::begin(['id' => 'logs']); ?>
55
        <?= GridView::widget([
56
            'layout' => '{summary}{pager}{items}{pager}',
57
            'dataProvider' => $logDataProvider,
58
            'pager' => [
59
                'class' => yii\widgets\LinkPager::className(),
0 ignored issues
show
Deprecated Code introduced by
The function yii\base\BaseObject::className() has been deprecated: since 2.0.14. On PHP >=5.5, use `::class` instead. ( Ignorable by Annotation )

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

59
                'class' => /** @scrutinizer ignore-deprecated */ yii\widgets\LinkPager::className(),

This function has been deprecated. The supplier of the function has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead.

Loading history...
60
                'firstPageLabel' => Yii::t('app', 'First'),
61
                'lastPageLabel' => Yii::t('app', 'Last'),
62
            ],
63
            'columns' => [
64
                'started_at:datetime',
65
                'ended_at:datetime',
66
                [
67
                    'label' => 'Duration',
68
                    'value' => function ($m) {
69
                        return $m->getDuration();
70
                    }
71
                ],
72
                [
73
                    'label' => 'Result',
74
                    'format' => 'raw',
75
                    'contentOptions' => function ($m) {
76
                        return ['class' => $m->error == 0 ? 'text-success' : 'text-danger'];
77
                    },
78
                    'value' => function ($m) {
79
                        $icon = $m->error == 0 ? 'ok-circle' : 'remove-circle';
80
                        $text = $m->error == 0 ? 'Success' : 'Failure';
81
82
                        return Html::tag('span', '', ['class' => 'glyphicon glyphicon-' . $icon]) . ' ' . $text;
83
                    }
84
                ],
85
                [
86
                    'class' => 'yii\grid\ActionColumn',
87
                    'visibleButtons' => [
88
                        'update' => false,
89
                        'delete' => false,
90
                    ],
91
                    'buttons' => [
92
                        'view' => function ($url, $model, $key) {
0 ignored issues
show
Unused Code introduced by
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

92
                        'view' => function ($url, $model, /** @scrutinizer ignore-unused */ $key) {

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...
93
                            return Html::a('View Details', ['view-log', 'id' => $model->id]);
94
                        }
95
                    ],
96
                ],
97
            ],
98
        ]); ?>
99
        <?php \yii\widgets\Pjax::end(); ?>
100
    </div>
101
    <?php $this->endBlock(); ?>
102
103
    <?= Tabs::widget([
104
        'encodeLabels' => false,
105
        'id' => 'customer',
106
        'items' => [
107
            'overview' => [
108
                'label'   => Yii::t('app', 'Overview'),
109
                'content' => $this->blocks['main'],
110
                'active'  => true,
111
            ],
112
            'logs' => [
113
                'label' => 'Logs',
114
                'content' => $this->blocks['logs'],
115
            ],
116
        ]
117
    ]);?>
118
</div>
119