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

Apps/View/Admin/default/user/user_delete.php (1 issue)

1
<?php
2
3
use Ffcms\Core\Helper\Date;
4
use Ffcms\Templex\Url\Url;
0 ignored issues
show
This use statement conflicts with another class in this namespace, Url. Consider defining an alias.

Let?s assume that you have a directory layout like this:

.
|-- OtherDir
|   |-- Bar.php
|   `-- Foo.php
`-- SomeDir
    `-- Foo.php

and let?s assume the following content of Bar.php:

// Bar.php
namespace OtherDir;

use SomeDir\Foo; // This now conflicts the class OtherDir\Foo

If both files OtherDir/Foo.php and SomeDir/Foo.php are loaded in the same runtime, you will see a PHP error such as the following:

PHP Fatal error:  Cannot use SomeDir\Foo as Foo because the name is already in use in OtherDir/Foo.php

However, as OtherDir/Foo.php does not necessarily have to be loaded and the error is only triggered if it is loaded before OtherDir/Bar.php, this problem might go unnoticed for a while. In order to prevent this error from surfacing, you must import the namespace with a different alias:

// Bar.php
namespace OtherDir;

use SomeDir\Foo as SomeDirFoo; // There is no conflict anymore.
Loading history...
5
6
/** @var Apps\Model\Admin\User\FormUserDelete $model */
7
/** @var Ffcms\Templex\Template\Template $this */
8
9
$this->layout('_layouts/default', [
10
    'title' => __('Delete users'),
11
    'breadcrumbs' => [
12
        Url::to('main/index') => __('Main'),
13
        Url::to('application/index') => __('Applications'),
14
        Url::to('user/index') => __('User list'),
15
        __('Delete users')
16
    ]
17
]);
18
19
?>
20
<?php $this->start('body') ?>
21
<?= $this->insert('user/_tabs') ?>
22
23
<h1><?= __('Delete users') ?></h1>
24
<p><?= __('Are you sure to delete this users?') ?></p>
25
<?php
26
$table = $this->table(['class' => 'table'])
27
    ->head([
28
        ['text' => '#'],
29
        ['text' => __('Email')],
30
        ['text' => __('Login')],
31
        ['text' => __('Nickname')],
32
        ['text' => __('Register date')]
33
    ]);
34
35
foreach ($model->users as $user) {
36
    /** @var \Apps\ActiveRecord\User $user */
37
    $nickname = \Ffcms\Core\Helper\Simplify::parseUserNick($user->id);
38
    $table->row([
39
        ['text' => $user->getParam('id')],
40
        ['text' => $user->getParam('email')],
41
        ['text' => $user->getParam('login')],
42
        ['text' => $nickname],
43
        ['text' => Date::convertToDatetime($user->created_at, Date::FORMAT_TO_HOUR)]
44
    ]);
45
}
46
?>
47
48
<div class="table-responsive">
49
    <?= $table->display() ?>
50
</div>
51
52
<?php $form = $this->form($model); ?>
53
<?= $form->start() ?>
54
55
<div class="row mb-2 mt-2">
56
    <div class="col-12">
57
        <?= $form->field()->boolean('delete', ['id' => 'delete_user_data']) ?>
58
        <label for="delete_user_data"><?= __('Delete all user data (comments, content, wall posts, feedback)?') ?></label>
59
    </div>
60
</div>
61
62
<?= $form->button()->submit(__('Delete'), ['class' => 'btn btn-danger']) ?>
63
<?= $form->button()->cancel(__('Cancel'), ['link' => ['user/index'], 'class' => 'btn btn-secondary']) ?>
64
<?= $form->stop() ?>
65
66
<?php $this->stop() ?>
67