Fixing templates

This commit is contained in:
Dennis Eichhorn 2016-12-07 18:59:40 +01:00
parent 51c5c5ef58
commit f0b4c471b3
2 changed files with 10 additions and 7 deletions

View File

@ -26,6 +26,7 @@ use phpOMS\Message\RequestAbstract;
use phpOMS\Message\ResponseAbstract;
use phpOMS\Module\ModuleAbstract;
use phpOMS\Module\WebInterface;
use phpOMS\Utils\Parser\Markdown\Markdown;
use phpOMS\Views\View;
/**
@ -206,13 +207,15 @@ class Controller extends ModuleAbstract implements WebInterface
return;
}
$mardkownParser = new Markdown();
$newsArticle = new NewsArticle();
$newsArticle->setCreatedBy($request->getAccount());
$newsArticle->setCreatedAt(new \DateTime('now'));
$newsArticle->setPublish(new \DateTime($request->getData('publish') ?? false));
$newsArticle->setTitle($request->getData('title') ?? '');
$newsArticle->setPlain($request->getData('plain') ?? '');
$newsArticle->setContent($request->getData('content') ?? '');
$newsArticle->setContent($mardkownParser->parse($request->getData('plain') ?? ''));
$newsArticle->setLanguage(strtolower($request->getData('lang') ?? $request->getL11n()->getLanguage()));
$newsArticle->setType((int) ($request->getData('type') ?? 1));
$newsArticle->setStatus((int) ($request->getData('status') ?? 1));

View File

@ -24,7 +24,7 @@ echo $this->getData('nav')->render(); ?>
<section class="wf-25 floatLeft">
<section class="box w-100">
<div class="inner">
<form id="newsForm" method="POST" action="<?= \phpOMS\Uri\UriFactory::build('/{/lang}/api/news?csrf={$CSRF}'); ?>">
<form id="docForm" method="POST" action="<?= \phpOMS\Uri\UriFactory::build('/{/lang}/api/news?csrf={$CSRF}'); ?>">
<table class="layout wf-100">
<tr><td colspan="2"><label for="publish"><?= $this->getText('Status') ?></label>
<tr><td colspan="2"><select name="status">
@ -41,9 +41,9 @@ echo $this->getData('nav')->render(); ?>
<div class="inner">
<table class="layout wf-100">
<tr><td colspan="2"><label><?= $this->getText('Type') ?></label>
<tr><td colspan="2"><span class="radio"><input type="radio" name="type" form="newsForm" value="<?= Modules\News\Models\NewsType::ARTICLE; ?>" id="news" checked><label for="news"><?= $this->getText('News') ?></label></span>
<tr><td colspan="2"><span class="radio"><input type="radio" name="type" form="newsForm" value="<?= Modules\News\Models\NewsType::HEADLINE; ?>" id="headline"><label for="headline"><?= $this->getText('Headline') ?></label></span>
<tr><td colspan="2"><span class="radio"><input type="radio" name="type" form="newsForm" value="<?= Modules\News\Models\NewsType::LINK; ?>" id="link"><label for="link"><?= $this->getText('Link') ?></label></span>
<tr><td colspan="2"><span class="radio"><input type="radio" name="type" form="docForm" value="<?= Modules\News\Models\NewsType::ARTICLE; ?>" id="news" checked><label for="news"><?= $this->getText('News') ?></label></span>
<tr><td colspan="2"><span class="radio"><input type="radio" name="type" form="docForm" value="<?= Modules\News\Models\NewsType::HEADLINE; ?>" id="headline"><label for="headline"><?= $this->getText('Headline') ?></label></span>
<tr><td colspan="2"><span class="radio"><input type="radio" name="type" form="docForm" value="<?= Modules\News\Models\NewsType::LINK; ?>" id="link"><label for="link"><?= $this->getText('Link') ?></label></span>
</table>
</div>
</section>
@ -51,7 +51,7 @@ echo $this->getData('nav')->render(); ?>
<div class="inner">
<table class="layout wf-100">
<tr><td><label for="permission"><?= $this->getText('Permissions') ?></label>
<tr><td><span class="input"><button type="button" formaction=""><i class="fa fa-book"></i></button><input type="text" id="permission"><input type="hidden" form="newsForm" name="permission"></span>
<tr><td><span class="input"><button type="button" formaction=""><i class="fa fa-book"></i></button><input type="text" id="permission"><input type="hidden" form="docForm" name="permission"></span>
<tr><td><button><?= $this->getText('Add', 0, 0) ?></button>
</table>
</div>
@ -60,7 +60,7 @@ echo $this->getData('nav')->render(); ?>
<div class="inner">
<table class="layout wf-100">
<tr><td colspan="2"><label for="groups"><?= $this->getText('Groups') ?></label>
<tr><td><span class="input"><button type="button" formaction=""><i class="fa fa-book"></i></button><input type="text" id="groups"><input type="hidden" form="newsForm" name="groups"></span>
<tr><td><span class="input"><button type="button" formaction=""><i class="fa fa-book"></i></button><input type="text" id="groups"><input type="hidden" form="docForm" name="groups"></span>
<tr><td><button><?= $this->getText('Add', 0, 0) ?></button>
</table>
</div>