mirror of
https://github.com/openvk/openvk
synced 2025-07-07 08:19:49 +03:00
Fixes + english localization
This commit is contained in:
parent
fead54dfb6
commit
f8f0bbc8cb
7 changed files with 67 additions and 60 deletions
|
@ -49,12 +49,11 @@ class TicketComments
|
|||
// return $this->toTicket($this->tickets->get($id));
|
||||
// }
|
||||
|
||||
// We can get comment by it's ID using this function
|
||||
function get(int $id): TicketComment
|
||||
{
|
||||
$comm = $this->comments->where(['id' => $id])->fetch();
|
||||
if (!is_null($comm))
|
||||
return new TicketComment($comm);
|
||||
$comment = $this->comments->where(['id' => $id])->fetch();
|
||||
if (!is_null($comment))
|
||||
return new TicketComment($comment);
|
||||
else
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -226,35 +226,26 @@ final class SupportPresenter extends OpenVKPresenter
|
|||
$this->template->content = $parser->parse($content);
|
||||
}
|
||||
|
||||
function renderRateAnswerGood(int $id): void
|
||||
function renderRateAnswer(int $id, int $mark): void
|
||||
{
|
||||
$this->willExecuteWriteAction();
|
||||
$this->assertUserLoggedIn();
|
||||
|
||||
$comment = $this->comments->get($id);
|
||||
if ($this->user->id === $this->tickets->get($comment->getTicketId()->getUser()->getId())) {
|
||||
$comment->setMark(1);
|
||||
$comment->save();
|
||||
|
||||
$this->flashFail("succ", "Успешно", "Вы оставили положительный отзыв об ответе");
|
||||
if ($this->user->id === $this->tickets->get($comment->getTicketId())->getUser()->getId()) {
|
||||
if ($mark === 1 || $mark === 2) {}
|
||||
$comments->setMark($mark);
|
||||
$comments->save();
|
||||
if ($mark === 1) {
|
||||
$this->flashFail("succ", tr("information_-1"), tr("support_rated_good"));
|
||||
} elseif ($mark === 2) {
|
||||
$this->flashFail("succ", tr("information_-1"), tr("support_rated_bad"));
|
||||
}
|
||||
} else {
|
||||
$this->flashFail("err", "Ошибка", "Ошибка доступа");
|
||||
$this->flashFail("err", tr("error"), tr("wrong_parameters"));
|
||||
}
|
||||
}
|
||||
|
||||
function renderRateAnswerBad(int $id): void
|
||||
{
|
||||
$this->willExecuteWriteAction();
|
||||
$this->assertUserLoggedIn();
|
||||
|
||||
$comment = $this->comments->get($id);
|
||||
if ($this->user->id === $this->tickets->get($comment->getTicketId()->getUser()->getId())) {
|
||||
$comment->setMark(2);
|
||||
$comment->save();
|
||||
|
||||
$this->flashFail("succ", "Успешно", "Вы оставили положительный отзыв об ответе");
|
||||
} else {
|
||||
$this->flashFail("err", "Ошибка", "Ошибка доступа");
|
||||
$this->flashFail("err", tr("error"), tr("forbidden"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -109,17 +109,20 @@
|
|||
<a href="/support/comment/{$comment->getId()}/delete">{_delete}</a>
|
||||
</div>
|
||||
{/if}
|
||||
{elseif $comment->getUType() === 1}
|
||||
|
||||
{if $comment->getUType() === 1}
|
||||
<div class="post-menu">
|
||||
<strong>
|
||||
{if $comment->getMark() != null}
|
||||
{if $comment->getMark() === 1}
|
||||
<div class="post-menu">
|
||||
<strong>{_support_good_answer_agent}</strong>
|
||||
</div>
|
||||
{_support_good_answer_agent}
|
||||
{elseif $comment->getMark() === 2}
|
||||
<div class="post-menu">
|
||||
<strong>{_support_bad_answer_agent}</strong>
|
||||
</div>
|
||||
{_support_bad_answer_agent}
|
||||
{/if}
|
||||
{/if}
|
||||
</strong>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
|
|
@ -90,25 +90,28 @@
|
|||
{$comment->getText()|noescape}
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
{if $comment->getUType() === 0}
|
||||
<div class="post-menu">
|
||||
<a href="/support/comment/{$comment->getId()}/delete">{_delete}</a>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
{if $comment->getUType() === 1 && $comment->getMark() === 0}
|
||||
{if $comment->getUType() === 1}
|
||||
<div class="post-menu">
|
||||
<a href="/support/comment/{$comment->getId()}/rateGood">{_support_rate_good_answer}}</a>
|
||||
|
|
||||
<a href="/support/comment/{$comment->getId()}/rateBad">{_support_rate_bad_answer}}</a>
|
||||
</div>
|
||||
{elseif $comment->getMark() === 1}
|
||||
<div class="post-menu">
|
||||
<strong>{_support_good_answer_user}</strong>
|
||||
</div>
|
||||
{if $comment->getMark() != null}
|
||||
<strong>
|
||||
{if $comment->getMark() === 1}
|
||||
{_support_good_answer_user}
|
||||
{elseif $comment->getMark() === 2}
|
||||
<div class="post-menu">
|
||||
<strong>{_support_bad_answer_user}</strong>
|
||||
{_support_bad_answer_user}
|
||||
{/if}
|
||||
</strong>
|
||||
{else}
|
||||
<a href="/support/comment/{$comment->getId()}/rate/1">{_support_rate_good_answer}</a>
|
||||
|
|
||||
<a href="/support/comment/{$comment->getId()}/rate/2">{_support_rate_bad_answer}</a>
|
||||
{/if}
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
|
|
|
@ -17,10 +17,8 @@ routes:
|
|||
handler: "Support->AnswerTicket"
|
||||
- url: "/support/view/{num}"
|
||||
handler: "Support->view"
|
||||
- url: "/support/comment/{num}/rateGood"
|
||||
handler: "Support->RateAnswerGood"
|
||||
- url: "/support/comment/{num}/rateBad"
|
||||
handler: "Support->RateAnswerBad"
|
||||
- url: "/support/comment/{num}/rate/{num}"
|
||||
handler: "Support->RateAnswer"
|
||||
- url: "/al_comments.pl/create/support/{num}"
|
||||
handler: "Support->makeComment"
|
||||
- url: "/al_comments.pl/create/support/reply/{num}"
|
||||
|
|
|
@ -552,6 +552,16 @@
|
|||
"support_new_title" = "Enter the topic of your ticket";
|
||||
"support_new_content" = "Describe the issue or suggestion";
|
||||
|
||||
"support_rate_good_answer" = "This is good answer";
|
||||
"support_rate_bad_answer" = "This is bad answer";
|
||||
"support_good_answer_user" = "You have left a positive feedback.";
|
||||
"support_bad_answer_user" = "You have left a negative feedback.";
|
||||
"support_good_answer_agent" = "User left a positive feedback.";
|
||||
"support_bad_answer_agent" = "User left a negative feedback.";
|
||||
"support_rated_good" = "You have left a positive feedback about the answer.";
|
||||
"support_rated_bad" = "You have left a negative feedback about the answer.";
|
||||
"wrong_parameters" = "Неверные параметры запроса.";
|
||||
|
||||
"comment" = "Comment";
|
||||
"sender" = "Sender";
|
||||
|
||||
|
|
|
@ -583,6 +583,9 @@
|
|||
"support_bad_answer_user" = "Вы оставили негативный отзыв.";
|
||||
"support_good_answer_agent" = "Пользователь оставил положительный отзыв";
|
||||
"support_bad_answer_agent" = "Пользователь оставил негативный отзыв";
|
||||
"support_rated_good" = "Вы оставили положительный отзыв об ответе.";
|
||||
"support_rated_bad" = "Вы оставили негативный отзыв об ответе.";
|
||||
"wrong_parameters" = "Неверные параметры запроса.";
|
||||
|
||||
"comment" = "Комментарий";
|
||||
"sender" = "Отправитель";
|
||||
|
|
Loading…
Reference in a new issue