mirror of
https://github.com/Karaka-Management/oms-Kanban.git
synced 2026-02-18 21:28:40 +00:00
Implemented kanban models
This commit is contained in:
parent
fcfc232ca7
commit
3121092be8
|
|
@ -11,7 +11,7 @@
|
||||||
"order": 45,
|
"order": 45,
|
||||||
"from": "Kanban",
|
"from": "Kanban",
|
||||||
"permission": null,
|
"permission": null,
|
||||||
"parent": 1000101001,
|
"parent": 1003301001,
|
||||||
"children": [
|
"children": [
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
* @link http://orange-management.com
|
* @link http://orange-management.com
|
||||||
*/
|
*/
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
namespace Modules\Job\Admin;
|
namespace Modules\Kanban\Admin;
|
||||||
|
|
||||||
use phpOMS\DataStorage\Database\DatabaseType;
|
use phpOMS\DataStorage\Database\DatabaseType;
|
||||||
use phpOMS\DataStorage\Database\DatabasePool;
|
use phpOMS\DataStorage\Database\DatabasePool;
|
||||||
|
|
@ -57,6 +57,11 @@ class Installer extends InstallerAbstract
|
||||||
)ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;'
|
)ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;'
|
||||||
)->execute();
|
)->execute();
|
||||||
|
|
||||||
|
$dbPool->get('core')->con->prepare(
|
||||||
|
'ALTER TABLE `' . $dbPool->get('core')->prefix . 'kanban_board`
|
||||||
|
ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'kanban_board_ibfk_1` FOREIGN KEY (`kanban_board_created_by`) REFERENCES `' . $dbPool->get('core')->prefix . 'account` (`account_id`);'
|
||||||
|
)->execute();
|
||||||
|
|
||||||
$dbPool->get('core')->con->prepare(
|
$dbPool->get('core')->con->prepare(
|
||||||
'CREATE TABLE if NOT EXISTS `' . $dbPool->get('core')->prefix . 'kanban_column` (
|
'CREATE TABLE if NOT EXISTS `' . $dbPool->get('core')->prefix . 'kanban_column` (
|
||||||
`kanban_column_id` int(11) NOT NULL AUTO_INCREMENT,
|
`kanban_column_id` int(11) NOT NULL AUTO_INCREMENT,
|
||||||
|
|
@ -68,6 +73,11 @@ class Installer extends InstallerAbstract
|
||||||
)ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;'
|
)ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;'
|
||||||
)->execute();
|
)->execute();
|
||||||
|
|
||||||
|
$dbPool->get('core')->con->prepare(
|
||||||
|
'ALTER TABLE `' . $dbPool->get('core')->prefix . 'kanban_column`
|
||||||
|
ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'kanban_column_ibfk_1` FOREIGN KEY (`kanban_column_board`) REFERENCES `' . $dbPool->get('core')->prefix . 'kanban_board` (`kanban_board_id`);'
|
||||||
|
)->execute();
|
||||||
|
|
||||||
$dbPool->get('core')->con->prepare(
|
$dbPool->get('core')->con->prepare(
|
||||||
'CREATE TABLE if NOT EXISTS `' . $dbPool->get('core')->prefix . 'kanban_card` (
|
'CREATE TABLE if NOT EXISTS `' . $dbPool->get('core')->prefix . 'kanban_card` (
|
||||||
`kanban_card_id` int(11) NOT NULL AUTO_INCREMENT,
|
`kanban_card_id` int(11) NOT NULL AUTO_INCREMENT,
|
||||||
|
|
@ -75,33 +85,70 @@ class Installer extends InstallerAbstract
|
||||||
`kanban_card_description` text NOT NULL,
|
`kanban_card_description` text NOT NULL,
|
||||||
`kanban_card_type` int(2) NOT NULL,
|
`kanban_card_type` int(2) NOT NULL,
|
||||||
`kanban_card_status` int(2) NOT NULL,
|
`kanban_card_status` int(2) NOT NULL,
|
||||||
`kanban_card_ref` int(11) NOT NULL,
|
`kanban_card_ref` int(11) DEFAULT NULL,
|
||||||
`kanban_card_column` int(11) NOT NULL,
|
`kanban_card_column` int(11) NOT NULL,
|
||||||
`kanban_card_media` int(11) NOT NULL,
|
|
||||||
`kanban_card_created_at` datetime DEFAULT NULL,
|
`kanban_card_created_at` datetime DEFAULT NULL,
|
||||||
`kanban_card_created_by` int(11) DEFAULT NULL,
|
`kanban_card_created_by` int(11) DEFAULT NULL,
|
||||||
PRIMARY KEY (`kanban_card_id`),
|
PRIMARY KEY (`kanban_card_id`),
|
||||||
KEY `kanban_card_column` (`kanban_card_column`),
|
KEY `kanban_card_column` (`kanban_card_column`),
|
||||||
KEY `kanban_card_created_by` (`kanban_card_created_by`),
|
KEY `kanban_card_created_by` (`kanban_card_created_by`)
|
||||||
KEY `kanban_card_media` (`kanban_card_created_by`)
|
|
||||||
)ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;'
|
)ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;'
|
||||||
)->execute();
|
)->execute();
|
||||||
|
|
||||||
|
$dbPool->get('core')->con->prepare(
|
||||||
|
'ALTER TABLE `' . $dbPool->get('core')->prefix . 'kanban_card`
|
||||||
|
ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'kanban_card_ibfk_1` FOREIGN KEY (`kanban_card_column`) REFERENCES `' . $dbPool->get('core')->prefix . 'kanban_column` (`kanban_column_id`),
|
||||||
|
ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'kanban_card_ibfk_2` FOREIGN KEY (`kanban_card_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 . 'kanban_card_media` (
|
||||||
|
`kanban_card_media_id` int(11) NOT NULL AUTO_INCREMENT,
|
||||||
|
`kanban_card_media_dst` int(11) NOT NULL,
|
||||||
|
`kanban_card_media_src` int(11) NOT NULL,
|
||||||
|
PRIMARY KEY (`kanban_card_media_id`),
|
||||||
|
KEY `kanban_card_media_dst` (`kanban_card_card`),
|
||||||
|
KEY `kanban_card_media_src` (`kanban_card_media_src`)
|
||||||
|
)ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;'
|
||||||
|
)->execute();
|
||||||
|
|
||||||
|
$dbPool->get('core')->con->prepare(
|
||||||
|
'ALTER TABLE `' . $dbPool->get('core')->prefix . 'kanban_card_media`
|
||||||
|
ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'kanban_card_media_ibfk_1` FOREIGN KEY (`kanban_card_media_dst`) REFERENCES `' . $dbPool->get('core')->prefix . 'media` (`media_id`),
|
||||||
|
ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'kanban_card_media_ibfk_2` FOREIGN KEY (`kanban_card_media_src`) REFERENCES `' . $dbPool->get('core')->prefix . 'kanban_card` (`kanban_card_id`);'
|
||||||
|
)->execute();
|
||||||
|
|
||||||
// Task comments and these comments need to be merged which is bad but not every kanban card is a task and task info should be here as well.
|
// Task comments and these comments need to be merged which is bad but not every kanban card is a task and task info should be here as well.
|
||||||
$dbPool->get('core')->con->prepare(
|
$dbPool->get('core')->con->prepare(
|
||||||
'CREATE TABLE if NOT EXISTS `' . $dbPool->get('core')->prefix . 'kanban_card_comment` (
|
'CREATE TABLE if NOT EXISTS `' . $dbPool->get('core')->prefix . 'kanban_card_comment` (
|
||||||
`kanban_card_comment_id` int(11) NOT NULL AUTO_INCREMENT,
|
`kanban_card_comment_id` int(11) NOT NULL AUTO_INCREMENT,
|
||||||
`kanban_card_comment_description` text NOT NULL,
|
`kanban_card_comment_description` text NOT NULL,
|
||||||
|
`kanban_card_comment_card` int(11) NOT NULL,
|
||||||
`kanban_card_comment_created_at` datetime DEFAULT NULL,
|
`kanban_card_comment_created_at` datetime DEFAULT NULL,
|
||||||
`kanban_card_comment_created_by` int(11) DEFAULT NULL,
|
`kanban_card_comment_created_by` int(11) DEFAULT NULL,
|
||||||
`kanban_card_comment_media` int(11) DEFAULT NULL,
|
|
||||||
PRIMARY KEY (`kanban_card_comment_id`),
|
PRIMARY KEY (`kanban_card_comment_id`),
|
||||||
KEY `kanban_card_comment_column` (`kanban_card_comment_column`),
|
KEY `kanban_card_comment_card` (`kanban_card_comment_card`),
|
||||||
KEY `kanban_card_comment_created_by` (`kanban_card_comment_created_by`),
|
KEY `kanban_card_comment_created_by` (`kanban_card_comment_created_by`)
|
||||||
KEY `kanban_card_comment_media` (`kanban_card_comment_media`)
|
|
||||||
)ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;'
|
)ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;'
|
||||||
)->execute();
|
)->execute();
|
||||||
|
|
||||||
|
$dbPool->get('core')->con->prepare(
|
||||||
|
'CREATE TABLE if NOT EXISTS `' . $dbPool->get('core')->prefix . 'kanban_card_comment_media` (
|
||||||
|
`kanban_card_comment_media_id` int(11) NOT NULL AUTO_INCREMENT,
|
||||||
|
`kanban_card_comment_media_dst` int(11) NOT NULL,
|
||||||
|
`kanban_card_comment_media_src` int(11) NOT NULL,
|
||||||
|
PRIMARY KEY (`kanban_card_comment_media_id`),
|
||||||
|
KEY `kanban_card_comment_media_dst` (`kanban_card_comment_card`),
|
||||||
|
KEY `kanban_card_comment_media_src` (`kanban_card_comment_media_src`)
|
||||||
|
)ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;'
|
||||||
|
)->execute();
|
||||||
|
|
||||||
|
$dbPool->get('core')->con->prepare(
|
||||||
|
'ALTER TABLE `' . $dbPool->get('core')->prefix . 'kanban_card_comment_media`
|
||||||
|
ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'kanban_card_comment_media_ibfk_1` FOREIGN KEY (`kanban_card_comment_media_dst`) REFERENCES `' . $dbPool->get('core')->prefix . 'media` (`media_id`),
|
||||||
|
ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'kanban_card_comment_media_ibfk_2` FOREIGN KEY (`kanban_card_comment_media_src`) REFERENCES `' . $dbPool->get('core')->prefix . 'kanban_card_comment` (`kanban_card_comment_id`);'
|
||||||
|
)->execute();
|
||||||
|
|
||||||
$dbPool->get('core')->con->prepare(
|
$dbPool->get('core')->con->prepare(
|
||||||
'CREATE TABLE if NOT EXISTS `' . $dbPool->get('core')->prefix . 'kanban_activity` (
|
'CREATE TABLE if NOT EXISTS `' . $dbPool->get('core')->prefix . 'kanban_activity` (
|
||||||
`kanban_activity_id` int(11) NOT NULL AUTO_INCREMENT,
|
`kanban_activity_id` int(11) NOT NULL AUTO_INCREMENT,
|
||||||
|
|
|
||||||
|
|
@ -95,6 +95,9 @@ class Controller extends ModuleAbstract implements WebInterface
|
||||||
$view->setTemplate('/Modules/Kanban/Theme/Backend/kanban-dashboard');
|
$view->setTemplate('/Modules/Kanban/Theme/Backend/kanban-dashboard');
|
||||||
$view->addData('nav', $this->app->moduleManager->get('Navigation')->createNavigationMid(1005801001, $request, $response));
|
$view->addData('nav', $this->app->moduleManager->get('Navigation')->createNavigationMid(1005801001, $request, $response));
|
||||||
|
|
||||||
|
$list = KanbanBoardMapper::getNewest(50);
|
||||||
|
$view->setData('boards', $list);
|
||||||
|
|
||||||
return $view;
|
return $view;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
39
Models/BoardStatus.php
Normal file
39
Models/BoardStatus.php
Normal file
|
|
@ -0,0 +1,39 @@
|
||||||
|
<?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 Dennis Eichhorn
|
||||||
|
* @license OMS License 1.0
|
||||||
|
* @version 1.0.0
|
||||||
|
* @link http://orange-management.com
|
||||||
|
*/
|
||||||
|
declare(strict_types=1);
|
||||||
|
namespace Modules\Kanban\Models;
|
||||||
|
|
||||||
|
use phpOMS\Datatypes\Enum;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Task status enum.
|
||||||
|
*
|
||||||
|
* @category Kanban
|
||||||
|
* @package Modules
|
||||||
|
* @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
|
||||||
|
*/
|
||||||
|
abstract class BoardStatus extends Enum
|
||||||
|
{
|
||||||
|
/* public */ const ACTIVE = 1;
|
||||||
|
|
||||||
|
/* public */ const INACTIVE = 2;
|
||||||
|
|
||||||
|
/* public */ const ARCHIVED = 3;
|
||||||
|
}
|
||||||
39
Models/CardStatus.php
Normal file
39
Models/CardStatus.php
Normal file
|
|
@ -0,0 +1,39 @@
|
||||||
|
<?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 Dennis Eichhorn
|
||||||
|
* @license OMS License 1.0
|
||||||
|
* @version 1.0.0
|
||||||
|
* @link http://orange-management.com
|
||||||
|
*/
|
||||||
|
declare(strict_types=1);
|
||||||
|
namespace Modules\Kanban\Models;
|
||||||
|
|
||||||
|
use phpOMS\Datatypes\Enum;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Task status enum.
|
||||||
|
*
|
||||||
|
* @category Kanban
|
||||||
|
* @package Modules
|
||||||
|
* @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
|
||||||
|
*/
|
||||||
|
abstract class CardStatus extends Enum
|
||||||
|
{
|
||||||
|
/* public */ const ACTIVE = 1;
|
||||||
|
|
||||||
|
/* public */ const INACTIVE = 2;
|
||||||
|
|
||||||
|
/* public */ const ARCHIVED = 3;
|
||||||
|
}
|
||||||
127
Models/KanbanBoard.php
Normal file
127
Models/KanbanBoard.php
Normal file
|
|
@ -0,0 +1,127 @@
|
||||||
|
<?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 Dennis Eichhorn
|
||||||
|
* @license OMS License 1.0
|
||||||
|
* @version 1.0.0
|
||||||
|
* @link http://orange-management.com
|
||||||
|
*/
|
||||||
|
declare(strict_types=1);
|
||||||
|
namespace Modules\Kanban\Models;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Task class.
|
||||||
|
*
|
||||||
|
* @category Kanban
|
||||||
|
* @package Modules
|
||||||
|
* @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 KanbanBoard implements \JsonSerializable
|
||||||
|
{
|
||||||
|
private $id = 0;
|
||||||
|
|
||||||
|
private $name = '';
|
||||||
|
|
||||||
|
private $status = BoardStatus::ACTIVE;
|
||||||
|
|
||||||
|
private $description = '';
|
||||||
|
|
||||||
|
private $createdBy = 0;
|
||||||
|
|
||||||
|
private $createdAt = null;
|
||||||
|
|
||||||
|
private $columns = [];
|
||||||
|
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
$this->createdAt = new \DateTime('now');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getId() : int
|
||||||
|
{
|
||||||
|
return $this->id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getName() : string
|
||||||
|
{
|
||||||
|
return $this->name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setName(string $name) /* : void */
|
||||||
|
{
|
||||||
|
$this->name = $name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getStatus() : int
|
||||||
|
{
|
||||||
|
return $this->status;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setStatus(int $status) /* : void */
|
||||||
|
{
|
||||||
|
$this->status = $status;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getDescription() : string
|
||||||
|
{
|
||||||
|
return $this->description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setDescription(string $description) /* : void */
|
||||||
|
{
|
||||||
|
$this->description = $description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getCreatedBy() : int
|
||||||
|
{
|
||||||
|
return $this->createdBy;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setCreatedBy(int $id) /* : void */
|
||||||
|
{
|
||||||
|
$this->createdBy = $id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getCreatedAt() : \DateTime
|
||||||
|
{
|
||||||
|
return $this->createdAt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getColumns() : array
|
||||||
|
{
|
||||||
|
return $this->columns;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function addColumn(KanbanColumn $column) /* : void */
|
||||||
|
{
|
||||||
|
$this->columns[] = $column;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function removeColumn(int $id) : bool
|
||||||
|
{
|
||||||
|
if(isset($this->columns[$id])) {
|
||||||
|
unset($this->columns[$id]);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function jsonSerealize() : array
|
||||||
|
{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
}
|
||||||
158
Models/KanbanBoardMapper.php
Normal file
158
Models/KanbanBoardMapper.php
Normal file
|
|
@ -0,0 +1,158 @@
|
||||||
|
<?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 Dennis Eichhorn
|
||||||
|
* @license OMS License 1.0
|
||||||
|
* @version 1.0.0
|
||||||
|
* @link http://orange-management.com
|
||||||
|
*/
|
||||||
|
declare(strict_types=1);
|
||||||
|
namespace Modules\Kanban\Models;
|
||||||
|
|
||||||
|
use phpOMS\DataStorage\Database\DataMapperAbstract;
|
||||||
|
use phpOMS\DataStorage\Database\Query\Builder;
|
||||||
|
use phpOMS\DataStorage\Database\Query\Column;
|
||||||
|
use phpOMS\DataStorage\Database\RelationType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Mapper class.
|
||||||
|
*
|
||||||
|
* @category Tasks
|
||||||
|
* @package Modules
|
||||||
|
* @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 KanbanBoardMapper extends DataMapperAbstract
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Columns.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
protected static $columns = [
|
||||||
|
'kanban_board_id' => ['name' => 'kanban_board_id', 'type' => 'int', 'internal' => 'id'],
|
||||||
|
'kanban_board_name' => ['name' => 'kanban_board_name', 'type' => 'string', 'internal' => 'name'],
|
||||||
|
'kanban_board_desc' => ['name' => 'kanban_board_desc', 'type' => 'string', 'internal' => 'description'],
|
||||||
|
'kanban_board_status' => ['name' => 'kanban_board_status', 'type' => 'int', 'internal' => 'status'],
|
||||||
|
'kanban_board_created_by' => ['name' => 'kanban_board_created_by', 'type' => 'int', 'internal' => 'createdBy'],
|
||||||
|
'kanban_board_created_at' => ['name' => 'kanban_board_created_at', 'type' => 'DateTime', 'internal' => 'createdAt'],
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Has many relation.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
protected static $hasMany = [
|
||||||
|
'columns' => [
|
||||||
|
'mapper' => KanbanColumnMapper::class,
|
||||||
|
'table' => 'kanban_column',
|
||||||
|
'dst' => 'kanban_column_board',
|
||||||
|
'src' => null,
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Primary table.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
protected static $table = 'kanban_board';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created at.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
protected static $createdAt = 'kanban_board_created_at';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Primary field name.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
protected static $primaryField = 'kanban_board_id';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create object.
|
||||||
|
*
|
||||||
|
* @param mixed $obj Object
|
||||||
|
* @param int $relations Behavior for relations creation
|
||||||
|
*
|
||||||
|
* @return mixed
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||||
|
*/
|
||||||
|
public static function create($obj, int $relations = RelationType::ALL)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$objId = parent::create($obj, $relations);
|
||||||
|
|
||||||
|
if($objId === null || !is_scalar($objId)) {
|
||||||
|
return $objId;
|
||||||
|
}
|
||||||
|
|
||||||
|
$query = new Builder(self::$db);
|
||||||
|
|
||||||
|
$query->prefix(self::$db->getPrefix())
|
||||||
|
->insert(
|
||||||
|
'account_permission_account',
|
||||||
|
'account_permission_from',
|
||||||
|
'account_permission_for',
|
||||||
|
'account_permission_id1',
|
||||||
|
'account_permission_id2',
|
||||||
|
'account_permission_r',
|
||||||
|
'account_permission_w',
|
||||||
|
'account_permission_m',
|
||||||
|
'account_permission_d',
|
||||||
|
'account_permission_p'
|
||||||
|
)
|
||||||
|
->into('account_permission')
|
||||||
|
->values($obj->getCreatedBy(), 'task', 'task', 1, $objId, 1, 1, 1, 1, 1);
|
||||||
|
|
||||||
|
self::$db->con->prepare($query->toSql())->execute();
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
var_dump($e->getMessage());
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $objId;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Find.
|
||||||
|
*
|
||||||
|
* @param array $columns Columns to select
|
||||||
|
*
|
||||||
|
* @return Builder
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||||
|
*/
|
||||||
|
public static function find(...$columns) : Builder
|
||||||
|
{
|
||||||
|
return parent::find(...$columns)->from('account_permission')
|
||||||
|
->where('account_permission.account_permission_for', '=', 'task')
|
||||||
|
->where('account_permission.account_permission_id1', '=', 1)
|
||||||
|
->where('task.task_id', '=', new Column('account_permission.account_permission_id2'))
|
||||||
|
->where('account_permission.account_permission_r', '=', 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
178
Models/KanbanCard.php
Normal file
178
Models/KanbanCard.php
Normal file
|
|
@ -0,0 +1,178 @@
|
||||||
|
<?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 Dennis Eichhorn
|
||||||
|
* @license OMS License 1.0
|
||||||
|
* @version 1.0.0
|
||||||
|
* @link http://orange-management.com
|
||||||
|
*/
|
||||||
|
declare(strict_types=1);
|
||||||
|
namespace Modules\Kanban\Models;
|
||||||
|
|
||||||
|
use Modules\Media\Models\Media;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Task class.
|
||||||
|
*
|
||||||
|
* @category Kanban
|
||||||
|
* @package Modules
|
||||||
|
* @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 KanbanCard implements \JsonSerializable
|
||||||
|
{
|
||||||
|
private $id = 0;
|
||||||
|
|
||||||
|
private $name = '';
|
||||||
|
|
||||||
|
private $status = CardStatus::ACTIVE;
|
||||||
|
|
||||||
|
private $type = CardType::TEXT;
|
||||||
|
|
||||||
|
private $description = '';
|
||||||
|
|
||||||
|
private $column = 0;
|
||||||
|
|
||||||
|
private $ref = 0;
|
||||||
|
|
||||||
|
private $createdBy = 0;
|
||||||
|
|
||||||
|
private $createdAt = null;
|
||||||
|
|
||||||
|
private $comments = [];
|
||||||
|
|
||||||
|
private $labels = [];
|
||||||
|
|
||||||
|
private $media = [];
|
||||||
|
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
$this->createdAt = new \DateTime('now');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getId() : int
|
||||||
|
{
|
||||||
|
return $this->id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setColumn(int $id) /* : void */
|
||||||
|
{
|
||||||
|
$this->column = $id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getColumn() : int
|
||||||
|
{
|
||||||
|
return $this->column;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getName() : string
|
||||||
|
{
|
||||||
|
return $this->name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setName(string $name) /* : void */
|
||||||
|
{
|
||||||
|
$this->name = $name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getStatus() : int
|
||||||
|
{
|
||||||
|
return $this->status;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setStatus(int $status) /* : void */
|
||||||
|
{
|
||||||
|
$this->status = $status;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getType() : int
|
||||||
|
{
|
||||||
|
return $this->type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setType(int $type) /* : void */
|
||||||
|
{
|
||||||
|
$this->type = $type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getRef() : int
|
||||||
|
{
|
||||||
|
return $this->ref;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setRef(int $ref) /* : void */
|
||||||
|
{
|
||||||
|
$this->ref = $ref;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getDescription() : string
|
||||||
|
{
|
||||||
|
return $this->description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setDescription(string $description) /* : void */
|
||||||
|
{
|
||||||
|
$this->description = $description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getCreatedBy() : int
|
||||||
|
{
|
||||||
|
return $this->createdBy;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setCreatedBy(int $id) /* : void */
|
||||||
|
{
|
||||||
|
$this->createdBy = $id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getCreatedAt() : \DateTime
|
||||||
|
{
|
||||||
|
return $this->createdAt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getComments() : array
|
||||||
|
{
|
||||||
|
return $this->comments;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function addComment(KanbanCardComment $comment) /* : void */
|
||||||
|
{
|
||||||
|
$this->comments[] = $comment;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function removeComment(int $id) : bool
|
||||||
|
{
|
||||||
|
if(isset($this->comment[$id])) {
|
||||||
|
unset($this->comment[$id]);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getMedia() : array
|
||||||
|
{
|
||||||
|
return $this->media;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function addMedia(Media $media) /* : void */
|
||||||
|
{
|
||||||
|
$this->media[] = $media;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function jsonSerealize() : array
|
||||||
|
{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
}
|
||||||
110
Models/KanbanCardComment.php
Normal file
110
Models/KanbanCardComment.php
Normal file
|
|
@ -0,0 +1,110 @@
|
||||||
|
<?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 Dennis Eichhorn
|
||||||
|
* @license OMS License 1.0
|
||||||
|
* @version 1.0.0
|
||||||
|
* @link http://orange-management.com
|
||||||
|
*/
|
||||||
|
declare(strict_types=1);
|
||||||
|
namespace Modules\Kanban\Models;
|
||||||
|
|
||||||
|
use Modules\Media\Models\Media;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Task class.
|
||||||
|
*
|
||||||
|
* @category Kanban
|
||||||
|
* @package Modules
|
||||||
|
* @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 KanbanCardComment implements \JsonSerializable
|
||||||
|
{
|
||||||
|
private $id = 0;
|
||||||
|
|
||||||
|
private $description = '';
|
||||||
|
|
||||||
|
private $card = 0;
|
||||||
|
|
||||||
|
private $createdBy = 0;
|
||||||
|
|
||||||
|
private $createdAt = null;
|
||||||
|
|
||||||
|
private $media = [];
|
||||||
|
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
$this->createdAt = new \DateTime('now');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getId() : int
|
||||||
|
{
|
||||||
|
return $this->id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setCard(int $id) /* : void */
|
||||||
|
{
|
||||||
|
$this->card = $id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getCard() : int
|
||||||
|
{
|
||||||
|
return $this->card;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getDescription() : string
|
||||||
|
{
|
||||||
|
return $this->description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setDescription(string $description) /* : void */
|
||||||
|
{
|
||||||
|
$this->description = $description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getCreatedBy() : int
|
||||||
|
{
|
||||||
|
return $this->createdBy;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setCreatedBy(int $id) /* : void */
|
||||||
|
{
|
||||||
|
$this->createdBy = $id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getCreatedAt() : \DateTime
|
||||||
|
{
|
||||||
|
return $this->createdAt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getComments() : array
|
||||||
|
{
|
||||||
|
return $this->comments;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getMedia() : array
|
||||||
|
{
|
||||||
|
return $this->media;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function addMedia(Media $media) /* : void */
|
||||||
|
{
|
||||||
|
$this->media[] = $media;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function jsonSerealize() : array
|
||||||
|
{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
}
|
||||||
158
Models/KanbanCardCommentMapper.php
Normal file
158
Models/KanbanCardCommentMapper.php
Normal file
|
|
@ -0,0 +1,158 @@
|
||||||
|
<?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 Dennis Eichhorn
|
||||||
|
* @license OMS License 1.0
|
||||||
|
* @version 1.0.0
|
||||||
|
* @link http://orange-management.com
|
||||||
|
*/
|
||||||
|
declare(strict_types=1);
|
||||||
|
namespace Modules\Kanban\Models;
|
||||||
|
|
||||||
|
use phpOMS\DataStorage\Database\DataMapperAbstract;
|
||||||
|
use phpOMS\DataStorage\Database\Query\Builder;
|
||||||
|
use phpOMS\DataStorage\Database\Query\Column;
|
||||||
|
use phpOMS\DataStorage\Database\RelationType;
|
||||||
|
use Modules\Media\Models\MediaMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Mapper class.
|
||||||
|
*
|
||||||
|
* @category Tasks
|
||||||
|
* @package Modules
|
||||||
|
* @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 KanbanBoardMapper extends DataMapperAbstract
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Columns.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
protected static $columns = [
|
||||||
|
'kanban_card_comment_id' => ['name' => 'kanban_card_comment_id', 'type' => 'int', 'internal' => 'id'],
|
||||||
|
'kanban_card_comment_description' => ['name' => 'kanban_card_comment_description', 'type' => 'string', 'internal' => 'description'],
|
||||||
|
'kanban_card_comment_card' => ['name' => 'kanban_card_comment_card', 'type' => 'int', 'internal' => 'card'],
|
||||||
|
'kanban_card_comment_created_at' => ['name' => 'kanban_card_comment_created_at', 'type' => 'DateTime', 'internal' => 'createdAt'],
|
||||||
|
'kanban_card_comment_created_by' => ['name' => 'kanban_card_comment_created_by', 'type' => 'int', 'internal' => 'createdBy'],
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Has many relation.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
protected static $hasMany = [
|
||||||
|
'media' => [
|
||||||
|
'mapper' => MediaMapper::class,
|
||||||
|
'table' => 'kanban_card_comment_media',
|
||||||
|
'dst' => 'kanban_card_comment_media_dst',
|
||||||
|
'src' => 'kanban_card_comment_media_src',
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Primary table.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
protected static $table = 'kanban_card_comment';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created at.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
protected static $createdAt = 'kanban_card_comment_created_at';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Primary field name.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
protected static $primaryField = 'kanban_card_comment_id';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create object.
|
||||||
|
*
|
||||||
|
* @param mixed $obj Object
|
||||||
|
* @param int $relations Behavior for relations creation
|
||||||
|
*
|
||||||
|
* @return mixed
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||||
|
*/
|
||||||
|
public static function create($obj, int $relations = RelationType::ALL)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$objId = parent::create($obj, $relations);
|
||||||
|
|
||||||
|
if($objId === null || !is_scalar($objId)) {
|
||||||
|
return $objId;
|
||||||
|
}
|
||||||
|
|
||||||
|
$query = new Builder(self::$db);
|
||||||
|
|
||||||
|
$query->prefix(self::$db->getPrefix())
|
||||||
|
->insert(
|
||||||
|
'account_permission_account',
|
||||||
|
'account_permission_from',
|
||||||
|
'account_permission_for',
|
||||||
|
'account_permission_id1',
|
||||||
|
'account_permission_id2',
|
||||||
|
'account_permission_r',
|
||||||
|
'account_permission_w',
|
||||||
|
'account_permission_m',
|
||||||
|
'account_permission_d',
|
||||||
|
'account_permission_p'
|
||||||
|
)
|
||||||
|
->into('account_permission')
|
||||||
|
->values($obj->getCreatedBy(), 'task', 'task', 1, $objId, 1, 1, 1, 1, 1);
|
||||||
|
|
||||||
|
self::$db->con->prepare($query->toSql())->execute();
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
var_dump($e->getMessage());
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $objId;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Find.
|
||||||
|
*
|
||||||
|
* @param array $columns Columns to select
|
||||||
|
*
|
||||||
|
* @return Builder
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||||
|
*/
|
||||||
|
public static function find(...$columns) : Builder
|
||||||
|
{
|
||||||
|
return parent::find(...$columns)->from('account_permission')
|
||||||
|
->where('account_permission.account_permission_for', '=', 'task')
|
||||||
|
->where('account_permission.account_permission_id1', '=', 1)
|
||||||
|
->where('task.task_id', '=', new Column('account_permission.account_permission_id2'))
|
||||||
|
->where('account_permission.account_permission_r', '=', 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
174
Models/KanbanCardMapper.php
Normal file
174
Models/KanbanCardMapper.php
Normal file
|
|
@ -0,0 +1,174 @@
|
||||||
|
<?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 Dennis Eichhorn
|
||||||
|
* @license OMS License 1.0
|
||||||
|
* @version 1.0.0
|
||||||
|
* @link http://orange-management.com
|
||||||
|
*/
|
||||||
|
declare(strict_types=1);
|
||||||
|
namespace Modules\Kanban\Models;
|
||||||
|
|
||||||
|
use phpOMS\DataStorage\Database\DataMapperAbstract;
|
||||||
|
use phpOMS\DataStorage\Database\Query\Builder;
|
||||||
|
use phpOMS\DataStorage\Database\Query\Column;
|
||||||
|
use phpOMS\DataStorage\Database\RelationType;
|
||||||
|
use Modules\Media\Models\MediaMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Mapper class.
|
||||||
|
*
|
||||||
|
* @category Tasks
|
||||||
|
* @package Modules
|
||||||
|
* @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 KanbanBoardMapper extends DataMapperAbstract
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Columns.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
protected static $columns = [
|
||||||
|
'kanban_card_id' => ['name' => 'kanban_card_id', 'type' => 'int', 'internal' => 'id'],
|
||||||
|
'kanban_card_name' => ['name' => 'kanban_card_name', 'type' => 'string', 'internal' => 'name'],
|
||||||
|
'kanban_card_description' => ['name' => 'kanban_card_description', 'type' => 'string', 'internal' => 'description'],
|
||||||
|
'kanban_card_type' => ['name' => 'kanban_card_type', 'type' => 'int', 'internal' => 'type'],
|
||||||
|
'kanban_card_status' => ['name' => 'kanban_card_status', 'type' => 'int', 'internal' => 'status'],
|
||||||
|
'kanban_card_ref' => ['name' => 'kanban_card_ref', 'type' => 'int', 'internal' => 'ref'],
|
||||||
|
'kanban_card_column' => ['name' => 'kanban_card_column', 'type' => 'int', 'internal' => 'column'],
|
||||||
|
'kanban_card_created_at' => ['name' => 'kanban_card_created_at', 'type' => 'DateTime', 'internal' => 'createdAt'],
|
||||||
|
'kanban_card_created_by' => ['name' => 'kanban_card_created_by', 'type' => 'int', 'internal' => 'createdBy'],
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Has many relation.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
protected static $hasMany = [
|
||||||
|
'media' => [
|
||||||
|
'mapper' => MediaMapper::class,
|
||||||
|
'table' => 'kanban_card_media',
|
||||||
|
'dst' => 'kanban_card_media_dst',
|
||||||
|
'src' => 'kanban_card_media_src',
|
||||||
|
],
|
||||||
|
'labels' => [
|
||||||
|
'mapper' => LabelMapper::class,
|
||||||
|
'table' => 'kanban_card_label',
|
||||||
|
'dst' => 'kanban_card_label_dst',
|
||||||
|
'src' => 'kanban_card_label_src',
|
||||||
|
],
|
||||||
|
'comments' => [
|
||||||
|
'mapper' => KanbanCardCommentMapper::class,
|
||||||
|
'table' => 'kanban_card_label',
|
||||||
|
'dst' => 'kanban_card_label_dst',
|
||||||
|
'src' => 'kanban_card_label_src',
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Primary table.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
protected static $table = 'kanban_card';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created at.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
protected static $createdAt = 'kanban_card_created_at';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Primary field name.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
protected static $primaryField = 'kanban_card_id';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create object.
|
||||||
|
*
|
||||||
|
* @param mixed $obj Object
|
||||||
|
* @param int $relations Behavior for relations creation
|
||||||
|
*
|
||||||
|
* @return mixed
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||||
|
*/
|
||||||
|
public static function create($obj, int $relations = RelationType::ALL)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$objId = parent::create($obj, $relations);
|
||||||
|
|
||||||
|
if($objId === null || !is_scalar($objId)) {
|
||||||
|
return $objId;
|
||||||
|
}
|
||||||
|
|
||||||
|
$query = new Builder(self::$db);
|
||||||
|
|
||||||
|
$query->prefix(self::$db->getPrefix())
|
||||||
|
->insert(
|
||||||
|
'account_permission_account',
|
||||||
|
'account_permission_from',
|
||||||
|
'account_permission_for',
|
||||||
|
'account_permission_id1',
|
||||||
|
'account_permission_id2',
|
||||||
|
'account_permission_r',
|
||||||
|
'account_permission_w',
|
||||||
|
'account_permission_m',
|
||||||
|
'account_permission_d',
|
||||||
|
'account_permission_p'
|
||||||
|
)
|
||||||
|
->into('account_permission')
|
||||||
|
->values($obj->getCreatedBy(), 'task', 'task', 1, $objId, 1, 1, 1, 1, 1);
|
||||||
|
|
||||||
|
self::$db->con->prepare($query->toSql())->execute();
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
var_dump($e->getMessage());
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $objId;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Find.
|
||||||
|
*
|
||||||
|
* @param array $columns Columns to select
|
||||||
|
*
|
||||||
|
* @return Builder
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||||
|
*/
|
||||||
|
public static function find(...$columns) : Builder
|
||||||
|
{
|
||||||
|
return parent::find(...$columns)->from('account_permission')
|
||||||
|
->where('account_permission.account_permission_for', '=', 'task')
|
||||||
|
->where('account_permission.account_permission_id1', '=', 1)
|
||||||
|
->where('task.task_id', '=', new Column('account_permission.account_permission_id2'))
|
||||||
|
->where('account_permission.account_permission_r', '=', 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
87
Models/KanbanColumn.php
Normal file
87
Models/KanbanColumn.php
Normal file
|
|
@ -0,0 +1,87 @@
|
||||||
|
<?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 Dennis Eichhorn
|
||||||
|
* @license OMS License 1.0
|
||||||
|
* @version 1.0.0
|
||||||
|
* @link http://orange-management.com
|
||||||
|
*/
|
||||||
|
declare(strict_types=1);
|
||||||
|
namespace Modules\Column\Models;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Task class.
|
||||||
|
*
|
||||||
|
* @category Kanban
|
||||||
|
* @package Modules
|
||||||
|
* @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 KanbanColumn implements \JsonSerializable
|
||||||
|
{
|
||||||
|
private $id = 0;
|
||||||
|
|
||||||
|
private $name = '';
|
||||||
|
|
||||||
|
private $order = 0;
|
||||||
|
|
||||||
|
private $board = 0;
|
||||||
|
|
||||||
|
private $cards = [];
|
||||||
|
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getId() : int
|
||||||
|
{
|
||||||
|
return $this->id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getName() : string
|
||||||
|
{
|
||||||
|
return $this->name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setName(string $name) /* : void */
|
||||||
|
{
|
||||||
|
$this->name = $name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getCards() : array
|
||||||
|
{
|
||||||
|
return $this->cards;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function addCard(KanbanCard $card) /* : void */
|
||||||
|
{
|
||||||
|
$this->cards[] = $card;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function removeCard(int $id) : bool
|
||||||
|
{
|
||||||
|
if(isset($this->cards[$id])) {
|
||||||
|
unset($this->cards[$id]);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function jsonSerealize() : array
|
||||||
|
{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
}
|
||||||
148
Models/KanbanColumnMapper.php
Normal file
148
Models/KanbanColumnMapper.php
Normal file
|
|
@ -0,0 +1,148 @@
|
||||||
|
<?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 Dennis Eichhorn
|
||||||
|
* @license OMS License 1.0
|
||||||
|
* @version 1.0.0
|
||||||
|
* @link http://orange-management.com
|
||||||
|
*/
|
||||||
|
declare(strict_types=1);
|
||||||
|
namespace Modules\Kanban\Models;
|
||||||
|
|
||||||
|
use phpOMS\DataStorage\Database\DataMapperAbstract;
|
||||||
|
use phpOMS\DataStorage\Database\Query\Builder;
|
||||||
|
use phpOMS\DataStorage\Database\Query\Column;
|
||||||
|
use phpOMS\DataStorage\Database\RelationType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Mapper class.
|
||||||
|
*
|
||||||
|
* @category Tasks
|
||||||
|
* @package Modules
|
||||||
|
* @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 KanbanBoardMapper extends DataMapperAbstract
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Columns.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
protected static $columns = [
|
||||||
|
'kanban_column_id' => ['name' => 'kanban_column_id', 'type' => 'int', 'internal' => 'id'],
|
||||||
|
'kanban_column_name' => ['name' => 'kanban_column_name', 'type' => 'string', 'internal' => 'name'],
|
||||||
|
'kanban_column_order' => ['name' => 'kanban_column_order', 'type' => 'int', 'internal' => 'order'],
|
||||||
|
'kanban_column_board' => ['name' => 'kanban_column_board', 'type' => 'int', 'internal' => 'board'],
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Has many relation.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
protected static $hasMany = [
|
||||||
|
'cards' => [
|
||||||
|
'mapper' => KanbanCardMapper::class,
|
||||||
|
'table' => 'kanban_card',
|
||||||
|
'dst' => 'kanban_card_column',
|
||||||
|
'src' => null,
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Primary table.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
protected static $table = 'kanban_column';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Primary field name.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
protected static $primaryField = 'kanban_column_id';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create object.
|
||||||
|
*
|
||||||
|
* @param mixed $obj Object
|
||||||
|
* @param int $relations Behavior for relations creation
|
||||||
|
*
|
||||||
|
* @return mixed
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||||
|
*/
|
||||||
|
public static function create($obj, int $relations = RelationType::ALL)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$objId = parent::create($obj, $relations);
|
||||||
|
|
||||||
|
if($objId === null || !is_scalar($objId)) {
|
||||||
|
return $objId;
|
||||||
|
}
|
||||||
|
|
||||||
|
$query = new Builder(self::$db);
|
||||||
|
|
||||||
|
$query->prefix(self::$db->getPrefix())
|
||||||
|
->insert(
|
||||||
|
'account_permission_account',
|
||||||
|
'account_permission_from',
|
||||||
|
'account_permission_for',
|
||||||
|
'account_permission_id1',
|
||||||
|
'account_permission_id2',
|
||||||
|
'account_permission_r',
|
||||||
|
'account_permission_w',
|
||||||
|
'account_permission_m',
|
||||||
|
'account_permission_d',
|
||||||
|
'account_permission_p'
|
||||||
|
)
|
||||||
|
->into('account_permission')
|
||||||
|
->values($obj->getCreatedBy(), 'task', 'task', 1, $objId, 1, 1, 1, 1, 1);
|
||||||
|
|
||||||
|
self::$db->con->prepare($query->toSql())->execute();
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
var_dump($e->getMessage());
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $objId;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Find.
|
||||||
|
*
|
||||||
|
* @param array $columns Columns to select
|
||||||
|
*
|
||||||
|
* @return Builder
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||||
|
*/
|
||||||
|
public static function find(...$columns) : Builder
|
||||||
|
{
|
||||||
|
return parent::find(...$columns)->from('account_permission')
|
||||||
|
->where('account_permission.account_permission_for', '=', 'task')
|
||||||
|
->where('account_permission.account_permission_id1', '=', 1)
|
||||||
|
->where('task.task_id', '=', new Column('account_permission.account_permission_id2'))
|
||||||
|
->where('account_permission.account_permission_r', '=', 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
80
Models/KanbanLabel.php
Normal file
80
Models/KanbanLabel.php
Normal file
|
|
@ -0,0 +1,80 @@
|
||||||
|
<?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 Dennis Eichhorn
|
||||||
|
* @license OMS License 1.0
|
||||||
|
* @version 1.0.0
|
||||||
|
* @link http://orange-management.com
|
||||||
|
*/
|
||||||
|
declare(strict_types=1);
|
||||||
|
namespace Modules\Kanban\Models;
|
||||||
|
|
||||||
|
use Modules\Media\Models\Media;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Task class.
|
||||||
|
*
|
||||||
|
* @category Kanban
|
||||||
|
* @package Modules
|
||||||
|
* @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 KanbanLabel implements \JsonSerializable
|
||||||
|
{
|
||||||
|
private $id = 0;
|
||||||
|
|
||||||
|
private $name = '';
|
||||||
|
|
||||||
|
private $board = 0;
|
||||||
|
|
||||||
|
private $color = 0;
|
||||||
|
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getId() : int
|
||||||
|
{
|
||||||
|
return $this->id;
|
||||||
|
}
|
||||||
|
public function getName() : int
|
||||||
|
{
|
||||||
|
return $this->name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setName(string $name) /* : void */
|
||||||
|
{
|
||||||
|
$this->name = $name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setColor(int $color) /* : void */
|
||||||
|
{
|
||||||
|
$this->color = $color;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getColor() : int
|
||||||
|
{
|
||||||
|
return $this->color;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getBoard() : int
|
||||||
|
{
|
||||||
|
return $this->board;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setBoard(int $board) /* : void */
|
||||||
|
{
|
||||||
|
$this->board = $board;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
133
Models/KanbanLabelMapper.php
Normal file
133
Models/KanbanLabelMapper.php
Normal file
|
|
@ -0,0 +1,133 @@
|
||||||
|
<?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 Dennis Eichhorn
|
||||||
|
* @license OMS License 1.0
|
||||||
|
* @version 1.0.0
|
||||||
|
* @link http://orange-management.com
|
||||||
|
*/
|
||||||
|
declare(strict_types=1);
|
||||||
|
namespace Modules\Kanban\Models;
|
||||||
|
|
||||||
|
use phpOMS\DataStorage\Database\DataMapperAbstract;
|
||||||
|
use phpOMS\DataStorage\Database\Query\Builder;
|
||||||
|
use phpOMS\DataStorage\Database\Query\Column;
|
||||||
|
use phpOMS\DataStorage\Database\RelationType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Mapper class.
|
||||||
|
*
|
||||||
|
* @category Tasks
|
||||||
|
* @package Modules
|
||||||
|
* @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 KanbanLabelMapper extends DataMapperAbstract
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Columns.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
protected static $columns = [
|
||||||
|
'kanban_label_id' => ['name' => 'kanban_label_id', 'type' => 'int', 'internal' => 'id'],
|
||||||
|
'kanban_label_name' => ['name' => 'kanban_label_name', 'type' => 'string', 'internal' => 'name'],
|
||||||
|
'kanban_label_color' => ['name' => 'kanban_label_color', 'type' => 'int', 'internal' => 'color'],
|
||||||
|
'kanban_label_board' => ['name' => 'kanban_label_board', 'type' => 'int', 'internal' => 'board'],
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Primary table.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
protected static $table = 'kanban_label';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Primary field name.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
protected static $primaryField = 'kanban_label_id';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create object.
|
||||||
|
*
|
||||||
|
* @param mixed $obj Object
|
||||||
|
* @param int $relations Behavior for relations creation
|
||||||
|
*
|
||||||
|
* @return mixed
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||||
|
*/
|
||||||
|
public static function create($obj, int $relations = RelationType::ALL)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$objId = parent::create($obj, $relations);
|
||||||
|
|
||||||
|
if($objId === null || !is_scalar($objId)) {
|
||||||
|
return $objId;
|
||||||
|
}
|
||||||
|
|
||||||
|
$query = new Builder(self::$db);
|
||||||
|
|
||||||
|
$query->prefix(self::$db->getPrefix())
|
||||||
|
->insert(
|
||||||
|
'account_permission_account',
|
||||||
|
'account_permission_from',
|
||||||
|
'account_permission_for',
|
||||||
|
'account_permission_id1',
|
||||||
|
'account_permission_id2',
|
||||||
|
'account_permission_r',
|
||||||
|
'account_permission_w',
|
||||||
|
'account_permission_m',
|
||||||
|
'account_permission_d',
|
||||||
|
'account_permission_p'
|
||||||
|
)
|
||||||
|
->into('account_permission')
|
||||||
|
->values($obj->getCreatedBy(), 'task', 'task', 1, $objId, 1, 1, 1, 1, 1);
|
||||||
|
|
||||||
|
self::$db->con->prepare($query->toSql())->execute();
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
var_dump($e->getMessage());
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $objId;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Find.
|
||||||
|
*
|
||||||
|
* @param array $columns Columns to select
|
||||||
|
*
|
||||||
|
* @return Builder
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||||
|
*/
|
||||||
|
public static function find(...$columns) : Builder
|
||||||
|
{
|
||||||
|
return parent::find(...$columns)->from('account_permission')
|
||||||
|
->where('account_permission.account_permission_for', '=', 'task')
|
||||||
|
->where('account_permission.account_permission_id1', '=', 1)
|
||||||
|
->where('task.task_id', '=', new Column('account_permission.account_permission_id2'))
|
||||||
|
->where('account_permission.account_permission_r', '=', 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user