1 | <?php |
||
2 | |||
3 | use Ffcms\Core\Helper\Date; |
||
4 | use Ffcms\Core\Helper\Text; |
||
5 | use Ffcms\Templex\Url\Url; |
||
0 ignored issues
–
show
|
|||
6 | |||
7 | /** @var \Ffcms\Templex\Template\Template $this */ |
||
8 | /** @var \Apps\ActiveRecord\FeedbackPost $records */ |
||
9 | /** @var array $pagination */ |
||
10 | |||
11 | $this->layout('_layouts/default', [ |
||
12 | 'title' => __('Feedback list'), |
||
13 | 'breadcrumbs' => [ |
||
14 | Url::to('main/index') => __('Main'), |
||
15 | Url::to('application/index') => __('Applications'), |
||
16 | __('Feedback') |
||
17 | ] |
||
18 | ]); |
||
19 | ?> |
||
20 | |||
21 | <?php $this->start('body') ?> |
||
22 | |||
23 | <?= $this->insert('feedback/_tabs') ?> |
||
24 | |||
25 | <h1><?= __('Feedback list') ?></h1> |
||
26 | <?php |
||
27 | if (!$records || $records->count() < 1) { |
||
28 | echo '<p class="alert alert-warning">' . __('Feedback requests is empty now!') . '</p>'; |
||
29 | $this->stop(); |
||
30 | return; |
||
31 | } |
||
32 | |||
33 | $table = $this->table(['class' => 'table table-striped']) |
||
34 | ->head([ |
||
35 | ['text' => '#'], |
||
36 | ['text' => __('Text')], |
||
37 | ['text' => __('Answers')], |
||
38 | ['text' => __('Author')], |
||
39 | ['text' => __('Status')], |
||
40 | ['text' => __('Date')], |
||
41 | ['text' => __('Actions')] |
||
42 | ]); |
||
43 | |||
44 | $items = []; |
||
45 | foreach ($records as $item) { |
||
46 | /** @var \Apps\ActiveRecord\FeedbackPost $item*/ |
||
47 | $table->row([ |
||
48 | ['text' => $item->id . (!$item->readed ? ' <i class="fa fa-bell alert-info"></i>' : null) . ($item->closed ? ' <i class="fa fa-eye-slash alert-danger"></i>' : null), 'html' => true], |
||
49 | ['text' => Url::a(['feedback/read', [$item->id]], Text::snippet($item->message, 40)), 'html' => true], |
||
50 | ['text' => '<span class="badge badge-light">' . $item->answers->count() . '</span>', 'html' => true], |
||
51 | ['text' => $item->email], |
||
52 | ['text' => (bool)$item->closed ? '<span class="badge badge-danger">' . __('Closed') . '</span>' : '<span class="label label-success">' . __('Opened') . '</span>', 'html' => true, '!secure' => true], |
||
53 | ['text' => Date::convertToDatetime($item->updated_at, Date::FORMAT_TO_HOUR)], |
||
54 | ['text' => $this->bootstrap()->btngroup(['class' => 'btn-group btn-group-sm', 'role' => 'group']) |
||
55 | ->add('<i class="fa fa-feed"></i>', ['feedback/read', [$item->id]], ['class' => 'btn btn-light', 'html' => true]) |
||
56 | ->add('<i class="fa fa-trash-o"></i>', ['feedback/delete', ['post', $item->id]], ['class' => 'btn btn-danger', 'html' => true]) |
||
57 | ->display(), 'html' => true, 'property' => ['class' => 'text-center']] |
||
58 | ]); |
||
59 | } |
||
60 | ?> |
||
61 | |||
62 | <div class="table-responsive"> |
||
63 | <?= $table->display() ?> |
||
64 | </div> |
||
65 | |||
66 | <p><i class="fa fa-bell alert-info"></i> = <?= __('New request or new answer in feedback topic') ?></p> |
||
67 | |||
68 | <?= $this->bootstrap()->pagination($pagination['url'], ['class' => 'pagination justify-content-center']) |
||
69 | ->size($pagination['total'], $pagination['page'], $pagination['step']) |
||
70 | ->display(); ?> |
||
71 | |||
72 | <?php $this->stop() ?> |
||
73 |
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: