1 | <?php |
||
2 | |||
3 | use Ffcms\Core\Helper\Date; |
||
4 | use Ffcms\Templex\Url\Url; |
||
0 ignored issues
–
show
|
|||
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 |
Let?s assume that you have a directory layout like this:
and let?s assume the following content of
Bar.php
:If both files
OtherDir/Foo.php
andSomeDir/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 beforeOtherDir/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: