1 | <?php |
||
2 | |||
3 | use Ffcms\Core\Helper\Date; |
||
4 | use Ffcms\Core\Helper\Type\Str; |
||
5 | use Ffcms\Templex\Url\Url; |
||
0 ignored issues
–
show
|
|||
6 | |||
7 | /** @var \Ffcms\Templex\Template\Template $this */ |
||
8 | /** @var \Apps\ActiveRecord\FeedbackPost $post */ |
||
9 | /** @var \Apps\ActiveRecord\FeedbackAnswer $answers */ |
||
10 | /** @var \Apps\Model\Front\Feedback\FormAnswerAdd|null $model */ |
||
11 | |||
12 | $this->layout('_layouts/default', [ |
||
13 | 'title' => __('Request from %email%', ['email' => $post->email]), |
||
14 | 'breadcrumbs' => [ |
||
15 | Url::to('/') => __('Home'), |
||
16 | Url::to('feedback/create') => __('Feedback'), |
||
17 | __('Read message') |
||
18 | ] |
||
19 | ]); |
||
20 | ?> |
||
21 | <?php $this->start('body') ?> |
||
22 | <h1><?= __('Feedback message #%id%', ['id' => $post->id]) ?></h1> |
||
23 | <?php if (\App::$User->isAuth()): ?> |
||
24 | <?= $this->insert('feedback/_authTabs') ?> |
||
25 | <?php else: ?> |
||
26 | <hr /> |
||
27 | <?php endif; ?> |
||
28 | |||
29 | <?php |
||
30 | if (!(bool)$post->closed && \App::$User->isAuth()) { |
||
31 | $user = App::$User->identity(); |
||
32 | if ((int)$user->getId() === (int)$post->user_id) { |
||
33 | echo Url::a(['feedback/close', [$post->id, $post->hash]], __('Close request'), ['class' => 'btn btn-danger']); |
||
34 | } |
||
35 | } |
||
36 | ?> |
||
37 | |||
38 | <div class="row"> |
||
39 | <div class="col-md-12"> |
||
40 | <div class="card"> |
||
41 | <div class="card-header"> |
||
42 | <strong><?= $post->name ?> (<?= $post->email ?>)</strong>, |
||
43 | <?= Date::convertToDatetime($post->created_at, Date::FORMAT_TO_HOUR) ?> |
||
44 | </div> |
||
45 | <div class="card-body well"> |
||
46 | <?= Str::replace("\n", "<br />", $post->message) ?> |
||
47 | </div> |
||
48 | </div> |
||
49 | </div> |
||
50 | </div> |
||
51 | <h3><?= __('Answers') ?></h3> |
||
52 | <hr /> |
||
53 | <?php if (!(bool)$post->readed && (!$answers || $answers->count() < 1)): ?> |
||
54 | <?= $this->bootstrap()->alert('warning', __('This message is not properly readed by website administrators')) ?> |
||
55 | <?php endif; ?> |
||
56 | |||
57 | <?php if ($answers && $answers->count() > 0) : ?> |
||
58 | <?php foreach ($answers as $answer): ?> |
||
59 | <div class="row" id="feedback-answer-<?= $answer->id ?>"> |
||
60 | <div class="col-md-12"> |
||
61 | <div class="card"> |
||
62 | <div class="card-header<?= (bool)$answer->is_admin ? ' bg-success' : null ?>"> |
||
63 | <strong><?= $answer->name ?> (<?= $answer->email ?>)</strong>, |
||
64 | <?= Date::convertToDatetime($answer->created_at, Date::FORMAT_TO_HOUR) ?> |
||
65 | </div> |
||
66 | <div class="card-body"> |
||
67 | <?= Str::replace("\n", "<br />", $answer->message) ?> |
||
68 | </div> |
||
69 | </div> |
||
70 | </div> |
||
71 | </div> |
||
72 | <?php endforeach; ?> |
||
73 | <?php endif; ?> |
||
74 | |||
75 | <br /> |
||
76 | <?php if (!(bool)$post->closed && $model): ?> |
||
77 | <h3><?= __('Add answer') ?></h3> |
||
78 | <?php $form = $this->form($model) ?> |
||
79 | <?= $form->start() ?> |
||
80 | |||
81 | <?= $form->fieldset()->text('name') ?> |
||
82 | <?= $form->fieldset()->text('email') ?> |
||
83 | <?= $form->fieldset()->textarea('message', ['rows' => 5]) ?> |
||
84 | |||
85 | <?= $form->button()->submit(__('Add'), ['class' => 'btn btn-primary']) ?> |
||
86 | |||
87 | <?= $form->stop() ?> |
||
88 | <?php else: ?> |
||
89 | <?= $this->bootstrap()->alert('danger', __('This request is closed! No answers is allowed')) ?> |
||
90 | <?php endif; ?> |
||
91 | |||
92 | <?php $this->stop() ?> |
||
93 |
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: