fix/impl edit button

This commit is contained in:
Dennis Eichhorn 2020-06-03 21:33:40 +02:00
parent 54950a0a4b
commit f30ea8f781
2 changed files with 27 additions and 4 deletions

View File

@ -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;
}

View File

@ -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(); ?>
<div class="row">
<div class="col-xs-12">
@ -28,4 +37,12 @@ echo $this->getData('nav')->render(); ?>
</article>
</section>
</div>
</div>
</div>
<?php if ($editable) : ?>
<div class="row">
<div class="box">
<a tabindex="0" class="button" href="<?= \phpOMS\Uri\UriFactory::build('{/prefix}news/edit?id=' . $news->getId()); ?>">Edit</a>
</div>
</div>
<?php endif; ?>