mirror of
https://github.com/Karaka-Management/oms-Kanban.git
synced 2026-02-11 17:58:41 +00:00
Kanban first working implementation
This commit is contained in:
parent
3121092be8
commit
ada5e6af81
|
|
@ -85,6 +85,7 @@ class Installer extends InstallerAbstract
|
|||
`kanban_card_description` text NOT NULL,
|
||||
`kanban_card_type` int(2) NOT NULL,
|
||||
`kanban_card_status` int(2) NOT NULL,
|
||||
`kanban_card_order` int(11) NOT NULL,
|
||||
`kanban_card_ref` int(11) DEFAULT NULL,
|
||||
`kanban_card_column` int(11) NOT NULL,
|
||||
`kanban_card_created_at` datetime DEFAULT NULL,
|
||||
|
|
@ -107,7 +108,7 @@ class Installer extends InstallerAbstract
|
|||
`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_dst` (`kanban_card_media_dst`),
|
||||
KEY `kanban_card_media_src` (`kanban_card_media_src`)
|
||||
)ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;'
|
||||
)->execute();
|
||||
|
|
@ -132,13 +133,19 @@ class Installer extends InstallerAbstract
|
|||
)ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;'
|
||||
)->execute();
|
||||
|
||||
$dbPool->get('core')->con->prepare(
|
||||
'ALTER TABLE `' . $dbPool->get('core')->prefix . 'kanban_card_comment`
|
||||
ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'kanban_card_comment_ibfk_1` FOREIGN KEY (`kanban_card_comment_card`) REFERENCES `' . $dbPool->get('core')->prefix . 'kanban_card` (`kanban_card_id`),
|
||||
ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'kanban_card_comment_ibfk_2` FOREIGN KEY (`kanban_card_comment_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_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_dst` (`kanban_card_comment_media_dst`),
|
||||
KEY `kanban_card_comment_media_src` (`kanban_card_comment_media_src`)
|
||||
)ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;'
|
||||
)->execute();
|
||||
|
|
@ -159,11 +166,15 @@ class Installer extends InstallerAbstract
|
|||
`kanban_activity_new` varchar(255) NOT NULL,
|
||||
`kanban_activity_by` int(11) DEFAULT NULL,
|
||||
PRIMARY KEY (`kanban_activity_id`),
|
||||
KEY `kanban_activity` (`kanban_activity`),
|
||||
KEY `kanban_activity_by` (`kanban_activity_by`)
|
||||
)ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;'
|
||||
)->execute();
|
||||
|
||||
$dbPool->get('core')->con->prepare(
|
||||
'ALTER TABLE `' . $dbPool->get('core')->prefix . 'kanban_activity`
|
||||
ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'kanban_activity_ibfk_1` FOREIGN KEY (`kanban_activity_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_label` (
|
||||
`kanban_label_id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
use phpOMS\Router\RouteVerb;
|
||||
|
||||
return [
|
||||
'^.*/backend/kanban/dashbaord.*$' => [
|
||||
'^.*/backend/kanban/dashboard.*$' => [
|
||||
[
|
||||
'dest' => '\Modules\Kanban\Controller:viewKanbanDashboard',
|
||||
'verb' => RouteVerb::GET,
|
||||
|
|
@ -15,6 +15,12 @@ return [
|
|||
'verb' => RouteVerb::GET,
|
||||
],
|
||||
],
|
||||
'^.*/backend/kanban/card.*$' => [
|
||||
[
|
||||
'dest' => '\Modules\Kanban\Controller:viewKanbanCard',
|
||||
'verb' => RouteVerb::GET,
|
||||
],
|
||||
],
|
||||
'^.*/backend/kanban/create.*$' => [
|
||||
[
|
||||
'dest' => '\Modules\Kanban\Controller:viewKanbanCreate',
|
||||
|
|
|
|||
|
|
@ -21,8 +21,18 @@ use phpOMS\Message\ResponseAbstract;
|
|||
use phpOMS\Module\ModuleAbstract;
|
||||
use phpOMS\Module\WebInterface;
|
||||
use phpOMS\Views\View;
|
||||
use phpOMS\Utils\TaskSchedule\SchedulerFactory;
|
||||
use phpOMS\Utils\TaskSchedule\SchedulerAbstract;
|
||||
|
||||
use Modules\Kanban\Models\KanbanBoard;
|
||||
use Modules\Kanban\Models\KanbanBoardMapper;
|
||||
use Modules\Kanban\Models\KanbanColumn;
|
||||
use Modules\Kanban\Models\KanbanColumnMapper;
|
||||
use Modules\Kanban\Models\KanbanCard;
|
||||
use Modules\Kanban\Models\KanbanCardMapper;
|
||||
use Modules\Kanban\Models\KanbanCardComment;
|
||||
use Modules\Kanban\Models\KanbanCardCommentMapper;
|
||||
use Modules\Kanban\Models\CardStatus;
|
||||
use Modules\Kanban\Models\CardType;
|
||||
use Modules\Kanban\Models\BoardStatus;
|
||||
|
||||
/**
|
||||
* Task class.
|
||||
|
|
@ -117,6 +127,33 @@ class Controller extends ModuleAbstract implements WebInterface
|
|||
$view->setTemplate('/Modules/Kanban/Theme/Backend/kanban-board');
|
||||
$view->addData('nav', $this->app->moduleManager->get('Navigation')->createNavigationMid(1005801001, $request, $response));
|
||||
|
||||
$view->setData('board', KanbanBoardMapper::get((int) $request->getData('id')));
|
||||
|
||||
return $view;
|
||||
}
|
||||
|
||||
/**
|
||||
* @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 viewKanbanCard(RequestAbstract $request, ResponseAbstract $response, $data = null) : \Serializable
|
||||
{
|
||||
$view = new View($this->app, $request, $response);
|
||||
$view->setTemplate('/Modules/Kanban/Theme/Backend/kanban-card');
|
||||
$view->addData('nav', $this->app->moduleManager->get('Navigation')->createNavigationMid(1005801001, $request, $response));
|
||||
|
||||
$card = KanbanCardMapper::get((int) $request->getData('id'));
|
||||
$view->setData('card', $card);
|
||||
|
||||
$list = KanbanCardCommentMapper::getNewest(50);
|
||||
$view->setData('comments', $list);
|
||||
|
||||
return $view;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -16,7 +16,6 @@
|
|||
declare(strict_types=1);
|
||||
namespace Modules\Kanban\Models;
|
||||
|
||||
|
||||
/**
|
||||
* Task class.
|
||||
*
|
||||
|
|
@ -120,7 +119,7 @@ class KanbanBoard implements \JsonSerializable
|
|||
return false;
|
||||
}
|
||||
|
||||
public function jsonSerealize() : array
|
||||
public function jsonSerialize() : array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -43,6 +43,8 @@ class KanbanCard implements \JsonSerializable
|
|||
|
||||
private $column = 0;
|
||||
|
||||
private $order = 0;
|
||||
|
||||
private $ref = 0;
|
||||
|
||||
private $createdBy = 0;
|
||||
|
|
@ -60,6 +62,16 @@ class KanbanCard implements \JsonSerializable
|
|||
$this->createdAt = new \DateTime('now');
|
||||
}
|
||||
|
||||
public function getOrder() : int
|
||||
{
|
||||
return $this->order;
|
||||
}
|
||||
|
||||
public function setOrder(int $order) /* : void */
|
||||
{
|
||||
$this->order = $order;
|
||||
}
|
||||
|
||||
public function getId() : int
|
||||
{
|
||||
return $this->id;
|
||||
|
|
@ -145,7 +157,7 @@ class KanbanCard implements \JsonSerializable
|
|||
return $this->comments;
|
||||
}
|
||||
|
||||
public function addComment(KanbanCardComment $comment) /* : void */
|
||||
public function addComment($comment) /* : void */
|
||||
{
|
||||
$this->comments[] = $comment;
|
||||
}
|
||||
|
|
@ -166,13 +178,26 @@ class KanbanCard implements \JsonSerializable
|
|||
return $this->media;
|
||||
}
|
||||
|
||||
public function addMedia(Media $media) /* : void */
|
||||
public function addMedia($media) /* : void */
|
||||
{
|
||||
$this->media[] = $media;
|
||||
}
|
||||
|
||||
public function jsonSerealize() : array
|
||||
public function getLabels() : array
|
||||
{
|
||||
return $this->labels;
|
||||
}
|
||||
|
||||
public function addLabel($label) /* : void */
|
||||
{
|
||||
$this->labels[] = $label;
|
||||
}
|
||||
|
||||
public function jsonSerialize() : array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
/* todo: create function to create card from task etc... this fills the values here. what happens if task changes? bad idea! */
|
||||
/* todo: maybe allow ref to be an object and datamapper creates that object? how does the datamapper know what kind of datamapper to use? Just assume it's called ObjectMapper? bad isn't it?! */
|
||||
}
|
||||
|
|
@ -88,11 +88,6 @@ class KanbanCardComment implements \JsonSerializable
|
|||
return $this->createdAt;
|
||||
}
|
||||
|
||||
public function getComments() : array
|
||||
{
|
||||
return $this->comments;
|
||||
}
|
||||
|
||||
public function getMedia() : array
|
||||
{
|
||||
return $this->media;
|
||||
|
|
@ -103,7 +98,7 @@ class KanbanCardComment implements \JsonSerializable
|
|||
$this->media[] = $media;
|
||||
}
|
||||
|
||||
public function jsonSerealize() : array
|
||||
public function jsonSerialize() : array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ use Modules\Media\Models\MediaMapper;
|
|||
* @link http://orange-management.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
class KanbanBoardMapper extends DataMapperAbstract
|
||||
class KanbanCardCommentMapper extends DataMapperAbstract
|
||||
{
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ use Modules\Media\Models\MediaMapper;
|
|||
* @link http://orange-management.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
class KanbanBoardMapper extends DataMapperAbstract
|
||||
class KanbanCardMapper extends DataMapperAbstract
|
||||
{
|
||||
|
||||
/**
|
||||
|
|
@ -48,6 +48,7 @@ class KanbanBoardMapper extends DataMapperAbstract
|
|||
'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_order' => ['name' => 'kanban_card_order', 'type' => 'int', 'internal' => 'order'],
|
||||
'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'],
|
||||
|
|
@ -68,16 +69,16 @@ class KanbanBoardMapper extends DataMapperAbstract
|
|||
'src' => 'kanban_card_media_src',
|
||||
],
|
||||
'labels' => [
|
||||
'mapper' => LabelMapper::class,
|
||||
'table' => 'kanban_card_label',
|
||||
'dst' => 'kanban_card_label_dst',
|
||||
'src' => 'kanban_card_label_src',
|
||||
'mapper' => KanbanLabelMapper::class,
|
||||
'table' => 'kanban_label_relation',
|
||||
'dst' => 'kanban_label_relation_card',
|
||||
'src' => 'kanban_label_relation_label',
|
||||
],
|
||||
'comments' => [
|
||||
'mapper' => KanbanCardCommentMapper::class,
|
||||
'table' => 'kanban_card_label',
|
||||
'dst' => 'kanban_card_label_dst',
|
||||
'src' => 'kanban_card_label_src',
|
||||
'table' => 'kanban_card_comment',
|
||||
'dst' => 'kanban_card_comment_card',
|
||||
'src' => null,
|
||||
],
|
||||
];
|
||||
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@
|
|||
* @link http://orange-management.com
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
namespace Modules\Column\Models;
|
||||
namespace Modules\Kanban\Models;
|
||||
|
||||
|
||||
/**
|
||||
|
|
@ -49,6 +49,26 @@ class KanbanColumn implements \JsonSerializable
|
|||
return $this->id;
|
||||
}
|
||||
|
||||
public function getOrder() : int
|
||||
{
|
||||
return $this->order;
|
||||
}
|
||||
|
||||
public function setOrder(int $order) /* : void */
|
||||
{
|
||||
$this->order = $order;
|
||||
}
|
||||
|
||||
public function setBoard(int $board) /* : void */
|
||||
{
|
||||
$this->board = $board;
|
||||
}
|
||||
|
||||
public function getBoard() : int
|
||||
{
|
||||
return $this->board;
|
||||
}
|
||||
|
||||
public function getName() : string
|
||||
{
|
||||
return $this->name;
|
||||
|
|
@ -80,7 +100,7 @@ class KanbanColumn implements \JsonSerializable
|
|||
return false;
|
||||
}
|
||||
|
||||
public function jsonSerealize() : array
|
||||
public function jsonSerialize() : array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ use phpOMS\DataStorage\Database\RelationType;
|
|||
* @link http://orange-management.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
class KanbanBoardMapper extends DataMapperAbstract
|
||||
class KanbanColumnMapper extends DataMapperAbstract
|
||||
{
|
||||
|
||||
/**
|
||||
|
|
@ -98,26 +98,6 @@ class KanbanBoardMapper extends DataMapperAbstract
|
|||
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());
|
||||
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ class KanbanLabel implements \JsonSerializable
|
|||
{
|
||||
return $this->id;
|
||||
}
|
||||
public function getName() : int
|
||||
public function getName() : string
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
|
@ -77,4 +77,9 @@ class KanbanLabel implements \JsonSerializable
|
|||
$this->board = $board;
|
||||
}
|
||||
|
||||
public function jsonSerialize() : array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -83,26 +83,6 @@ class KanbanLabelMapper extends DataMapperAbstract
|
|||
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());
|
||||
|
||||
|
|
|
|||
25
Theme/Backend/kanban-board.tpl.php
Normal file
25
Theme/Backend/kanban-board.tpl.php
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
<?php
|
||||
$board = $this->getData('board');
|
||||
$columns = $board->getColumns();
|
||||
// todo: column width should be % but with min-width and on small screens full width
|
||||
?>
|
||||
<div class="row">
|
||||
<?php foreach($columns as $column) : $cards = $column->getCards(); ?>
|
||||
<div class="col-xs-12 col-sm-3" draggable>
|
||||
<header><?= $column->getName(); ?></header>
|
||||
<?php foreach($cards as $card) : $labels = $card->getLabels(); ?>
|
||||
<a href="<?= \phpOMS\Uri\UriFactory::build('/{/lang}/backend/kanban/card?{?}&id=' . $card->getId()) ?>">
|
||||
<section class="box wf-100" draggable>
|
||||
<header><h1><?= $card->getName(); ?></h1></header>
|
||||
<div class="inner">
|
||||
<?= $card->getDescription(); ?>
|
||||
<?php foreach($labels as $label) : ?>
|
||||
<span style="background: #<?= dechex($label->getColor()); ?>"><?= $label->getName(); ?></span>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
</section>
|
||||
</a>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
27
Theme/Backend/kanban-card.tpl.php
Normal file
27
Theme/Backend/kanban-card.tpl.php
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
<?php
|
||||
$card = $this->getData('card');
|
||||
$comments = $card->getComments();
|
||||
?>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-xs-12">
|
||||
<section class="box wf-100">
|
||||
<header><h1><?= $card->getName(); ?></h1></header>
|
||||
<div class="inner">
|
||||
<?= $card->getDescription(); ?>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php foreach($comments as $comment) : ?>
|
||||
<div class="row">
|
||||
<div class="col-xs-12">
|
||||
<section class="box wf-100">
|
||||
<div class="inner">
|
||||
<?= $comment->getDescription(); ?>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
17
Theme/Backend/kanban-dashboard.tpl.php
Normal file
17
Theme/Backend/kanban-dashboard.tpl.php
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
<?php
|
||||
$boards = $this->getData('boards');
|
||||
?>
|
||||
<div class="row">
|
||||
<?php foreach($boards as $board) : ?>
|
||||
<div class="col-xs-12 col-sm-6 col-lg-3">
|
||||
<a href="<?= \phpOMS\Uri\UriFactory::build('/{/lang}/backend/kanban/board?{?}&id=' . $board->getId()) ?>">
|
||||
<section class="box wf-100">
|
||||
<header><h1><?= $board->getName(); ?></h1></header>
|
||||
<div class="inner">
|
||||
<?= $board->getDescription(); ?>
|
||||
</div>
|
||||
</section>
|
||||
</a>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
<div>
|
||||
Loading…
Reference in New Issue
Block a user