From f30ea8f7815d21a8e2edb0266964d722c9a22dfd Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Wed, 3 Jun 2020 21:33:40 +0200 Subject: [PATCH] fix/impl edit button --- Controller/BackendController.php | 6 ++++++ Theme/Backend/news-single.tpl.php | 25 +++++++++++++++++++++---- 2 files changed, 27 insertions(+), 4 deletions(-) diff --git a/Controller/BackendController.php b/Controller/BackendController.php index 17efb8e..0ac8310 100644 --- a/Controller/BackendController.php +++ b/Controller/BackendController.php @@ -121,6 +121,12 @@ final class BackendController extends Controller implements DashboardElementInte $view->setTemplate('/Modules/News/Theme/Backend/news-single'); $view->addData('nav', $this->app->moduleManager->get('Navigation')->createNavigationMid(1000701001, $request, $response)); $view->addData('news', $article); + $view->addData('editable', $this->app->accountManager->get($accountId)->hasPermission( + PermissionType::MODIFY, $this->app->orgId, $this->app->appName, self::MODULE_NAME, PermissionState::NEWS, $article->getId()) + ); + + $t = $this->app->accountManager->get($accountId)->hasPermission( + PermissionType::MODIFY, $this->app->orgId, $this->app->appName, self::MODULE_NAME, PermissionState::NEWS, $article->getId()); return $view; } diff --git a/Theme/Backend/news-single.tpl.php b/Theme/Backend/news-single.tpl.php index 93a1eaf..1e40b05 100644 --- a/Theme/Backend/news-single.tpl.php +++ b/Theme/Backend/news-single.tpl.php @@ -12,12 +12,21 @@ */ declare(strict_types=1); +use phpOMS\Account\PermissionType; + +/** + * @var \Modules\News\Models\NewsArticle $news + */ +$news = $this->getData('news'); + +/** + * @var bool $editable + */ +$editable = $this->getData('editable'); + /** * @var \phpOMS\Views\View $this */ - -$news = $this->getData('news'); - echo $this->getData('nav')->render(); ?>
@@ -28,4 +37,12 @@ echo $this->getData('nav')->render(); ?>
-
\ No newline at end of file + + + +
+
+ Edit +
+
+