mirror of
https://github.com/Karaka-Management/oms-Editor.git
synced 2026-01-11 17:18:42 +00:00
draft directory usage based on media collections
This commit is contained in:
parent
e464e6122c
commit
122ffcd7b9
|
|
@ -23,6 +23,7 @@ use phpOMS\Message\Http\RequestStatusCode;
|
|||
use phpOMS\Message\RequestAbstract;
|
||||
use phpOMS\Message\ResponseAbstract;
|
||||
use phpOMS\Views\View;
|
||||
use Modules\Media\Models\CollectionMapper;
|
||||
|
||||
/**
|
||||
* Calendar controller class.
|
||||
|
|
@ -99,6 +100,13 @@ final class BackendController extends Controller
|
|||
$view->setTemplate('/Modules/Editor/Theme/Backend/editor-list');
|
||||
$view->addData('nav', $this->app->moduleManager->get('Navigation')->createNavigationMid(1005301001, $request, $response));
|
||||
|
||||
$path = (string) ($request->getData('path') ?? '/');
|
||||
$collection = CollectionMapper::getByVirtualPath(\str_replace('+', ' ', $path));
|
||||
$parent = CollectionMapper::getParentCollection(\str_replace('+', ' ', $path));
|
||||
|
||||
$view->addData('collections', $collection);
|
||||
$view->addData('path', $path);
|
||||
|
||||
if ($request->getData('ptype') === 'p') {
|
||||
$view->setData('docs',
|
||||
EditorDocMapper::withConditional('language', $response->getHeader()->getL11n()->getLanguage())
|
||||
|
|
|
|||
|
|
@ -20,12 +20,43 @@ use phpOMS\Uri\UriFactory;
|
|||
*/
|
||||
$docs = $this->getData('docs');
|
||||
|
||||
/** @var \Modules\Media\Models\Collection[] */
|
||||
$collections = $this->getData('collections');
|
||||
|
||||
$mediaPath = \urldecode($this->getData('path') ?? '/');
|
||||
|
||||
$previous = empty($docs) ? '{/prefix}editor/list' : '{/prefix}editor/list?{?}&id=' . \reset($docs)->getId() . '&ptype=p';
|
||||
$next = empty($docs) ? '{/prefix}editor/list' : '{/prefix}editor/list?{?}&id=' . \end($docs)->getId() . '&ptype=n';
|
||||
|
||||
$docs = $this->getData('docs');
|
||||
|
||||
echo $this->getData('nav')->render(); ?>
|
||||
<div class="row">
|
||||
<div class="col-xs-12">
|
||||
<div class="box">
|
||||
<ul class="crumbs-2">
|
||||
<li data-href="<?= UriFactory::build('{/prefix}editor/list?path=/'); ?>"><a href="<?= UriFactory::build('{/prefix}editor/list?path=/'); ?>">/</a></li>
|
||||
<?php
|
||||
$subPath = '';
|
||||
$paths = \explode('/', \ltrim($mediaPath, '/'));
|
||||
$length = \count($paths);
|
||||
|
||||
for ($i = 0; $i < $length; ++$i) :
|
||||
if ($paths[$i] === '') {
|
||||
continue;
|
||||
}
|
||||
|
||||
$subPath .= '/' . $paths[$i];
|
||||
|
||||
$url = UriFactory::build('{/prefix}editor/list?path=' . $subPath);
|
||||
?>
|
||||
<li data-href="<?= $url; ?>"<?= $i === $length - 1 ? 'class="active"' : ''; ?>><a href="<?= $url; ?>"><?= $this->printHtml($paths[$i]); ?></a></li>
|
||||
<?php endfor; ?>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-xs-12">
|
||||
<div class="portlet">
|
||||
|
|
@ -33,13 +64,24 @@ echo $this->getData('nav')->render(); ?>
|
|||
<table class="default">
|
||||
<thead>
|
||||
<tr>
|
||||
<td>
|
||||
<td class="wf-100"><?= $this->getHtml('Title'); ?>
|
||||
<td><?= $this->getHtml('Creator'); ?>
|
||||
<td><?= $this->getHtml('Created'); ?>
|
||||
<tbody>
|
||||
<?php $count = 0; foreach ($docs as $key => $value) : ++$count;
|
||||
<?php $count = 0; foreach ($collections as $key => $value) : ++$count;
|
||||
$url = UriFactory::build('{/prefix}editor/list?path=' . \rtrim($value->getVirtualPath(), '/') . '/' . $value->getName());
|
||||
?>
|
||||
<tr data-href="<?= $url; ?>">
|
||||
<td><a href="<?= $url; ?>"><i class="fa fa-folder-o"></i></a>
|
||||
<td><a href="<?= $url; ?>"><?= $this->printHtml($value->getName()); ?></a>
|
||||
<td><a href="<?= $url; ?>"><?= $this->printHtml($value->getCreatedBy()->getName1()); ?></a>
|
||||
<td><a href="<?= $url; ?>"><?= $this->printHtml($value->getCreatedAt()->format('Y-m-d')); ?></a>
|
||||
<?php endforeach; ?>
|
||||
<?php foreach ($docs as $key => $value) : ++$count;
|
||||
$url = UriFactory::build('{/prefix}editor/single?{?}&id=' . $value->getId()); ?>
|
||||
<tr tabindex="0" data-href="<?= $url; ?>">
|
||||
<td><i class="fa fa-file-o"></i>
|
||||
<td data-label="<?= $this->getHtml('Title'); ?>"><a href="<?= $url; ?>"><?= $this->printHtml($value->getTitle()); ?></a>
|
||||
<td data-label="<?= $this->getHtml('Creator'); ?>"><a href="<?= $url; ?>"><?= $this->printHtml($value->getCreatedBy()->getName1()); ?></a>
|
||||
<td data-label="<?= $this->getHtml('Created'); ?>"><a href="<?= $url; ?>"><?= $this->printHtml($value->getCreatedAt()->format('Y-m-d H:i:s')); ?></a>
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user