Media list implemented

This commit is contained in:
Dennis Eichhorn 2015-12-21 19:47:35 +01:00
parent 93387702f0
commit e3080fd299
2 changed files with 40 additions and 3 deletions

View File

@ -95,7 +95,8 @@ class Controller extends ModuleAbstract implements WebInterface
], ],
'^.*/api/media/collection.*$' => [['dest' => '\Modules\Media\Controller:apiCollectionCreate', 'method' => 'POST', '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],], '^.*/api/media$' => [['dest' => '\Modules\Media\Controller:apiMediaUpload', 'method' => 'POST', 'type' => ViewLayout::NULL],],
'^.*/api/media/create.*$' => [['dest' => '\Modules\Media\Controller:apiMediaCreate', 'method' => 'POST', 'type' => ViewLayout::NULL],],
]; ];
/** /**
@ -171,6 +172,23 @@ class Controller extends ModuleAbstract implements WebInterface
$response->set($request->__toString(), [['uploads' => $uploads, 'type' => 'UI']]); $response->set($request->__toString(), [['uploads' => $uploads, 'type' => 'UI']]);
} }
/**
* Shows api content.
*
* @param RequestAbstract $request Request
* @param ResponseAbstract $response Response
* @param mixed $data Generic data
*
* @return void
*
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
public function apiMediaCreate(RequestAbstract $request, ResponseAbstract $response, $data = null)
{
// todo: change database entry for files if has write permission
}
/** /**
* @param array $files Files * @param array $files Files
* @param int $account Uploader * @param int $account Uploader

View File

@ -17,9 +17,22 @@
* @var \phpOMS\Views\View $this * @var \phpOMS\Views\View $this
*/ */
$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')
);
$footerView = new \Web\Views\Lists\PaginationView($this->app, $this->request, $this->response); $footerView = new \Web\Views\Lists\PaginationView($this->app, $this->request, $this->response);
$footerView->setTemplate('/Web/Templates/Lists/Footer/PaginationBig'); $footerView->setTemplate('/Web/Templates/Lists/Footer/PaginationBig');
$footerView->setPages(20); $footerView->setPages(count($media) / 25);
$footerView->setPage(1); $footerView->setPage(1);
echo $this->getData('nav')->render(); ?> echo $this->getData('nav')->render(); ?>
@ -37,7 +50,13 @@ echo $this->getData('nav')->render(); ?>
<tr> <tr>
<td colspan="3"><?= $footerView->render(); ?> <td colspan="3"><?= $footerView->render(); ?>
<tbody> <tbody>
<?php $count = 0; foreach([] as $key => $value) : $count++; ?> <?php $count = 0; foreach($media as $key => $value) : $count++; ?>
<tr>
<td><?= $value->getName(); ?>
<td><?= $value->getExtension(); ?>
<td><?= $value->getSize(); ?>
<td><?= $value->getCreatedBy(); ?>
<td><?= $value->getCreatedAt()->format('Y-m-d H:i:s'); ?>
<?php endforeach; ?> <?php endforeach; ?>
<?php if($count === 0) : ?> <?php if($count === 0) : ?>
<tr><td colspan="5" class="empty"><?= $this->l11n->lang[0]['Empty']; ?> <tr><td colspan="5" class="empty"><?= $this->l11n->lang[0]['Empty']; ?>