mirror of
https://github.com/openvk/openvk
synced 2024-11-14 02:59:12 +03:00
Support: Add ability to modify FAQ
This commit is contained in:
parent
f8c0071227
commit
91d852e071
6 changed files with 42 additions and 9 deletions
|
@ -28,6 +28,41 @@ final class SupportPresenter extends OpenVKPresenter
|
||||||
$this->assertUserLoggedIn();
|
$this->assertUserLoggedIn();
|
||||||
$this->template->mode = in_array($this->queryParam("act"), ["faq", "new", "list"]) ? $this->queryParam("act") : "faq";
|
$this->template->mode = in_array($this->queryParam("act"), ["faq", "new", "list"]) ? $this->queryParam("act") : "faq";
|
||||||
|
|
||||||
|
if($this->template->mode === "faq") {
|
||||||
|
$lang = Session::i()->get("lang", "ru");
|
||||||
|
$base = OPENVK_ROOT . "/data/knowledgebase/faq";
|
||||||
|
if(file_exists("$base.$lang.md"))
|
||||||
|
$file = "$base.$lang.md";
|
||||||
|
else if(file_exists("$base.md"))
|
||||||
|
$file = "$base.md";
|
||||||
|
else
|
||||||
|
$file = NULL;
|
||||||
|
|
||||||
|
if(is_null($file)) {
|
||||||
|
$this->template->faq = [];
|
||||||
|
} else {
|
||||||
|
$lines = file($file);
|
||||||
|
$faq = [];
|
||||||
|
$index = 0;
|
||||||
|
|
||||||
|
foreach($lines as $line) {
|
||||||
|
if(strpos($line, "# ") === 0)
|
||||||
|
++$index;
|
||||||
|
|
||||||
|
$faq[$index][] = $line;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->template->faq = array_map(function($section) {
|
||||||
|
$title = substr($section[0], 2);
|
||||||
|
array_shift($section);
|
||||||
|
return [
|
||||||
|
$title,
|
||||||
|
(new Parsedown())->text(implode("\n", $section))
|
||||||
|
];
|
||||||
|
}, $faq);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$this->template->count = $this->tickets->getTicketsCountByUserId($this->user->id);
|
$this->template->count = $this->tickets->getTicketsCountByUserId($this->user->id);
|
||||||
if($this->template->mode === "list") {
|
if($this->template->mode === "list") {
|
||||||
$this->template->page = (int) ($this->queryParam("p") ?? 1);
|
$this->template->page = (int) ($this->queryParam("p") ?? 1);
|
||||||
|
|
|
@ -51,9 +51,9 @@
|
||||||
|
|
||||||
{if $isMain}
|
{if $isMain}
|
||||||
<h4>{_support_faq}</h4><br />
|
<h4>{_support_faq}</h4><br />
|
||||||
<div class="faq">
|
<div n:foreach="$faq as $section" class="faq">
|
||||||
<div id="faqhead">{_support_faq_title}</div>
|
<div id="faqhead">{$section[0]}</div>
|
||||||
<div id="faqcontent">{_support_faq_content}</div>
|
<div id="faqcontent">{$section[1]|noescape}</div>
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
|
|
2
data/knowledgebase/faq.md
Normal file
2
data/knowledgebase/faq.md
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
# Who is this website for?
|
||||||
|
The site is designed to find friends and acquaintances, as well as view user data. It is like a city directory, through which people can quickly find relevant information about a person.
|
2
data/knowledgebase/faq.ru.md
Normal file
2
data/knowledgebase/faq.ru.md
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
# Для кого этот сайт?
|
||||||
|
Сайт предназначен для поиска друзей и знакомых, а также для просмотра данных пользователя. Это как справочник города, с помощью которого люди могут быстро найти актуальную информацию о человеке.
|
|
@ -665,9 +665,6 @@
|
||||||
"support_list" = "List of tickets";
|
"support_list" = "List of tickets";
|
||||||
"support_new" = "New ticket";
|
"support_new" = "New ticket";
|
||||||
|
|
||||||
"support_faq_title" = "Who is this website for?";
|
|
||||||
"support_faq_content" = "The site is designed to find friends and acquaintances, as well as view user data. It is like a city directory, through which people can quickly find relevant information about a person.";
|
|
||||||
|
|
||||||
"support_new_title" = "Enter the topic of your ticket";
|
"support_new_title" = "Enter the topic of your ticket";
|
||||||
"support_new_content" = "Describe the issue or suggestion";
|
"support_new_content" = "Describe the issue or suggestion";
|
||||||
|
|
||||||
|
|
|
@ -702,9 +702,6 @@
|
||||||
"support_list" = "Список обращений";
|
"support_list" = "Список обращений";
|
||||||
"support_new" = "Новое обращение";
|
"support_new" = "Новое обращение";
|
||||||
|
|
||||||
"support_faq_title" = "Для кого этот сайт?";
|
|
||||||
"support_faq_content" = "Сайт предназначен для поиска друзей и знакомых, а также для просмотра данных пользователя. Это как справочник города, с помощью которого люди могут быстро найти актуальную информацию о человеке.";
|
|
||||||
|
|
||||||
"support_new_title" = "Введите тему вашего обращения";
|
"support_new_title" = "Введите тему вашего обращения";
|
||||||
"support_new_content" = "Опишите проблему или предложение";
|
"support_new_content" = "Опишите проблему или предложение";
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue