From 47d46c8d01c4163597e503a7a71af11c476c31a1 Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Sun, 22 Mar 2020 17:04:35 +0100 Subject: [PATCH] allow localization modification --- Admin/Routes/Web/Api.php | 14 ++ Models/PermissionState.php | 1 + Theme/Backend/profile-list.tpl.php | 9 +- Theme/Backend/profile-single.tpl.php | 232 ++++++++++++++------------- 4 files changed, 139 insertions(+), 117 deletions(-) diff --git a/Admin/Routes/Web/Api.php b/Admin/Routes/Web/Api.php index eb1c4b7..e158560 100644 --- a/Admin/Routes/Web/Api.php +++ b/Admin/Routes/Web/Api.php @@ -1,5 +1,7 @@ [ + [ + 'dest' => '\Modules\Admin\Controller\ApiController:apiSettingsAccountLocalizationSet', + 'verb' => RouteVerb::SET, + 'permission' => [ + 'module' => AdminApiController::MODULE_NAME, + 'type' => PermissionType::MODIFY, + 'state' => AdminPermissionState::ACCOUNT_SETTINGS, + ], + ], + ], ]; diff --git a/Models/PermissionState.php b/Models/PermissionState.php index f383b65..3591007 100644 --- a/Models/PermissionState.php +++ b/Models/PermissionState.php @@ -27,4 +27,5 @@ use phpOMS\Stdlib\Base\Enum; abstract class PermissionState extends Enum { public const PROFILE = 1; + public const PROFILE_SETTINGS = 2; } diff --git a/Theme/Backend/profile-list.tpl.php b/Theme/Backend/profile-list.tpl.php index badc032..7fb8c3a 100644 --- a/Theme/Backend/profile-list.tpl.php +++ b/Theme/Backend/profile-list.tpl.php @@ -13,6 +13,7 @@ declare(strict_types=1); use phpOMS\Uri\UriFactory; +use Modules\Media\Models\NullMedia; /** * @var \phpOMS\Views\View $this @@ -30,14 +31,18 @@ $next = empty($accounts) ? '{/prefix}profile/list' : '{/prefix}profile/list? - $account) : ++$count; $url = UriFactory::build('{/prefix}profile/single?{?}&id=' . $account->getId()); ?> -
getHtml('ID', '0', '0'); ?> + getHtml('Name') ?> getHtml('Activity') ?>
printHtml($account->getId()); ?> + printHtml($account->getAccount()->getName3() . ' ' . $account->getAccount()->getName2() . ' ' . $account->getAccount()->getName1()); ?> printHtml($account->getAccount()->getLastActive()->format('Y-m-d')); ?> diff --git a/Theme/Backend/profile-single.tpl.php b/Theme/Backend/profile-single.tpl.php index d54baae..122f44d 100644 --- a/Theme/Backend/profile-single.tpl.php +++ b/Theme/Backend/profile-single.tpl.php @@ -57,33 +57,30 @@ echo $this->getData('nav')->render();
-
- getName3()) || !empty($account->getName2())) : ?> - - printHtml(empty($account->getName3()) ? $account->getName2() : $account->getName3()); ?>, - - - printHtml($account->getName1()); ?> - -
-
- - <?= $this->getHtml('ProfileImage'); ?> - +
+ getName3()) || !empty($account->getName2())) : ?> + + printHtml(empty($account->getName3()) ? $account->getName2() : $account->getName3()); ?>, + + + printHtml($account->getName1()); ?> + +
+
+ + <?= $this->getHtml('ProfileImage'); ?> + - -
getHtml('Occupation') ?> - Sailor
getHtml('Birthday') ?> - getBirthday() !== null ? $profile->getBirthday()->format('Y-m-d') : ''; ?> + getDateTime($profile->getBirthday()); ?>
getHtml('Email') ?> printHtml($account->getEmail()); ?> @@ -130,6 +127,9 @@ echo $this->getData('nav')->render(); getHtml(':s' . $account->getStatus(), 'Admin'); ?>
+ request->getHeader()->getAccount() === $account->getId()) : ?> +
+
@@ -160,7 +160,7 @@ echo $this->getData('nav')->render();
-
+
getHtml('Localization'); ?>
@@ -168,39 +168,42 @@ echo $this->getData('nav')->render();
-
-
+
- $code2) : ?>
- $language) : $code = \strtolower(\substr($code, 1)); ?>
- + +
-
+
+ + +
@@ -212,24 +215,24 @@ echo $this->getData('nav')->render();
-
-
-
+
+ -

getHtml('Timeformat'); ?>

-
-
-
-
-
-
-
-
-
-
+

getHtml('Timeformat'); ?>

+
+
+
+
+
+
+
+
+
+
@@ -244,29 +247,28 @@ echo $this->getData('nav')->render();
- $currency) : $code = \substr($code, 1); ?>
-

getHtml('Numberformat'); ?>

-
- +
+
-
getHtml('Weight'); ?>
@@ -274,37 +276,37 @@ echo $this->getData('nav')->render();
-
+
- $weight) : ?>
+
- $weight) : ?>
+
- $weight) : ?>
+
- $weight) : ?>
+
- $weight) : ?>