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 \Apps\ActiveRecord\FeedbackPost $record */ |
||
8 | /** @var \Apps\Model\Admin\Feedback\FormAnswerAdd|null $model */ |
||
9 | /** @var \Ffcms\Templex\Template\Template $this */ |
||
10 | |||
11 | |||
12 | $this->layout('_layouts/default', [ |
||
13 | 'title' => __('Feedback read'), |
||
14 | 'breadcrumbs' => [ |
||
15 | Url::to('main/index') => __('Main'), |
||
16 | Url::to('application/index') => __('Applications'), |
||
17 | Url::to('feedback/index') => __('Feedback'), |
||
18 | __('Read feedback message') |
||
19 | ] |
||
20 | ]); |
||
21 | ?> |
||
22 | |||
23 | <?php $this->start('body') ?> |
||
24 | |||
25 | <?= $this->insert('feedback/_tabs') ?> |
||
26 | |||
27 | <h1><?= __('Read feedback message #%id%', ['id' => $record->id]) ?></h1> |
||
28 | <div class="row"> |
||
29 | <div class="col-md-8"> |
||
30 | <div class="card"> |
||
31 | <div class="card-header" style="background-color: #cadcee"> |
||
32 | <?php |
||
33 | if (!(bool)$record->readed) { |
||
34 | echo '<i class="fa fa-bell"></i> '; |
||
35 | } |
||
36 | ?> |
||
37 | <?= __('Message sent') ?>: <?= Date::convertToDatetime($record->created_at, Date::FORMAT_TO_HOUR) ?>. |
||
38 | <?php |
||
39 | if (!(bool)$record->closed) { |
||
40 | echo '<span class="badge badge-success">' . __('Opened') . '</span>'; |
||
41 | } else { |
||
42 | echo '<span class="badge badge-danger">' . __('Closed') . '</span>'; |
||
43 | } |
||
44 | ?> |
||
45 | <?php |
||
46 | $btngrp = $this->bootstrap()->btngroup(['class' => 'btn-group btn-group-sm', 'role' => 'group'], 4); |
||
47 | |||
48 | // show "mark as read" button if message is not readed |
||
49 | if (!(bool)$record->readed) { |
||
50 | $btngrp->add('<i class="fa fa-bookmark-o"></i>', ['feedback/turn', ['read', $record->id]], ['class' => 'btn btn-success', 'html' => true, 'data-toggle' => 'tooltip', 'title' => __('Mark as read')]); |
||
51 | } |
||
52 | |||
53 | // show close/open button depend of current status |
||
54 | if (!(bool)$record->closed) { |
||
55 | $btngrp->add('<i class="fa fa-eye-slash"></i>', ['feedback/turn', ['close', $record->id]], ['class' => 'btn btn-warning', 'html' => true, 'data-toggle' => 'tooltip', 'title' => __('Close')]); |
||
56 | } else { |
||
57 | $btngrp->add('<i class="fa fa-eye"></i>', ['feedback/turn', ['open', $record->id]], ['class' => 'btn btn-info', 'html' => true, 'data-toggle' => 'tooltip', 'title' => __('Open')]); |
||
58 | } |
||
59 | |||
60 | $btngrp->add('<i class="fa fa-pencil"></i>', ['feedback/update', ['post', $record->id]], ['class' => 'btn btn-primary', 'html' => true, 'data-toggle' => 'tooltip', 'title' => __('Edit')]); |
||
61 | $btngrp->add('<i class="fa fa-trash-o"></i>', ['feedback/delete', ['post', $record->id]], ['class' => 'btn btn-danger', 'html' => true, 'data-toggle' => 'tooltip', 'title' => __('Delete')]); |
||
62 | ?> |
||
63 | <div class="pull-right"><?= $btngrp->display() ?></div> |
||
64 | </div> |
||
65 | <div class="card-body"> |
||
66 | <?php |
||
67 | if ((bool)$record->closed) { |
||
68 | echo '<p class="alert alert-warning">' . __('The feedback request is closed! Thread in only-read mode') . '.</p>'; |
||
69 | } |
||
70 | ?> |
||
71 | <p><?= Str::replace("\n", "<br />", $record->message) ?></p> |
||
72 | </div> |
||
73 | </div> |
||
74 | </div> |
||
75 | <div class="col-md-4"> |
||
76 | <div class="card card-success"> |
||
77 | <div class="card-header"> |
||
78 | <?= __('Sender info') ?> |
||
79 | </div> |
||
80 | <div class="card-body"> |
||
81 | <?php |
||
82 | $uInfo = 'no'; |
||
83 | if ((int)$record->user_id > 0) { |
||
84 | $user = \App::$User->identity($record->user_id); |
||
85 | if ($user && $user->getId() > 0) { |
||
86 | $uInfo = Url::a(['user/update', [$user->getId()]], $user->profile->getNickname()); |
||
87 | } |
||
88 | } |
||
89 | ?> |
||
90 | <?= $this->table(['class' => 'table table-striped']) |
||
91 | ->body([ |
||
92 | [['text' => __('Name')], ['text' => $record->name]], |
||
93 | [['text' => __('Email')], ['text' => $record->email]], |
||
94 | [['text' => __('Auth')], ['text' => $uInfo, 'html' => true]], |
||
95 | [['text' => 'IP'], ['text' => $record->ip]] |
||
96 | ])->display(); ?> |
||
97 | </div> |
||
98 | </div> |
||
99 | </div> |
||
100 | </div> |
||
101 | |||
102 | <?php if ($record->answers->count() > 0): ?> |
||
103 | <?php foreach ($record->answers as $answer): ?> |
||
104 | <div class="card"> |
||
105 | <div class="card-header"> |
||
106 | <?= __('From') ?>: <?= $answer->name . '(' . $answer->email . ')' . ((int)$answer->user_id > 0 ? Url::a(['user/update', [$answer->user_id]], '[id' . $answer->user_id . ']') : null) ?>, |
||
107 | <?= Date::convertToDatetime($answer->created_at, Date::FORMAT_TO_HOUR) ?> |
||
108 | <div class="pull-right"> |
||
109 | <?= $this->bootstrap()->btngroup(['class' => 'btn-group btn-group-sm']) |
||
110 | ->add('<i class="fa fa-pencil"></i>', ['feedback/update', ['answer', $answer->id]], ['class' => 'btn btn-primary', 'html' => true]) |
||
111 | ->add('<i class="fa fa-trash-o"></i>', ['feedback/delete', ['answer', $answer->id]], ['class' => 'btn btn-danger', 'html' => true]) |
||
112 | ->display() ?> |
||
113 | </div> |
||
114 | </div> |
||
115 | <div class="card-body"> |
||
116 | <?= Str::replace("\n", "<br />", $answer->message) ?> |
||
117 | </div> |
||
118 | </div> |
||
119 | <?php endforeach; ?> |
||
120 | <?php endif; ?> |
||
121 | |||
122 | <?php if ($model): ?> |
||
123 | <h3><?= __('Add answer') ?></h3> |
||
124 | <?php $form = $this->form($model) ?> |
||
125 | <?= $form->start() ?> |
||
126 | |||
127 | <?= $form->fieldset()->text('name') ?> |
||
128 | <?= $form->fieldset()->text('email') ?> |
||
129 | <?= $form->fieldset()->textarea('message', ['class' => 'form-control', 'rows' => 7]) ?> |
||
130 | |||
131 | <?= $form->button()->submit(__('Add answer'), ['class' => 'btn btn-primary']) ?> |
||
132 | |||
133 | <?= $form->stop() ?> |
||
134 | <?php endif; ?> |
||
135 | |||
136 | <?php $this->stop() ?> |
||
137 |
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: