Render values in editor

This commit is contained in:
Dennis Eichhorn 2019-02-16 19:39:43 +01:00
parent c2d051357a
commit 4548d11c3e
5 changed files with 101 additions and 12 deletions

View File

@ -128,6 +128,9 @@ final class BackendController extends Controller
$view->addData('nav', $this->app->moduleManager->get('Navigation')->createNavigationMid(1005301001, $request, $response));
$view->addData('doc', $doc);
$editor = new \Modules\Editor\Theme\Backend\Components\Editor\BaseView($this->app, $request, $response);
$view->addData('editor', $editor);
return $view;
}
}

View File

@ -30,9 +30,11 @@ use phpOMS\Views\View;
*/
class TextView extends View
{
private $id = '';
private $name = '';
private $form = '';
private $id = '';
private $name = '';
private $form = '';
private $plain = '';
private $preview = '';
/**
* {@inheritdoc}
@ -58,14 +60,26 @@ class TextView extends View
return $this->form;
}
public function getPreview() : string
{
return $this->preview;
}
public function getPlain() : string
{
return $this->plain;
}
/**
* {@inheritdoc}
*/
public function render(...$data) : string
{
$this->id = $data[0] ?? '';
$this->name = $data[1] ?? '';
$this->form = $data[2] ?? '';
$this->id = $data[0] ?? '';
$this->name = $data[1] ?? '';
$this->form = $data[2] ?? '';
$this->plain = $data[3] ?? '';
$this->preview = $data[4] ?? '';
return parent::render();
}

View File

@ -6,12 +6,20 @@
<div class="tab-content">
<input type="radio" id="<?= $this->printHtml($this->getId()); ?>-c-tab-1" name="tabular-1" checked>
<div class="tab">
<textarea style="height: 300px" placeholder="&#xf040;" name="<?= $this->printHtml($this->getName()); ?>" form="<?= $this->printHtml($this->getForm()); ?>"><?= $this->printHtml(isset($doc) ? $doc->getPlain() : ''); ?></textarea><input type="hidden" id="<?= $this->printHtml($this->getId()); ?>-parsed">
<textarea
style="height: 300px"
placeholder="&#xf040;"
name="<?= $this->printHtml($this->getName()); ?>"
form="<?= $this->printHtml($this->getForm()); ?>">
<?= $this->printHtml($this->getPlain()); ?>
</textarea><input type="hidden" id="<?= $this->printHtml($this->getId()); ?>-parsed">
</div>
<input type="radio" id="<?= $this->printHtml($this->getId()); ?>-c-tab-2" name="tabular-1">
<div class="tab">
<?= $this->printHtml(isset($doc) ? $doc->getContent() : ''); ?>
<section class="box wf-100">
<article><?= $this->getPreview(); ?></article>
</section>
</div>
</div>
</div>

View File

@ -4,7 +4,7 @@
*
* PHP Version 7.2
*
* @package TBD
* @package Modules\Editor
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @version 1.0.0

View File

@ -1,9 +1,73 @@
<?= $this->getData('nav')->render(); ?>
<?php
/**
* Orange Management
*
* PHP Version 7.2
*
* @package Modules\Editor
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @version 1.0.0
* @link http://website.orange-management.de
*/
/**
* @var \phpOMS\Views\View $this
*/
$doc = $this->getData('doc');
echo $this->getData('nav')->render(); ?>
<div class="row">
<div class="col-xs-12">
<section class="box wf-100">
<article><?= $this->getData('doc')->getContent(); ?></article>
<div class="inner">
<form id="fEditor" method="POST" action="<?= \phpOMS\Uri\UriFactory::build('{/lang}/api/editor?{?}&csrf={$CSRF}'); ?>">
<div class="ipt-wrap">
<div class="ipt-first"><input name="title" type="text" class="wf-100" value="<?= $doc->getTitle(); ?>"></div>
<div class="ipt-second"><input type="submit" value="<?= $this->getHtml('Save') ?>"></div>
</div>
</form>
</div>
</section>
</div>
</div>
</div>
<div class="row">
<div class="col-xs-12">
<section class="box wf-100">
<div class="inner">
<?= $this->getData('editor')->render('editor'); ?>
</div>
</section>
</div>
</div>
<div class="row">
<div class="box col-xs-12">
<?= $this->getData('editor')->getData('text')->render(
'editor',
'plain',
'fEditor',
$doc->getPlain(),
$doc->getContent()
); ?>
</div>
</div>
<div class="row">
<div class="col-xs-12">
<section class="box wf-100">
<div class="inner">
<form>
<table class="layout">
<tr><td colspan="2"><label><?= $this->getHtml('Permission'); ?></label>
<tr><td><select>
<option>
</select>
<tr><td colspan="2"><label><?= $this->getHtml('GroupUser'); ?></label>
<tr><td><input id="iPermission" name="group" type="text" placeholder="&#xf084;"><td><button><?= $this->getHtml('Add'); ?></button>
</table>
</form>
</div>
</section>
</div>
</div>