mirror of
https://github.com/Karaka-Management/oms-Media.git
synced 2026-01-27 00:08:40 +00:00
fid #107
This commit is contained in:
parent
fb61263cf5
commit
5fc41cc996
38
Theme/Backend/Components/Media/BaseView.php
Normal file
38
Theme/Backend/Components/Media/BaseView.php
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
<?php
|
||||
/**
|
||||
* Orange Management
|
||||
*
|
||||
* PHP Version 7.1
|
||||
*
|
||||
* @category TBD
|
||||
* @package TBD
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 1.0
|
||||
* @version 1.0.0
|
||||
* @link http://orange-management.com
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Modules\Media\Theme\Backend\Components\Media;
|
||||
|
||||
use phpOMS\Views\View;
|
||||
use phpOMS\ApplicationAbstract;
|
||||
use phpOMS\Message\RequestAbstract;
|
||||
use phpOMS\Message\ResponseAbstract;
|
||||
|
||||
class BaseView extends View
|
||||
{
|
||||
protected $media = [];
|
||||
|
||||
public function __construct(ApplicationAbstract $app, RequestAbstract $request, ResponseAbstract $response)
|
||||
{
|
||||
parent::__construct($app, $request, $response);
|
||||
$this->setTemplate('/Modules/Media/Theme/Backend/Components/Media/list');
|
||||
}
|
||||
|
||||
public function render(...$data) : string
|
||||
{
|
||||
$this->media = $data[0];
|
||||
return parent::render();
|
||||
}
|
||||
}
|
||||
55
Theme/Backend/Components/Media/list.tpl.php
Normal file
55
Theme/Backend/Components/Media/list.tpl.php
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
<div class="box wf-100">
|
||||
<table class="table blue">
|
||||
<caption><?= $this->getHtml('Media', 'Media') ?></caption>
|
||||
<thead>
|
||||
<td>
|
||||
<td class="wf-100"><?= $this->getHtml('Name', 'Media') ?>
|
||||
<td><?= $this->getHtml('Type', 'Media') ?>
|
||||
<td><?= $this->getHtml('Size', 'Media') ?>
|
||||
<td><?= $this->getHtml('Creator', 'Media') ?>
|
||||
<td><?= $this->getHtml('Created', 'Media') ?>
|
||||
<tfoot>
|
||||
<tbody>
|
||||
<?php $count = 0; foreach($this->media as $key => $value) : $count++;
|
||||
$url = \phpOMS\Uri\UriFactory::build('{/base}/{/lang}/backend/media/single?{?}&id=' . $value->getId());
|
||||
|
||||
$icon = '';
|
||||
$extensionType = \phpOMS\System\File\FileUtils::getExtensionType($value->getExtension());
|
||||
|
||||
if($extensionType === \phpOMS\System\File\ExtensionType::CODE) {
|
||||
$icon = 'file-code-o';
|
||||
} elseif($extensionType === \phpOMS\System\File\ExtensionType::TEXT) {
|
||||
$icon = 'file-text-o';
|
||||
} elseif($extensionType === \phpOMS\System\File\ExtensionType::PRESENTATION) {
|
||||
$icon = 'file-powerpoint-o';
|
||||
} elseif($extensionType === \phpOMS\System\File\ExtensionType::PDF) {
|
||||
$icon = 'file-pdf-o';
|
||||
} elseif($extensionType === \phpOMS\System\File\ExtensionType::ARCHIVE) {
|
||||
$icon = 'file-zip-o';
|
||||
} elseif($extensionType === \phpOMS\System\File\ExtensionType::AUDIO) {
|
||||
$icon = 'file-audio-o';
|
||||
} elseif($extensionType === \phpOMS\System\File\ExtensionType::VIDEO) {
|
||||
$icon = 'file-video-o';
|
||||
} elseif($extensionType === \phpOMS\System\File\ExtensionType::IMAGE) {
|
||||
$icon = 'file-image-o';
|
||||
} elseif($extensionType === \phpOMS\System\File\ExtensionType::SPREADSHEET) {
|
||||
$icon = 'file-excel-o';
|
||||
} elseif($value->getExtension() === 'collection') {
|
||||
$icon = 'folder-open-o';
|
||||
} else {
|
||||
$icon = 'file-o';
|
||||
}
|
||||
?>
|
||||
<tr data-href="<?= $url; ?>">
|
||||
<td><a href="<?= $url; ?>"><i class="fa fa-<?= $this->printHtml($icon); ?>"></i></a>
|
||||
<td><a href="<?= $url; ?>"><?= $this->printHtml($value->getName()); ?></a>
|
||||
<td><a href="<?= $url; ?>"><?= $this->printHtml($value->getExtension()); ?></a>
|
||||
<td><a href="<?= $url; ?>"><?= $this->printHtml($value->getSize()); ?></a>
|
||||
<td><a href="<?= $url; ?>"><?= $this->printHtml($value->getCreatedBy()->getName1()); ?></a>
|
||||
<td><a href="<?= $url; ?>"><?= $this->printHtml($value->getCreatedAt()->format('Y-m-d H:i:s')); ?></a>
|
||||
<?php endforeach; ?>
|
||||
<?php if($count === 0) : ?>
|
||||
<tr><td colspan="5" class="empty"><?= $this->getHtml('Empty', 0, 0); ?>
|
||||
<?php endif; ?>
|
||||
</table>
|
||||
</div>
|
||||
Loading…
Reference in New Issue
Block a user