mirror of
https://github.com/Karaka-Management/oms-Media.git
synced 2026-02-08 13:38:42 +00:00
Templating
This commit is contained in:
parent
0223c353e4
commit
f7843d534c
|
|
@ -108,6 +108,7 @@ class Controller extends ModuleAbstract implements WebInterface
|
|||
['dest' => '\Modules\Media\Controller:setUpFileUploader', 'method' => 'GET', 'type' => ViewLayout::NULL],
|
||||
['dest' => '\Modules\Media\Controller:viewMediaCreate', 'method' => 'GET', 'type' => ViewLayout::MAIN],
|
||||
],
|
||||
'^.*/backend/media/single.*$' => [['dest' => '\Modules\Media\Controller:viewMediaSingle', 'method' => 'GET', 'type' => ViewLayout::MAIN],],
|
||||
|
||||
'^.*/api/media/collection.*$' => [['dest' => '\Modules\Media\Controller:apiCollectionCreate', 'method' => 'POST', 'type' => ViewLayout::MAIN],],
|
||||
'^.*/api/media$' => [['dest' => '\Modules\Media\Controller:apiMediaUpload', 'method' => 'POST', 'type' => ViewLayout::NULL],],
|
||||
|
|
@ -149,6 +150,28 @@ class Controller extends ModuleAbstract implements WebInterface
|
|||
return $view;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param RequestAbstract $request Request
|
||||
* @param ResponseAbstract $response Response
|
||||
* @param mixed $data Generic data
|
||||
*
|
||||
* @return RenderableInterface
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function viewMediaSingle(RequestAbstract $request, ResponseAbstract $response, $data = null) : RenderableInterface
|
||||
{
|
||||
$view = new View($this->app, $request, $response);
|
||||
$view->setTemplate('/Modules/Media/Theme/Backend/media-single');
|
||||
$view->addData('nav', $this->app->moduleManager->get('Navigation')->createNavigationMid(1000401001, $request, $response));
|
||||
|
||||
$mediaMapper = new MediaMapper($this->app->dbPool->get());
|
||||
$view->addData('media', $mediaMapper->get($request->getData('id')));
|
||||
|
||||
return $view;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param RequestAbstract $request Request
|
||||
* @param ResponseAbstract $response Response
|
||||
|
|
|
|||
|
|
@ -18,17 +18,7 @@
|
|||
*/
|
||||
|
||||
$mediaMapper = new \Modules\Media\Models\MediaMapper($this->app->dbPool->get());
|
||||
$media = $mediaMapper
|
||||
->listResults(
|
||||
$mediaMapper
|
||||
->find('media.media_id',
|
||||
'media.media_name',
|
||||
'media.media_extension',
|
||||
'media.media_size',
|
||||
'media.media_created_at',
|
||||
'media.media_created_by')
|
||||
//->newest('reporter_template.reporter_template_created')
|
||||
);
|
||||
$media = $mediaMapper->getNewest(25);
|
||||
|
||||
$footerView = new \Web\Views\Lists\PaginationView($this->app, $this->request, $this->response);
|
||||
$footerView->setTemplate('/Web/Templates/Lists/Footer/PaginationBig');
|
||||
|
|
@ -50,13 +40,14 @@ echo $this->getData('nav')->render(); ?>
|
|||
<tr>
|
||||
<td colspan="3"><?= $footerView->render(); ?>
|
||||
<tbody>
|
||||
<?php $count = 0; foreach($media as $key => $value) : $count++; ?>
|
||||
<?php $count = 0; foreach($media as $key => $value) : $count++;
|
||||
$url = \phpOMS\Uri\UriFactory::build('/{/lang}/backend/media/single?id=' . $value->getId()); ?>
|
||||
<tr>
|
||||
<td><?= $value->getName(); ?>
|
||||
<td><?= $value->getExtension(); ?>
|
||||
<td><?= $value->getSize(); ?>
|
||||
<td><?= $value->getCreatedBy(); ?>
|
||||
<td><?= $value->getCreatedAt()->format('Y-m-d H:i:s'); ?>
|
||||
<td><a href="<?= $url; ?>"><?= $value->getName(); ?></a>
|
||||
<td><a href="<?= $url; ?>"><?= $value->getExtension(); ?></a>
|
||||
<td><a href="<?= $url; ?>"><?= $value->getSize(); ?></a>
|
||||
<td><a href="<?= $url; ?>"><?= $value->getCreatedBy(); ?></a>
|
||||
<td><a href="<?= $url; ?>"><?= $value->getCreatedAt()->format('Y-m-d H:i:s'); ?></a>
|
||||
<?php endforeach; ?>
|
||||
<?php if($count === 0) : ?>
|
||||
<tr><td colspan="5" class="empty"><?= $this->l11n->lang[0]['Empty']; ?>
|
||||
|
|
|
|||
|
|
@ -13,76 +13,20 @@
|
|||
* @version 1.0.0
|
||||
* @link http://orange-management.com
|
||||
*/
|
||||
/** @noinspection PhpUndefinedMethodInspection */
|
||||
\phpOMS\Module\ModuleFactory::$loaded['Navigation']->call([\Modules\Navigation\Models\NavigationType::CONTENT,
|
||||
1000401001,]);
|
||||
/**
|
||||
* @var \phpOMS\Views\View $this
|
||||
*/
|
||||
$media = $this->getData('media');
|
||||
echo $this->getData('nav')->render();
|
||||
?>
|
||||
|
||||
<div class="b b-3 c4-2 c4" id="i4-2-1">
|
||||
<h1>
|
||||
<?= $this->app->accountManager->get($request->getAccount())->getL11n()->lang['Media']['Preview']; ?>
|
||||
<i class="fa fa-minus min"></i>
|
||||
<i class="fa fa-plus max vh"></i>
|
||||
</h1>
|
||||
|
||||
<div class="bc-1">
|
||||
<section class="box w-100">
|
||||
<h1><?= $media->getName() ?></h1>
|
||||
<div class="inner">
|
||||
<?php if(in_array($media->getExtension(), ['gif', 'bmp', 'jpg', 'jpeg', 'png'])) : ?>
|
||||
<img src="<?= $media->getPath(); ?>">
|
||||
<?php else : ?>
|
||||
<pre><?= htmlspecialchars(file_get_contents(ROOT_PATH . '/' . $media->getPath())); ?></pre>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="b b-1 c4-2 c4" id="i4-2-2">
|
||||
<h1>
|
||||
<?= $this->app->accountManager->get($request->getAccount())->getL11n()->lang['Media']['Data']; ?>
|
||||
<i class="fa fa-minus min"></i>
|
||||
<i class="fa fa-plus max vh"></i>
|
||||
</h1>
|
||||
|
||||
<div class="bc-1">
|
||||
<!-- @formatter:off -->
|
||||
<table class="tc-1">
|
||||
<tr>
|
||||
<th><label><?= $this->app->accountManager->get($request->getAccount())->getL11n()->lang['Media']['Name']; ?></label>
|
||||
<td><?= $media->getName(); ?>
|
||||
<tr>
|
||||
<th><label><?= $this->app->accountManager->get($request->getAccount())->getL11n()->lang['Media']['Extension']; ?></label>
|
||||
<td><?= $media->getExtension(); ?>
|
||||
<tr>
|
||||
<th><label><?= $this->app->accountManager->get($request->getAccount())->getL11n()->lang['Media']['Size']; ?></label>
|
||||
<td><?= \phpOMS\Utils\Converter\File::byteSizeToString($media->getSize()); ?>
|
||||
<tr>
|
||||
<th><label><?= $this->app->accountManager->get($request->getAccount())->getL11n()->lang['Media']['Author']; ?></label>
|
||||
<td><?= $media->getAuthor(); ?>
|
||||
<tr>
|
||||
<th><label><?= $this->app->accountManager->get($request->getAccount())->getL11n()->lang['Media']['Created']; ?></label>
|
||||
<td><?= $media->getCreated()->format('Y-m-d H:i:s'); ?>
|
||||
<tr>
|
||||
<th><label><?= $this->app->accountManager->get($request->getAccount())->getL11n()->lang['Media']['Changed']; ?></label>
|
||||
<td>asldkf
|
||||
<tr>
|
||||
<th><label><?= $this->app->accountManager->get($request->getAccount())->getL11n()->lang['Media']['Changedby']; ?></label>
|
||||
<td>asldkf
|
||||
</table>
|
||||
<!-- @formatter:on -->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="b b-1 c4-2 c4" id="i4-2-2">
|
||||
<h1>
|
||||
<?= $this->app->accountManager->get($request->getAccount())->getL11n()->lang['Media']['Settings']; ?>
|
||||
<i class="fa fa-minus min"></i>
|
||||
<i class="fa fa-plus max vh"></i>
|
||||
</h1>
|
||||
|
||||
<div class="bc-1">
|
||||
<ul class="l-1">
|
||||
<li>
|
||||
<label><?= $this->app->accountManager->get($request->getAccount())->getL11n()->lang['Media']['Visibility']; ?></label>
|
||||
<li><input type="text">
|
||||
<button><?= $this->app->accountManager->get($request->getAccount())->getL11n()->lang[0]['Add']; ?></button>
|
||||
<li>
|
||||
<label><?= $this->app->accountManager->get($request->getAccount())->getL11n()->lang['Media']['Editability']; ?></label>
|
||||
<li><input type="text">
|
||||
<button><?= $this->app->accountManager->get($request->getAccount())->getL11n()->lang[0]['Add']; ?>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user