mirror of
https://github.com/Karaka-Management/oms-Comments.git
synced 2026-01-11 16:18:41 +00:00
implement todos
This commit is contained in:
parent
00d9b01b4d
commit
9d57057d64
9
Admin/Install/Media.install.json
Normal file
9
Admin/Install/Media.install.json
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
[
|
||||
{
|
||||
"type": "collection",
|
||||
"create_directory": true,
|
||||
"name": "Comments",
|
||||
"virtualPath": "/Modules",
|
||||
"user": 1
|
||||
}
|
||||
]
|
||||
43
Admin/Install/Media.php
Normal file
43
Admin/Install/Media.php
Normal 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']);
|
||||
}
|
||||
}
|
||||
|
|
@ -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
BIN
Docs/Dev/img/er.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 160 KiB |
|
|
@ -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)
|
||||
); ?>
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user