1 | <?php |
||
2 | |||
3 | /** @var \Ffcms\Templex\Template\Template $this */ |
||
4 | /** @var array $pagination */ |
||
5 | /** @var \Apps\ActiveRecord\FeedbackPost $records */ |
||
6 | |||
7 | use Ffcms\Core\Helper\Date; |
||
8 | use Ffcms\Core\Helper\Text; |
||
9 | use Ffcms\Templex\Url\Url; |
||
0 ignored issues
–
show
|
|||
10 | |||
11 | $this->layout('_layouts/default', [ |
||
12 | 'title' => __('List requests'), |
||
13 | 'breadcrumbs' => [ |
||
14 | Url::to('/') => __('Home'), |
||
15 | Url::to('feedback/create') => __('Feedback'), |
||
16 | __('List requests') |
||
17 | ] |
||
18 | ]); |
||
19 | ?> |
||
20 | |||
21 | <?php $this->start('body') ?> |
||
22 | <h1><?= __('Feedback requests') ?></h1> |
||
23 | <?= $this->insert('feedback/_authTabs'); ?> |
||
24 | |||
25 | <?php |
||
26 | if ($records->count() < 1) { |
||
27 | echo $this->bootstrap()->alert('warning', __('No requests is founded')); |
||
28 | $this->stop(); |
||
29 | return; |
||
30 | } |
||
31 | |||
32 | $table = $this->table(['class' => 'table']) |
||
33 | ->head([ |
||
34 | ['text' => '#'], |
||
35 | ['text' => __('Message')], |
||
36 | ['text' => __('Status')], |
||
37 | ['text' => __('Answers')], |
||
38 | ['text' => __('Created')], |
||
39 | ['text' => __('Updated')] |
||
40 | ]); |
||
41 | |||
42 | |||
43 | foreach ($records as $item) { |
||
44 | /** @var \Apps\ActiveRecord\FeedbackPost $item */ |
||
45 | $table->row([ |
||
46 | ['text' => $item->id], |
||
47 | ['text' => Url::a(['feedback/read', [$item->id, $item->hash]], Text::cut($item->message, 0, 40)), 'html' => true], |
||
48 | ['text' => |
||
49 | (int)$item->closed === 1 ? |
||
50 | '<span class="badge badge-danger">' . __('Closed') . '</span>' : |
||
51 | '<span class="badge badge-success">' . __('Opened') . '</span>', |
||
52 | 'html' => true, '!secure' => true], |
||
53 | ['text' => $item->answers()->count()], |
||
54 | ['text' => Date::convertToDatetime($item->created_at, Date::FORMAT_TO_HOUR)], |
||
55 | ['text' => Date::convertToDatetime($item->updated_at, Date::FORMAT_TO_HOUR)] |
||
56 | ]); |
||
57 | } |
||
58 | ?> |
||
59 | <div class="table-responsive"> |
||
60 | <?= $table->display(); ?> |
||
61 | </div> |
||
62 | |||
63 | <?= $this->bootstrap()->pagination(['feedback/list'], ['class' => 'pagination justify-content-center']) |
||
64 | ->size($pagination['total'], $pagination['page'], $pagination['step']) |
||
65 | ->display(); ?> |
||
66 | |||
67 | <?php $this->stop() ?> |
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: