1 | <?php |
||
2 | |||
3 | use Ffcms\Core\Helper\Date; |
||
4 | use Ffcms\Core\Helper\Simplify; |
||
5 | use Ffcms\Templex\Url\Url; |
||
0 ignored issues
–
show
|
|||
6 | |||
7 | /** @var Apps\Model\Front\Profile\FormIgnoreAdd $model */ |
||
8 | /** @var \Ffcms\Templex\Template\Template $this */ |
||
9 | /** @var Apps\ActiveRecord\Blacklist[] $records */ |
||
10 | /** @var array $pagination */ |
||
11 | |||
12 | $this->layout('_layouts/default', [ |
||
13 | 'title' => __('Blacklist'), |
||
14 | 'breadcrumbs' => [ |
||
15 | Url::to('main/index') => __('Home'), |
||
16 | Url::to('profile/show', [\App::$User->identity()->getId()]) => __('Profile'), |
||
17 | __('Blacklist') |
||
18 | ] |
||
19 | ]); |
||
20 | ?> |
||
21 | |||
22 | <?php $this->start('body') ?> |
||
23 | |||
24 | <?php $this->insert('profile/menus/settings') ?> |
||
25 | |||
26 | <h2><?= __('Add user ignore') ?></h2> |
||
27 | <hr /> |
||
28 | <?php $form = $this->form($model) ?> |
||
29 | <?= $form->start() ?> |
||
30 | |||
31 | <?= $form->fieldset()->text('id', null, __('Enter id of user who you want to block')) ?> |
||
32 | <?= $form->fieldset()->text('comment', null, __('Remark memo about this block')) ?> |
||
33 | |||
34 | <?= $form->button()->submit(__('Block'), ['class' => 'btn btn-danger']) ?> |
||
35 | |||
36 | <?= $form->stop() ?> |
||
37 | |||
38 | <h2><?= __('List of blocked users') ?></h2> |
||
39 | <hr /> |
||
40 | <?php if (!$records || $records->count() < 1) { |
||
41 | echo '<p class="alert alert-info">' . __('No users in blacklist!') . '</p>'; |
||
42 | $this->stop(); |
||
43 | return; |
||
44 | } ?> |
||
45 | |||
46 | <div class="table-responsive"> |
||
47 | <?php |
||
48 | $table = $this->table(['class' => 'table'])->head([ |
||
49 | ['text' => __('User')], |
||
50 | ['text' => __('Comment')], |
||
51 | ['text' => __('Add date')], |
||
52 | ['text' => __('Actions')] |
||
53 | ]); |
||
54 | foreach ($records as $row) { |
||
55 | $table->row([ |
||
56 | ['text' => Simplify::parseUserLink($row->target_id), 'html' => true], |
||
57 | ['text' => $row->comment], |
||
58 | ['text' => Date::convertToDatetime($row->created_at, Date::FORMAT_TO_DAY)], |
||
59 | ['text' => Url::a(['profile/unblock', [$row->target_id]], '<i class="fa fa-trash"></i>', ['html' => true]), 'html' => true] |
||
60 | ]); |
||
61 | } |
||
62 | echo $table->display(); |
||
63 | ?> |
||
64 | <?= $this->bootstrap()->pagination(['profile/ignore'], ['class' => 'pagination justify-content-center']) |
||
65 | ->size($pagination['total'], $pagination['page'], $pagination['step']) |
||
66 | ->display(); ?> |
||
67 | </div> |
||
68 | <?php $this->stop() ?> |
||
69 |
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: