implement todos

This commit is contained in:
Dennis Eichhorn 2021-07-15 21:51:30 +02:00
parent f08e412011
commit 8f4cf4f383
8 changed files with 89 additions and 4 deletions

View File

@ -0,0 +1,9 @@
[
{
"type": "collection",
"create_directory": true,
"name": "Tasks",
"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\Tasks\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\Tasks\Admin\Install;
use phpOMS\Application\ApplicationAbstract;
/**
* Media class.
*
* @package Modules\Tasks\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

@ -237,8 +237,8 @@
"name": "task_group_group",
"type": "INT",
"null": false,
"foreignTable": "account",
"foreignKey": "account_id"
"foreignTable": "group",
"foreignKey": "group_id"
},
"task_group_duty": {
"name": "task_group_duty",

View File

@ -130,6 +130,20 @@ final class ApiController extends Controller
}
}
if (!empty($uploadedFiles = $request->getFiles() ?? [])) {
$uploaded = $this->app->moduleManager->get('Media')->uploadFiles(
[''],
$uploadedFiles,
$request->header->account,
__DIR__ . '/../../../Modules/Media/Files/Modules/Tasks',
'/Modules/Tasks',
);
foreach ($uploaded as $media) {
$task->addMedia($media);
}
}
$element = new TaskElement();
$element->addTo(new NullAccount((int) ($request->getData('forward') ?? $request->header->account)));
$element->createdBy = $task->getCreatedBy();
@ -306,6 +320,20 @@ final class ApiController extends Controller
$element->addCC(new NullAccount((int) $cc));
}
if (!empty($uploadedFiles = $request->getFiles() ?? [])) {
$uploaded = $this->app->moduleManager->get('Media')->uploadFiles(
[''],
$uploadedFiles,
$request->header->account,
__DIR__ . '/../../../Modules/Media/Files/Modules/Tasks',
'/Modules/Tasks',
);
foreach ($uploaded as $media) {
$element->addMedia($media);
}
}
return $element;
}

View File

@ -1,3 +1,3 @@
# Developer Content
* [Task]({%}&page=Dev/task)
* [Task]({%}&page=Dev/tasks)

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 284 KiB

View File

@ -100,6 +100,10 @@ echo $this->getData('nav')->render(); ?>
<?php $tags = $task->getTags(); foreach ($tags as $tag) : ?>
<span class="tag" style="background: <?= $this->printHtml($tag->color); ?>"><?= $tag->icon !== null ? '<i class="' . $this->printHtml($tag->icon ?? '') . '"></i>' : ''; ?><?= $this->printHtml($tag->getL11n()); ?></span>
<?php endforeach; ?>
<?php $files = $task->getMedia(); foreach ($files as $file) : ?>
<span class="file"><?= $this->printHtml($file->name); ?></span>
<?php endforeach; ?>
</div>
</div>
<div class="col-xs-0 end-xs plain-grid">

View File

@ -25,7 +25,8 @@
},
"providing": {
"Navigation": "*",
"Search": "*"
"Search": "*",
"Media": "*"
},
"load": [
{