From 7f1a5f23546a4b616ac53e49f36af344f408b0ac Mon Sep 17 00:00:00 2001 From: root Date: Sat, 11 Sep 2021 01:33:45 +0300 Subject: [PATCH] User: Now the User's page can be marked as Deceased. And now the user can be Incognito (at least, admins) To mark the page as Deceased, type in field in Database. To be Incognito, type in field. Specially for deceased drbream --- Web/Models/Entities/User.php | 22 ++++++++++++++++++++++ Web/Presenters/OpenVKPresenter.php | 7 +++++-- Web/Presenters/templates/User/View.xml | 3 +++ locales/en.strings | 3 ++- locales/ru.strings | 1 + 5 files changed, 33 insertions(+), 3 deletions(-) diff --git a/Web/Models/Entities/User.php b/Web/Models/Entities/User.php index fe82e30f..e73bfb29 100644 --- a/Web/Models/Entities/User.php +++ b/Web/Models/Entities/User.php @@ -683,6 +683,28 @@ class User extends RowModel return FALSE; } + /** + * 0 - Default status + * 1 - Incognito online status + * 2 - Page of a dead person + */ + function onlineStatus(): int + { + switch ($this->getRecord()->online) { + case 1: + return 1; + break; + + case 2: + return 2; + break; + + default: + return 0; + break; + } + } + use Traits\TSubscribable; } diff --git a/Web/Presenters/OpenVKPresenter.php b/Web/Presenters/OpenVKPresenter.php index 9aedc6fa..e74114ed 100644 --- a/Web/Presenters/OpenVKPresenter.php +++ b/Web/Presenters/OpenVKPresenter.php @@ -196,8 +196,11 @@ abstract class OpenVKPresenter extends SimplePresenter exit; } - $this->user->identity->setOnline(time()); - $this->user->identity->save(); + if ($this->user->identity->onlineStatus() == 0) { + $this->user->identity->setOnline(time()); + $this->user->identity->save(); + } + } setlocale(LC_TIME, ...(explode(";", tr("__locale")))); diff --git a/Web/Presenters/templates/User/View.xml b/Web/Presenters/templates/User/View.xml index 063a2bdf..e18fc1fd 100644 --- a/Web/Presenters/templates/User/View.xml +++ b/Web/Presenters/templates/User/View.xml @@ -40,6 +40,9 @@ {_was_online} {$user->getOnline()} {/if} +
+ {_deceased_person} +
{/block} {block content} diff --git a/locales/en.strings b/locales/en.strings index 8da25c6c..df3c0351 100644 --- a/locales/en.strings +++ b/locales/en.strings @@ -36,13 +36,14 @@ "online" = "Online"; "was_online" = "was online"; "was_online_m" = "was online"; -%{ For male and femail %} +%{ For male and female %} "was_online_f" = "was online"; "all_title" = "All"; "information" = "Information"; "status" = "Status"; "no_information_provided" = "No information provided."; +"deceased_person" = "Deceased person"; "relationship" = "Relationship"; diff --git a/locales/ru.strings b/locales/ru.strings index 9bb4b2c6..6666279c 100644 --- a/locales/ru.strings +++ b/locales/ru.strings @@ -42,6 +42,7 @@ "information" = "Информация"; "status" = "Статус"; "no_information_provided" = "Информация отсутствует."; +"deceased_person" = "Страница покойного человека"; "relationship" = "Семейное положение";