mirror of
https://github.com/Karaka-Management/oms-Tasks.git
synced 2026-01-11 15:38:40 +00:00
Merge remote-tracking branch 'origin/develop' into develop
# Conflicts: # Draw/Controller.js # Draw/Models/DrawType.enum.js # Draw/Models/Editor.js # Media/Models/UploadFile.php
This commit is contained in:
commit
daa39bfc89
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Orange Management
|
||||
*
|
||||
* PHP Version 7.0
|
||||
* PHP Version 7.1
|
||||
*
|
||||
* @category TBD
|
||||
* @package TBD
|
||||
|
|
@ -16,7 +16,7 @@
|
|||
namespace Modules\Tasks\Admin;
|
||||
|
||||
|
||||
use phpOMS\DataStorage\Database\Pool;
|
||||
use phpOMS\DataStorage\Database\DatabasePool;
|
||||
use phpOMS\Module\ActivateAbstract;
|
||||
use phpOMS\Module\InfoManager;
|
||||
|
||||
|
|
@ -37,7 +37,7 @@ class Activate extends ActivateAbstract
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static function activate(Pool $dbPool, InfoManager $info)
|
||||
public static function activate(DatabasePool $dbPool, InfoManager $info)
|
||||
{
|
||||
parent::activate($dbPool, $info);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Orange Management
|
||||
*
|
||||
* PHP Version 7.0
|
||||
* PHP Version 7.1
|
||||
*
|
||||
* @category TBD
|
||||
* @package TBD
|
||||
|
|
@ -16,7 +16,7 @@
|
|||
namespace Modules\Tasks\Admin;
|
||||
|
||||
|
||||
use phpOMS\DataStorage\Database\Pool;
|
||||
use phpOMS\DataStorage\Database\DatabasePool;
|
||||
use phpOMS\Module\DeactivateAbstract;
|
||||
use phpOMS\Module\InfoManager;
|
||||
|
||||
|
|
@ -37,7 +37,7 @@ class Deactivate extends DeactivateAbstract
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static function deactivate(Pool $dbPool, InfoManager $info)
|
||||
public static function deactivate(DatabasePool $dbPool, InfoManager $info)
|
||||
{
|
||||
parent::deactivate($dbPool, $info);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Orange Management
|
||||
*
|
||||
* PHP Version 7.0
|
||||
* PHP Version 7.1
|
||||
*
|
||||
* @category TBD
|
||||
* @package TBD
|
||||
|
|
@ -14,7 +14,7 @@
|
|||
* @link http://orange-management.com
|
||||
*/
|
||||
namespace Modules\Tasks\Admin\Install;
|
||||
use phpOMS\DataStorage\Database\Pool;
|
||||
use phpOMS\DataStorage\Database\DatabasePool;
|
||||
|
||||
/**
|
||||
* Navigation class.
|
||||
|
|
@ -29,7 +29,7 @@ use phpOMS\DataStorage\Database\Pool;
|
|||
*/
|
||||
class Navigation
|
||||
{
|
||||
public static function install(Pool $dbPool)
|
||||
public static function install(string $path, DatabasePool $dbPool)
|
||||
{
|
||||
$navData = json_decode(file_get_contents(__DIR__ . '/Navigation.install.json'), true);
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Orange Management
|
||||
*
|
||||
* PHP Version 7.0
|
||||
* PHP Version 7.1
|
||||
*
|
||||
* @category TBD
|
||||
* @package TBD
|
||||
|
|
@ -16,7 +16,7 @@
|
|||
namespace Modules\Tasks\Admin;
|
||||
|
||||
use phpOMS\DataStorage\Database\DatabaseType;
|
||||
use phpOMS\DataStorage\Database\Pool;
|
||||
use phpOMS\DataStorage\Database\DatabasePool;
|
||||
use phpOMS\Module\InfoManager;
|
||||
use phpOMS\Module\InstallerAbstract;
|
||||
|
||||
|
|
@ -37,9 +37,9 @@ class Installer extends InstallerAbstract
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static function install(Pool $dbPool, InfoManager $info)
|
||||
public static function install(string $path, DatabasePool $dbPool, InfoManager $info)
|
||||
{
|
||||
parent::install($dbPool, $info);
|
||||
parent::install($path, $dbPool, $info);
|
||||
|
||||
switch ($dbPool->get('core')->getType()) {
|
||||
case DatabaseType::MYSQL:
|
||||
|
|
@ -69,6 +69,23 @@ class Installer extends InstallerAbstract
|
|||
ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'task_ibfk_2` FOREIGN KEY (`task_created_by`) REFERENCES `' . $dbPool->get('core')->prefix . 'account` (`account_id`);'
|
||||
)->execute();
|
||||
|
||||
$dbPool->get('core')->con->prepare(
|
||||
'CREATE TABLE if NOT EXISTS `' . $dbPool->get('core')->prefix . 'task_media` (
|
||||
`task_media_id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`task_media_src` int(11) NULL,
|
||||
`task_media_dst` int(11) NULL,
|
||||
PRIMARY KEY (`task_media_id`),
|
||||
KEY `task_media_src` (`task_media_src`),
|
||||
KEY `task_media_dst` (`task_media_dst`)
|
||||
)ENGINE=InnoDB DEFAULT CHARSET=utf8;'
|
||||
)->execute();
|
||||
|
||||
$dbPool->get('core')->con->prepare(
|
||||
'ALTER TABLE `' . $dbPool->get('core')->prefix . 'task_media`
|
||||
ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'task_media_ibfk_1` FOREIGN KEY (`task_media_src`) REFERENCES `' . $dbPool->get('core')->prefix . 'task` (`task_id`),
|
||||
ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'task_media_ibfk_2` FOREIGN KEY (`task_media_dst`) REFERENCES `' . $dbPool->get('core')->prefix . 'media` (`media_id`);'
|
||||
)->execute();
|
||||
|
||||
$dbPool->get('core')->con->prepare(
|
||||
'CREATE TABLE if NOT EXISTS `' . $dbPool->get('core')->prefix . 'task_account` (
|
||||
`task_account_id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
|
|
@ -112,6 +129,23 @@ class Installer extends InstallerAbstract
|
|||
ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'task_element_ibfk_3` FOREIGN KEY (`task_element_forwarded`) REFERENCES `' . $dbPool->get('core')->prefix . 'account` (`account_id`);'
|
||||
)->execute();
|
||||
|
||||
$dbPool->get('core')->con->prepare(
|
||||
'CREATE TABLE if NOT EXISTS `' . $dbPool->get('core')->prefix . 'task_element_media` (
|
||||
`task_element_media_id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`task_element_media_src` int(11) NULL,
|
||||
`task_element_media_dst` int(11) NULL,
|
||||
PRIMARY KEY (`task_element_media_id`),
|
||||
KEY `task_element_media_src` (`task_element_media_src`),
|
||||
KEY `task_element_media_dst` (`task_element_media_dst`)
|
||||
)ENGINE=InnoDB DEFAULT CHARSET=utf8;'
|
||||
)->execute();
|
||||
|
||||
$dbPool->get('core')->con->prepare(
|
||||
'ALTER TABLE `' . $dbPool->get('core')->prefix . 'task_element_media`
|
||||
ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'task_element_media_ibfk_1` FOREIGN KEY (`task_element_media_src`) REFERENCES `' . $dbPool->get('core')->prefix . 'task_element` (`task_element_id`),
|
||||
ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'task_element_media_ibfk_2` FOREIGN KEY (`task_element_media_dst`) REFERENCES `' . $dbPool->get('core')->prefix . 'media` (`media_id`);'
|
||||
)->execute();
|
||||
|
||||
$dbPool->get('core')->con->commit();
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
18
Admin/Routes/Web/Api.php
Normal file
18
Admin/Routes/Web/Api.php
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
<?php
|
||||
|
||||
use phpOMS\Router\RouteVerb;
|
||||
|
||||
return [
|
||||
'^.*/api/task(\?.*|$)' => [
|
||||
[
|
||||
'dest' => '\Modules\Tasks\Controller:apiTaskCreate',
|
||||
'verb' => RouteVerb::SET,
|
||||
],
|
||||
],
|
||||
'^.*/api/task/element.*$' => [
|
||||
[
|
||||
'dest' => '\Modules\Tasks\Controller:apiTaskElementCreate',
|
||||
'verb' => RouteVerb::SET,
|
||||
],
|
||||
],
|
||||
];
|
||||
|
|
@ -27,17 +27,4 @@ return [
|
|||
'verb' => RouteVerb::GET,
|
||||
],
|
||||
],
|
||||
|
||||
'^.*/api/task$' => [
|
||||
[
|
||||
'dest' => '\Modules\Tasks\Controller:apiTaskCreate',
|
||||
'verb' => RouteVerb::SET,
|
||||
],
|
||||
],
|
||||
'^.*/api/task/element.*$' => [
|
||||
[
|
||||
'dest' => '\Modules\Tasks\Controller:apiTaskElementCreate',
|
||||
'verb' => RouteVerb::SET,
|
||||
],
|
||||
],
|
||||
];
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Orange Management
|
||||
*
|
||||
* PHP Version 7.0
|
||||
* PHP Version 7.1
|
||||
*
|
||||
* @category TBD
|
||||
* @package TBD
|
||||
|
|
@ -16,7 +16,7 @@
|
|||
namespace Modules\Tasks\Admin;
|
||||
|
||||
|
||||
use phpOMS\DataStorage\Database\Pool;
|
||||
use phpOMS\DataStorage\Database\DatabasePool;
|
||||
use phpOMS\DataStorage\Database\Schema\Builder;
|
||||
use phpOMS\Module\InfoManager;
|
||||
use phpOMS\Module\UninstallAbstract;
|
||||
|
|
@ -38,7 +38,7 @@ class Uninstall extends UninstallAbstract
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static function uninstall(Pool $dbPool, InfoManager $info)
|
||||
public static function uninstall(DatabasePool $dbPool, InfoManager $info)
|
||||
{
|
||||
parent::uninstall($dbPool, $info);
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Orange Management
|
||||
*
|
||||
* PHP Version 7.0
|
||||
* PHP Version 7.1
|
||||
*
|
||||
* @category TBD
|
||||
* @package TBD
|
||||
|
|
@ -16,7 +16,7 @@
|
|||
namespace Modules\Tasks\Admin;
|
||||
|
||||
|
||||
use phpOMS\DataStorage\Database\Pool;
|
||||
use phpOMS\DataStorage\Database\DatabasePool;
|
||||
use phpOMS\Module\InfoManager;
|
||||
use phpOMS\Module\UpdateAbstract;
|
||||
use phpOMS\System\File\Directory;
|
||||
|
|
@ -38,7 +38,7 @@ class Update extends UpdateAbstract
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static function update(Pool $dbPool, InfoManager $info)
|
||||
public static function update(DatabasePool $dbPool, InfoManager $info)
|
||||
{
|
||||
Directory::deletePath(__DIR__ . '/Update');
|
||||
mkdir('Update');
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Orange Management
|
||||
*
|
||||
* PHP Version 7.0
|
||||
* PHP Version 7.1
|
||||
*
|
||||
* @category TBD
|
||||
* @package TBD
|
||||
|
|
@ -15,9 +15,12 @@
|
|||
*/
|
||||
namespace Modules\Tasks;
|
||||
|
||||
use Model\Message\FormValidation;
|
||||
use Model\Message\Redirect;
|
||||
use Model\Message\Reload;
|
||||
use Modules\Tasks\Models\Task;
|
||||
use Modules\Tasks\Models\TaskElement;
|
||||
use Modules\Tasks\Models\TaskElementMapper;
|
||||
use Modules\Tasks\Models\TaskMapper;
|
||||
use Modules\Tasks\Models\TaskStatus;
|
||||
use Modules\Tasks\Models\TaskType;
|
||||
|
|
@ -48,7 +51,7 @@ class Controller extends ModuleAbstract implements WebInterface
|
|||
* @var string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
const MODULE_PATH = __DIR__;
|
||||
/* public */ const MODULE_PATH = __DIR__;
|
||||
|
||||
/**
|
||||
* Module version.
|
||||
|
|
@ -56,7 +59,7 @@ class Controller extends ModuleAbstract implements WebInterface
|
|||
* @var string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
const MODULE_VERSION = '1.0.0';
|
||||
/* public */ const MODULE_VERSION = '1.0.0';
|
||||
|
||||
/**
|
||||
* Module name.
|
||||
|
|
@ -64,7 +67,7 @@ class Controller extends ModuleAbstract implements WebInterface
|
|||
* @var string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
const MODULE_NAME = 'Tasks';
|
||||
/* public */ const MODULE_NAME = 'Tasks';
|
||||
|
||||
/**
|
||||
* Providing.
|
||||
|
|
@ -165,6 +168,21 @@ class Controller extends ModuleAbstract implements WebInterface
|
|||
return $view;
|
||||
}
|
||||
|
||||
private function validateTaskCreate(RequestAbstract $request) : array
|
||||
{
|
||||
$val = [];
|
||||
if (
|
||||
($val['title'] = empty($request->getData('title')))
|
||||
|| ($val['description'] = empty($request->getData('description')))
|
||||
|| ($val['due'] = !((bool)strtotime($request->getData('due'))))
|
||||
|| ($val['forward'] = !(is_numeric($request->getData('forward') ?? 0)))
|
||||
) {
|
||||
return $val;
|
||||
}
|
||||
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param RequestAbstract $request Request
|
||||
* @param ResponseAbstract $response Response
|
||||
|
|
@ -177,6 +195,12 @@ class Controller extends ModuleAbstract implements WebInterface
|
|||
*/
|
||||
public function apiTaskCreate(RequestAbstract $request, ResponseAbstract $response, $data = null)
|
||||
{
|
||||
if (!empty($val = $this->validateTaskCreate($request))) {
|
||||
$response->set('task_create', new FormValidation($val));
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$task = new Task();
|
||||
$task->setTitle($request->getData('title') ?? '');
|
||||
$task->setDescription($request->getData('description') ?? '');
|
||||
|
|
@ -196,7 +220,53 @@ class Controller extends ModuleAbstract implements WebInterface
|
|||
$task->addElement($element);
|
||||
|
||||
TaskMapper::create($task);
|
||||
$response->set($request->__toString(), new Redirect(UriFactory::build('http://127.0.0.1/{/lang}/backend/task/single?id=' . $task->getId())));
|
||||
$response->set($request->__toString(), $task->jsonSerialize());
|
||||
}
|
||||
|
||||
private function validateTaskElementCreate(RequestAbstract $request) : array
|
||||
{
|
||||
$val = [];
|
||||
if (
|
||||
($val['status'] = !TaskStatus::isValidValue((int) $request->getData('status')))
|
||||
|| ($val['due'] = !((bool)strtotime($request->getData('due'))))
|
||||
|| ($val['task'] = !(is_numeric($request->getData('task'))))
|
||||
|| ($val['forward'] = !(is_numeric(empty($request->getData('forward')) ? $request->getAccount() : $request->getData('forward'))))
|
||||
) { // todo: validate correct task
|
||||
return $val;
|
||||
}
|
||||
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param RequestAbstract $request Request
|
||||
* @param ResponseAbstract $response Response
|
||||
* @param mixed $data Generic data
|
||||
*
|
||||
* @return \Serializable
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function apiTaskElementCreate(RequestAbstract $request, ResponseAbstract $response, $data = null)
|
||||
{
|
||||
if (!empty($val = $this->validateTaskElementCreate($request))) {
|
||||
$response->set('task_element_create', new FormValidation($val));
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$element = new TaskElement();
|
||||
$element->setForwarded($request->getData('forward') ?? $request->getAccount());
|
||||
$element->setCreatedAt(new \DateTime('now'));
|
||||
$element->setCreatedBy($request->getAccount());
|
||||
$element->setDue(new \DateTime($request->getData('due') ?? 'now'));
|
||||
$element->setStatus($request->getData('status'));
|
||||
$element->setTask($request->getData('task'));
|
||||
$element->setDescription($request->getData('description'));
|
||||
|
||||
TaskElementMapper::create($element);
|
||||
$response->set($request->__toString(), $element->jsonSerialize());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
34
Models/NullTask.php
Normal file
34
Models/NullTask.php
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
<?php
|
||||
/**
|
||||
* Orange Management
|
||||
*
|
||||
* PHP Version 7.1
|
||||
*
|
||||
* @category TBD
|
||||
* @package TBD
|
||||
* @author OMS Development Team <dev@oms.com>
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
* @copyright 2013 Dennis Eichhorn
|
||||
* @license OMS License 1.0
|
||||
* @version 1.0.0
|
||||
* @link http://orange-management.com
|
||||
*/
|
||||
namespace Modules\Tasks\Models;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Task class.
|
||||
*
|
||||
* @category Modules
|
||||
* @package Framework
|
||||
* @author OMS Development Team <dev@oms.com>
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
* @license OMS License 1.0
|
||||
* @link http://orange-management.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
class NullTask extends Task
|
||||
{
|
||||
|
||||
}
|
||||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Orange Management
|
||||
*
|
||||
* PHP Version 7.0
|
||||
* PHP Version 7.1
|
||||
*
|
||||
* @category TBD
|
||||
* @package TBD
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Orange Management
|
||||
*
|
||||
* PHP Version 7.0
|
||||
* PHP Version 7.1
|
||||
*
|
||||
* @category TBD
|
||||
* @package TBD
|
||||
|
|
@ -28,7 +28,7 @@ use phpOMS\Datatypes\Exception\InvalidEnumValue;
|
|||
* @link http://orange-management.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
class Task
|
||||
class Task implements \JsonSerializable
|
||||
{
|
||||
|
||||
/**
|
||||
|
|
@ -119,6 +119,8 @@ class Task
|
|||
*/
|
||||
protected $schedule = null;
|
||||
|
||||
protected $media = [];
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
|
|
@ -195,6 +197,7 @@ class Task
|
|||
public function setCreatedBy(int $id)
|
||||
{
|
||||
$this->createdBy = $id;
|
||||
$this->schedule->setCreatedBy($id);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -288,7 +291,7 @@ class Task
|
|||
/**
|
||||
* @param int $status
|
||||
*
|
||||
* @throws
|
||||
* @throws InvalidEnumValue
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
|
|
@ -413,4 +416,31 @@ class Task
|
|||
return $this->schedule;
|
||||
}
|
||||
|
||||
private function toArray() : array
|
||||
{
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'createdBy' => $this->createdBy,
|
||||
'createdAt' => $this->createdAt,
|
||||
'title' => $this->title,
|
||||
'description' => $this->description,
|
||||
'status' => $this->status,
|
||||
'type' => $this->type,
|
||||
'type' => $this->type,
|
||||
'due' => $this->due->format('Y-m-d H:i:s'),
|
||||
'done' => (!isset($this->done) ? null : $this->done->format('Y-m-d H:i:s')),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Specify data which should be serialized to JSON
|
||||
* @link http://php.net/manual/en/jsonserializable.jsonserialize.php
|
||||
* @return mixed data which can be serialized by <b>json_encode</b>,
|
||||
* which is a value of any type other than a resource.
|
||||
* @since 5.4.0
|
||||
*/
|
||||
public function jsonSerialize()
|
||||
{
|
||||
return $this->toArray();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Orange Management
|
||||
*
|
||||
* PHP Version 7.0
|
||||
* PHP Version 7.1
|
||||
*
|
||||
* @category TBD
|
||||
* @package TBD
|
||||
|
|
@ -27,7 +27,7 @@ use phpOMS\Datatypes\Exception\InvalidEnumValue;
|
|||
* @link http://orange-management.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
class TaskElement
|
||||
class TaskElement implements \JsonSerializable
|
||||
{
|
||||
|
||||
/**
|
||||
|
|
@ -94,6 +94,8 @@ class TaskElement
|
|||
*/
|
||||
private $forwarded = 0;
|
||||
|
||||
private $media = [];
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
|
|
@ -257,7 +259,7 @@ class TaskElement
|
|||
*
|
||||
* @return void
|
||||
*
|
||||
* @throws
|
||||
* @throws InvalidEnumValue
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
|
|
@ -294,4 +296,21 @@ class TaskElement
|
|||
{
|
||||
$this->task = $task;
|
||||
}
|
||||
|
||||
public function toArray() : array {
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'task' => $this->task,
|
||||
'createdBy' => $this->createdBy,
|
||||
'createdAt' => $this->createdAt,
|
||||
'description' => $this->description,
|
||||
'status' => $this->status,
|
||||
'forward' => $this->forwarded,
|
||||
'due' => isset($this->due) ? $this->due->format('Y-m-d H:i:s') : null,
|
||||
];
|
||||
}
|
||||
|
||||
public function jsonSerialize() {
|
||||
return $this->toArray();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Orange Management
|
||||
*
|
||||
* PHP Version 7.0
|
||||
* PHP Version 7.1
|
||||
*
|
||||
* @category TBD
|
||||
* @package TBD
|
||||
|
|
@ -15,6 +15,7 @@
|
|||
*/
|
||||
namespace Modules\Tasks\Models;
|
||||
|
||||
use Modules\Media\Models\MediaMapper;
|
||||
use phpOMS\DataStorage\Database\DataMapperAbstract;
|
||||
use phpOMS\DataStorage\Database\RelationType;
|
||||
|
||||
|
|
@ -35,7 +36,7 @@ class TaskElementMapper extends DataMapperAbstract
|
|||
/**
|
||||
* Columns.
|
||||
*
|
||||
* @var array<string, array>
|
||||
* @var array
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected static $columns = [
|
||||
|
|
@ -49,6 +50,21 @@ class TaskElementMapper extends DataMapperAbstract
|
|||
'task_element_created_at' => ['name' => 'task_element_created_at', 'type' => 'DateTime', 'internal' => 'createdAt'],
|
||||
];
|
||||
|
||||
/**
|
||||
* Has many relation.
|
||||
*
|
||||
* @var array
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected static $hasMany = [
|
||||
'media' => [
|
||||
'mapper' => MediaMapper::class,
|
||||
'table' => 'task_element_media',
|
||||
'dst' => 'task_element_media_dst',
|
||||
'src' => 'task_element_media_src',
|
||||
],
|
||||
];
|
||||
|
||||
/**
|
||||
* Primary table.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Orange Management
|
||||
*
|
||||
* PHP Version 7.0
|
||||
* PHP Version 7.1
|
||||
*
|
||||
* @category TBD
|
||||
* @package TBD
|
||||
|
|
@ -16,6 +16,7 @@
|
|||
namespace Modules\Tasks\Models;
|
||||
|
||||
use Modules\Calendar\Models\ScheduleMapper;
|
||||
use Modules\Media\Models\MediaMapper;
|
||||
use Modules\Tasks\Models\TaskElementMapper;
|
||||
use phpOMS\DataStorage\Database\DataMapperAbstract;
|
||||
use phpOMS\DataStorage\Database\Query\Builder;
|
||||
|
|
@ -39,7 +40,7 @@ class TaskMapper extends DataMapperAbstract
|
|||
/**
|
||||
* Columns.
|
||||
*
|
||||
* @var array<string, array>
|
||||
* @var array
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected static $columns = [
|
||||
|
|
@ -58,26 +59,31 @@ class TaskMapper extends DataMapperAbstract
|
|||
/**
|
||||
* Has many relation.
|
||||
*
|
||||
* @var array<string, array>
|
||||
* @var array
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected static $hasMany = [
|
||||
'taskElements' => [
|
||||
'mapper' => TaskElementMapper::class,
|
||||
'relationmapper' => TaskElementMapper::class,
|
||||
'table' => 'task_element',
|
||||
'dst' => 'task_element_task',
|
||||
'src' => null,
|
||||
],
|
||||
'media' => [ // todo: maybe make this a has one and then link to collection instead of single media files!
|
||||
'mapper' => MediaMapper::class,
|
||||
'table' => 'task_media',
|
||||
'dst' => 'task_media_dst',
|
||||
'src' => 'task_media_src',
|
||||
],
|
||||
];
|
||||
|
||||
/**
|
||||
* Has one relation.
|
||||
*
|
||||
* @var array<string, array>
|
||||
* @var array
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected static $hasOne = [
|
||||
protected static $ownsOne = [
|
||||
'schedule' => [
|
||||
'mapper' => ScheduleMapper::class,
|
||||
'src' => 'task_schedule',
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Orange Management
|
||||
*
|
||||
* PHP Version 7.0
|
||||
* PHP Version 7.1
|
||||
*
|
||||
* @category TBD
|
||||
* @package TBD
|
||||
|
|
@ -30,13 +30,13 @@ use phpOMS\Datatypes\Enum;
|
|||
*/
|
||||
abstract class TaskPriority extends Enum
|
||||
{
|
||||
const VLOW = 1;
|
||||
/* public */ const VLOW = 1;
|
||||
|
||||
const LOW = 2;
|
||||
/* public */ const LOW = 2;
|
||||
|
||||
const MEDIUM = 3;
|
||||
/* public */ const MEDIUM = 3;
|
||||
|
||||
const HIGH = 4;
|
||||
/* public */ const HIGH = 4;
|
||||
|
||||
const VHIGH = 5;
|
||||
/* public */ const VHIGH = 5;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Orange Management
|
||||
*
|
||||
* PHP Version 7.0
|
||||
* PHP Version 7.1
|
||||
*
|
||||
* @category TBD
|
||||
* @package TBD
|
||||
|
|
@ -30,15 +30,15 @@ use phpOMS\Datatypes\Enum;
|
|||
*/
|
||||
abstract class TaskStatus extends Enum
|
||||
{
|
||||
const OPEN = 1;
|
||||
/* public */ const OPEN = 1;
|
||||
|
||||
const WORKING = 2;
|
||||
/* public */ const WORKING = 2;
|
||||
|
||||
const SUSPENDED = 3;
|
||||
/* public */ const SUSPENDED = 3;
|
||||
|
||||
const CANCELED = 4;
|
||||
/* public */ const CANCELED = 4;
|
||||
|
||||
const DONE = 5;
|
||||
/* public */ const DONE = 5;
|
||||
|
||||
const CLOSED = 6;
|
||||
/* public */ const CLOSED = 6;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Orange Management
|
||||
*
|
||||
* PHP Version 7.0
|
||||
* PHP Version 7.1
|
||||
*
|
||||
* @category TBD
|
||||
* @package TBD
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Orange Management
|
||||
*
|
||||
* PHP Version 7.0
|
||||
* PHP Version 7.1
|
||||
*
|
||||
* @category TBD
|
||||
* @package TBD
|
||||
|
|
@ -30,7 +30,7 @@ use phpOMS\Datatypes\Enum;
|
|||
*/
|
||||
abstract class TaskType extends Enum
|
||||
{
|
||||
const TEMPLATE = 1;
|
||||
const SINGLE = 2;
|
||||
const HIDDEN = 3;
|
||||
/* public */ const TEMPLATE = 1;
|
||||
/* public */ const SINGLE = 2;
|
||||
/* public */ const HIDDEN = 3;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Orange Management
|
||||
*
|
||||
* PHP Version 7.0
|
||||
* PHP Version 7.1
|
||||
*
|
||||
* @category TBD
|
||||
* @package TBD
|
||||
|
|
@ -30,7 +30,7 @@ use phpOMS\Datatypes\Enum;
|
|||
*/
|
||||
abstract class TaskVisibility extends Enum
|
||||
{
|
||||
const TO = 1;
|
||||
const CC = 2;
|
||||
const BCC = 3;
|
||||
/* public */ const TO = 1;
|
||||
/* public */ const CC = 2;
|
||||
/* public */ const BCC = 3;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Orange Management
|
||||
*
|
||||
* PHP Version 7.0
|
||||
* PHP Version 7.1
|
||||
*
|
||||
* @category TBD
|
||||
* @package TBD
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Orange Management
|
||||
*
|
||||
* PHP Version 7.0
|
||||
* PHP Version 7.1
|
||||
*
|
||||
* @category TBD
|
||||
* @package TBD
|
||||
|
|
@ -28,6 +28,7 @@ return ['Tasks' => [
|
|||
'Forwarded' => 'Forwarded',
|
||||
'From' => 'From',
|
||||
'Group' => 'Group',
|
||||
'History' => 'History',
|
||||
'Interval' => 'Interval',
|
||||
'InTime' => 'In Time',
|
||||
'Message' => 'Message',
|
||||
|
|
@ -49,6 +50,7 @@ return ['Tasks' => [
|
|||
'Task' => 'Task',
|
||||
'Tasks' => 'Tasks',
|
||||
'Template' => 'Template',
|
||||
'Time' => 'Time',
|
||||
'Title' => 'Title',
|
||||
'To' => 'To',
|
||||
'Today' => 'Today',
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
<section>
|
||||
<section id="task-dashboard" draggable>
|
||||
Task
|
||||
</section>
|
||||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Orange Management
|
||||
*
|
||||
* PHP Version 7.0
|
||||
* PHP Version 7.1
|
||||
*
|
||||
* @category TBD
|
||||
* @package TBD
|
||||
|
|
@ -22,19 +22,19 @@ echo $this->getData('nav')->render(); ?>
|
|||
<header><h1><?= $this->getText('Task'); ?></h1></header>
|
||||
|
||||
<div class="inner">
|
||||
<form id="fTask" method="POST" action="<?= \phpOMS\Uri\UriFactory::build('/{/lang}/api/task/create'); ?>">
|
||||
<form id="fTask" method="POST" action="<?= \phpOMS\Uri\UriFactory::build('/{/lang}/api/task?csrf={$CSRF}'); ?>">
|
||||
<table class="layout wf-100">
|
||||
<tbody>
|
||||
<tr><td colspan="2"><label for="iReceiver"><?= $this->getText('To'); ?></label>
|
||||
<tr><td><span class="input"><button type="button" data-action='[{"type": "popup", "tpl": "acc-grp-tpl", "aniIn": "fadeIn", "aniOut": "fadeOut", "stay": 5000}]' formaction=""><i class="fa fa-book"></i></button><input type="number" min="1" id="iReceiver" name="receiver" placeholder=" Guest" required></span><td><button><?= $this->getText('Add', 0, 0); ?></button>
|
||||
<tr><td><span class="input"><button type="button" data-action='[{"listener": "click", "action": [{"type": "popup", "tpl": "acc-grp-tpl", "aniIn": "fadeIn", "aniOut": "fadeOut", "stay": 5000}]}]' formaction=""><i class="fa fa-book"></i></button><input type="number" min="1" id="iReceiver" name="receiver" placeholder=" Guest" required></span><td><button><?= $this->getText('Add', 0, 0); ?></button>
|
||||
<tr><td colspan="2"><label for="iObserver"><?= $this->getText('CC'); ?></label>
|
||||
<tr><td><span class="input"><button type="button" formaction=""><i class="fa fa-book"></i></button><input type="number" min="1" id="iObserver" name="observer" placeholder=" Guest" required></span><td><button><?= $this->getText('Add', 0, 0); ?></button>
|
||||
<tr><td><span class="input"><button type="button" formaction=""><i class="fa fa-book"></i></button><input type="number" min="1" id="iObserver" name="observer" placeholder=" Guest"></span><td><button><?= $this->getText('Add', 0, 0); ?></button>
|
||||
<tr><td colspan="2"><label for="iDue"><?= $this->getText('Due'); ?></label>
|
||||
<tr><td><input type="datetime-local" id="iDue" name="due" value="<?= (new \DateTime('NOW'))->format('Y-m-d\TH:i:s') ?>"><td>
|
||||
<tr><td colspan="2"><label for="iTitle"><?= $this->getText('Title'); ?></label>
|
||||
<tr><td><input type="text" id="iTitle" name="title" placeholder=" <?= $this->getText('Title'); ?>"><td>
|
||||
<tr><td><input type="text" id="iTitle" name="title" placeholder=" <?= $this->getText('Title'); ?>" required><td>
|
||||
<tr><td colspan="2"><label for="iMessage"><?= $this->getText('Message'); ?></label>
|
||||
<tr><td><textarea id="iMessage" name="description" placeholder=""></textarea><td>
|
||||
<tr><td><textarea id="iMessage" name="description" placeholder="" required></textarea><td>
|
||||
<tr><td colspan="2"><input type="submit" value="<?= $this->getText('Create', 0, 0); ?>"><input type="hidden" name="type" value="<?= \Modules\Tasks\Models\TaskType::SINGLE; ?>">
|
||||
</table>
|
||||
</form>
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Orange Management
|
||||
*
|
||||
* PHP Version 7.0
|
||||
* PHP Version 7.1
|
||||
*
|
||||
* @category TBD
|
||||
* @package TBD
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Orange Management
|
||||
*
|
||||
* PHP Version 7.0
|
||||
* PHP Version 7.1
|
||||
*
|
||||
* @category TBD
|
||||
* @package TBD
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Orange Management
|
||||
*
|
||||
* PHP Version 7.0
|
||||
* PHP Version 7.1
|
||||
*
|
||||
* @category TBD
|
||||
* @package TBD
|
||||
|
|
@ -28,6 +28,7 @@ return ['Tasks' => [
|
|||
'Forwarded' => 'Forwarded',
|
||||
'From' => 'From',
|
||||
'Group' => 'Group',
|
||||
'History' => 'History',
|
||||
'Interval' => 'Interval',
|
||||
'InTime' => 'In Time',
|
||||
'Message' => 'Message',
|
||||
|
|
@ -49,6 +50,7 @@ return ['Tasks' => [
|
|||
'Task' => 'Task',
|
||||
'Tasks' => 'Tasks',
|
||||
'Template' => 'Template',
|
||||
'Time' => 'Time',
|
||||
'Title' => 'Title',
|
||||
'To' => 'To',
|
||||
'Today' => 'Today',
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Orange Management
|
||||
*
|
||||
* PHP Version 7.0
|
||||
* PHP Version 7.1
|
||||
*
|
||||
* @category TBD
|
||||
* @package TBD
|
||||
|
|
@ -48,3 +48,11 @@ echo $this->getData('nav')->render(); ?>
|
|||
</table>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<div class="clear"></div>
|
||||
|
||||
<section class="box w-100 floatLeft">
|
||||
<header><h1><?= $this->getText('History'); ?></h1></header>
|
||||
<div class="inner" style="height: 300px">
|
||||
</div>
|
||||
</section>
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
/**
|
||||
* Orange Management
|
||||
*
|
||||
* PHP Version 7.0
|
||||
* PHP Version 7.1
|
||||
*
|
||||
* @category TBD
|
||||
* @package TBD
|
||||
|
|
@ -71,19 +71,23 @@ foreach ($elements as $key => $element) : $c++;
|
|||
|
||||
<section class="box w-50">
|
||||
<div class="inner">
|
||||
<form>
|
||||
<form id="taskElementCreate" method="POST" action="<?= \phpOMS\Uri\UriFactory::build('/{/lang}/api/task/element?csrf={$CSRF}'); ?>">
|
||||
<table class="layout wf-100">
|
||||
<tr><td><label for="iMessage"><?= $this->getText('Message'); ?></label>
|
||||
<tr><td><textarea></textarea>
|
||||
<tr><td><textarea id="iMessage" name="description"></textarea>
|
||||
<tr><td><label for="iDue"><?= $this->getText('Due'); ?></label>
|
||||
<tr><td><input type="datetime-local">
|
||||
<tr><td><label for="iReceiver"><?= $this->getText('Status'); ?></label>
|
||||
<tr><td><select>
|
||||
<option>
|
||||
<tr><td><input type="datetime-local" id="iDue" name="due" value="<?= end($elements)->getDue()->format('Y-m-d\TH:i:s'); ?>">
|
||||
<tr><td><label for="iStatus"><?= $this->getText('Status'); ?></label>
|
||||
<tr><td><select id="iStatus" name="status">
|
||||
<option value="<?= \Modules\Tasks\Models\TaskStatus::OPEN; ?>" selected>Open
|
||||
<option value="<?= \Modules\Tasks\Models\TaskStatus::WORKING; ?>">Working
|
||||
<option value="<?= \Modules\Tasks\Models\TaskStatus::SUSPENDED; ?>">Suspended
|
||||
<option value="<?= \Modules\Tasks\Models\TaskStatus::CANCELED; ?>">Canceled
|
||||
<option value="<?= \Modules\Tasks\Models\TaskStatus::DONE; ?>">Done
|
||||
</select>
|
||||
<tr><td><label for="iReceiver"><?= $this->getText('To'); ?></label>
|
||||
<tr><td><input type="text" id="iReceiver" placeholder=" Guest">
|
||||
<tr><td><input type="submit" value="<?= $this->getText('Create', 0, 0); ?>"><input type="hidden" name="type" value="1">
|
||||
<tr><td><input type="text" id="iReceiver" name="forward" value="<?= $this->request->getAccount(); ?>" placeholder=" Guest">
|
||||
<tr><td><input type="submit" value="<?= $this->getText('Create', 0, 0); ?>"><input type="hidden" name="task" value="<?= $this->request->getData('id') ?>"><input type="hidden" name="type" value="1">
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user