Test Failed
Push — master ( e3c39f...fe570d )
by Mihail
07:20
created

Apps/View/Admin/default/profile/index.php (1 issue)

1
<?php
2
3
use Ffcms\Core\Helper\Date;
4
use Ffcms\Core\Helper\Type\Str;
5
use Ffcms\Templex\Url\Url;
6
7
/** @var \Apps\ActiveRecord\Profile[]|\Illuminate\Support\Collection $records */
8
/** @var array $pagination */
9
/** @var \Ffcms\Templex\Template\Template $this */
10
11
$this->layout('_layouts/default', [
12
    'title' => __('Profile list'),
13
    'breadcrumbs' => [
14
        Url::to('main/index') => __('Main'),
15
        Url::to('application/index') => __('Applications'),
16
        __('Profile')
17
    ]
18
]);
19
?>
20
21
<?php $this->start('body') ?>
22
23
<?= $this->insert('profile/_tabs') ?>
0 ignored issues
show
Are you sure the usage of $this->insert('profile/_tabs') targeting League\Plates\Template\Template::insert() seems to always return null.

This check looks for function or method calls that always return null and whose return value is used.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
if ($a->getObject()) {

The method getObject() can return nothing but null, so it makes no sense to use the return value.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
24
25
<h1><?= __('Profile list') ?></h1>
26
<?php
27
$table = $this->table(['class' => 'table table-striped'])
28
    ->head([
29
        ['text' => '#'],
30
        ['text' => 'login'],
31
        ['text' => 'email'],
32
        ['text' => __('Nickname')],
33
        ['text' => __('Birthday')],
34
        ['text' => __('Rating')],
35
        ['text' => __('Actions'), 'properties' => ['class' => 'text-center']]
36
    ]);
37
38
foreach ($records as $profile) {
39
    $table->row([
40
        ['text' => $profile->id],
41
        ['text' => $profile->user->login],
42
        ['text' => $profile->user->email],
43
        ['text' => $profile->nick],
44
        ['text' => Str::startsWith('0000-', $profile->birthday) ? __('None') : Date::convertToDatetime($profile->birthday)],
45
        ['text' => ($profile->rating > 0 ? '+' : null) . $profile->rating],
46
        ['text' => $this->bootstrap()->btngroup(['class' => 'btn-group btn-group-sm'])
47
            ->add('<i class="fa fa-pencil"></i>', ['profile/update', [$profile->id]], ['html' => true, 'class' => 'btn btn-primary'])
48
            ->add('<i class="fa fa-trash-o"></i>', ['user/delete', [$profile->user->id]], ['html' => true, 'class' => 'btn btn-danger'])
49
            ->display(), 'html' => true, 'properties' => ['class' => 'text-center']]
50
    ]);
51
}
52
?>
53
54
<div class="table-responsive">
55
    <?= $table->display() ?>
56
</div>
57
58
<?= $this->bootstrap()->pagination($pagination['url'], ['class' => 'pagination justify-content-center'])
59
    ->size($pagination['total'], $pagination['page'], $pagination['step'])
60
    ->display(); ?>
61
62
<?php $this->stop() ?>