implement todos

This commit is contained in:
Dennis Eichhorn 2021-07-15 21:51:30 +02:00
parent 00d9b01b4d
commit 9d57057d64
6 changed files with 72 additions and 3 deletions

View File

@ -0,0 +1,9 @@
[
{
"type": "collection",
"create_directory": true,
"name": "Comments",
"virtualPath": "/Modules",
"user": 1
}
]

43
Admin/Install/Media.php Normal file
View File

@ -0,0 +1,43 @@
<?php
/**
* Orange Management
*
* PHP Version 8.0
*
* @package Modules\Comments\Admin\Install
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @version 1.0.0
* @link https://orange-management.org
*/
declare(strict_types=1);
namespace Modules\Comments\Admin\Install;
use phpOMS\Application\ApplicationAbstract;
/**
* Media class.
*
* @package Modules\Comments\Admin\Install
* @license OMS License 1.0
* @link https://orange-management.org
* @since 1.0.0
*/
class Media
{
/**
* Install media providing
*
* @param string $path Module path
* @param ApplicationAbstract $app Application
*
* @return void
*
* @since 1.0.0
*/
public static function install(string $path, ApplicationAbstract $app) : void
{
\Modules\Media\Admin\Installer::installExternal($app, ['path' => __DIR__ . '/Media.install.json']);
}
}

View File

@ -182,6 +182,20 @@ final class ApiController extends Controller
$comment->setRef($request->getData('ref') !== null ? (int) $request->getData('ref') : null);
$comment->setList((int) ($request->getData('list') ?? 0));
if (!empty($uploadedFiles = $request->getFiles() ?? [])) {
$uploaded = $this->app->moduleManager->get('Media')->uploadFiles(
[''],
$uploadedFiles,
$request->header->account,
__DIR__ . '/../../../Modules/Media/Files/Modules/Comments',
'/Modules/Comments',
);
foreach ($uploaded as $media) {
$comment->addMedia($media);
}
}
return $comment;
}

BIN
Docs/Dev/img/er.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 160 KiB

View File

@ -57,11 +57,13 @@ foreach ($comments as $comment) : ?>
<div class="col-xs-12">
<section class="portlet">
<div class="portlet-body">
<article>
<?= $comment->content; ?>
</article>
<article><?= $comment->content; ?></article>
</div>
<div class="portlet-foot">
<?php $files = $comment->getMedia(); foreach ($files as $file) : ?>
<span class="file"><?= $this->printHtml($file->name); ?></span>
<?php endforeach; ?>
<?= $this->printHtml(
\sprintf('%3$s %2$s %1$s', $comment->createdBy->name1, $comment->createdBy->name2, $comment->createdBy->name3)
); ?>

View File

@ -21,6 +21,7 @@
"Editor": "1.0.0"
},
"providing": {
"Media": "1.0.0"
},
"load": [
]