* Adjust code style.
This commit is contained in:
@@ -1,361 +1,3 @@
|
||||
/**
|
||||
* Get story demo kanban data
|
||||
* 获取“软件需求”看板演示数据
|
||||
* @returns {Object} Kanban data
|
||||
* @todo 该方法作为演示,应该在最终版本中移除
|
||||
*/
|
||||
function getStoryKanbanDemoData()
|
||||
{
|
||||
/* Define kanban columns 定义看板列 */
|
||||
var columns =
|
||||
[
|
||||
/* 看板列定义数据结构:
|
||||
id: 列 ID(确保在页面上唯一),
|
||||
type: 类型,
|
||||
name: 显示的名称,
|
||||
color: 列名称颜色,
|
||||
parentType: 所属的父级列类型
|
||||
asParent: 是否作为父级列
|
||||
cardType: 看板卡片类型,例如:'story'(需求)
|
||||
limit: 最大数目,该列上允许展示的卡片最大数目,如果为 0 表示无限制 */
|
||||
{id: 'story-blacklog', type: 'blacklog', name: 'Blacklog', color: '', limit: 0},
|
||||
{id: 'story-ready', type: 'ready', name: '准备好', color: '', limit: 4},
|
||||
{id: 'story-dev', type: 'dev', name: '开发', color: '', limit: 4, asParent: true},
|
||||
{id: 'story-dev-doing', type: 'dev-doing', name: '进行中', color: '#126eed', limit: 2, parentType: 'dev'},
|
||||
{id: 'story-dev-done', type: 'dev-done', name: '完成', color: '#2fab8e', limit: 2, parentType: 'dev'},
|
||||
{id: 'story-test', type: 'test', name: '测试', color: '', limit: 4, asParent: true},
|
||||
{id: 'story-test-doing', type: 'test-doing', name: '进行中', color: '#126eed', limit: 2, parentType: 'test'},
|
||||
{id: 'story-test-done', type: 'test-done', name: '完成', color: '#2fab8e', limit: 2, parentType: 'test'},
|
||||
{id: 'story-accepted', type: 'accepted', name: '已验收', color: '', limit: 0},
|
||||
{id: 'story-published', type: 'published', name: '已发布', color: '', limit: 0},
|
||||
];
|
||||
|
||||
/* Define cards in blacklog column 定义 Blacklog 列上的卡片 */
|
||||
var blacklogColCards =
|
||||
[
|
||||
/* 需求数据结构:
|
||||
id: ID,通常为需求 ID,
|
||||
title: 名称,
|
||||
order: 显示顺序,如果指定为 0,则按 ID 倒序排序,
|
||||
pri: 优先级,
|
||||
estimate: 预估时间,
|
||||
assignedTo: 指派给,
|
||||
deadline: 截止日期 */
|
||||
{id: 10010, title: '第一条 Blacklog', order: 1, pri: 1, estimate: 2, assignedTo: 'admin', deadline: '2021-10-30'},
|
||||
{id: 10011, title: '文档模块的实现', order: 2, pri: 2, estimate: 0, assignedTo: 'sunhao'},
|
||||
{id: 10012, title: '实现软件需求看板视图中不同分组条件的看板展示方式', order: 3, pri: 3, estimate: 10, assignedTo: 'admin'},
|
||||
{id: 10013, title: 'Blacklog 3', order: 4, pri: 0, estimate: 0, assignedTo: 'sunhao'},
|
||||
{id: 10014, title: '实现泳道的更多操作菜单', order: 5, pri: 0, estimate: 0, assignedTo: 'sunhao'},
|
||||
];
|
||||
/* Define cards in ready column 定义 准备好 列上的卡片 */
|
||||
var readyColCards =
|
||||
[
|
||||
/* 需求数据结构参见 blacklogColCards 定义 */
|
||||
{id: 10020, title: '在看板列中实现创建任务功能', order: 10, pri: 1, estimate: 2, assignedTo: 'admin', deadline: '2021-10-30'},
|
||||
{id: 10021, title: '实现泳道的上下移动', order: 11, pri: 2, estimate: 0, assignedTo: 'sunhao'},
|
||||
{id: 10024, title: '实现泳道的更多操作菜单', order: 15, pri: 0, estimate: 0, assignedTo: 'sunhao'},
|
||||
];
|
||||
var devDoingColCards = /* Define cards in dev/doing column 定义 开发/进行中 列上的卡片 */
|
||||
[
|
||||
/* 需求数据结构参见 blacklogColCards 定义 */
|
||||
{id: 10030, title: '实现看板的更多操作菜单', order: 10, pri: 3, estimate: 0, assignedTo: 'admin', deadline: '2021-10-30'},
|
||||
{id: 10031, title: '实现卡片拖动效果功能', order: 11, pri: 2, estimate: 2, assignedTo: 'sunhao'},
|
||||
];
|
||||
var devDoneColCards = /* Define cards in dev/done column 定义 开发/完成 列上的卡片 */
|
||||
[
|
||||
/* 需求数据结构参见 blacklogColCards 定义 */
|
||||
{id: 10040, title: '实现看板列卡片排序功能', order: 10, pri: 1, estimate: 4, assignedTo: 'admin', deadline: '2021-10-30'},
|
||||
];
|
||||
var testDoingColCards = /* Define cards in test/doing column 定义 测试/进行中 列上的卡片 */
|
||||
[
|
||||
/* 需求数据结构参见 blacklogColCards 定义 */
|
||||
{id: 10050, title: '实现看板列的更多操作菜单', order: 10, pri: 3, estimate: 0, assignedTo: 'admin', deadline: '2021-10-30'},
|
||||
{id: 10051, title: '实现Bug卡片的更多操作功能', order: 11, pri: 2, estimate: 2, assignedTo: 'sunhao'},
|
||||
];
|
||||
var testDoneColCards = /* Define cards in test/done column 定义 测试/完成 列上的卡片 */
|
||||
[
|
||||
/* 需求数据结构参见 blacklogColCards 定义 */
|
||||
{id: 10060, title: '实现任务卡片的更多操作功能', order: 10, pri: 1, estimate: 4, assignedTo: 'admin', deadline: '2021-10-30'},
|
||||
];
|
||||
var acceptedColCards =
|
||||
[
|
||||
/* 需求数据结构参见 blacklogColCards 定义 */
|
||||
{id: 10070, title: '实现执行看板的新建按钮组功能', order: 10, pri: 3, estimate: 12, assignedTo: 'admin', deadline: '2021-10-30'},
|
||||
{id: 10071, title: '在看板列中实现提交Bug功能', order: 11, pri: 2, estimate: 2, assignedTo: 'sunhao'},
|
||||
{id: 10072, title: '在看板列中实现需求的添加和关联功能', order: 10, pri: 3, estimate: 10, assignedTo: 'admin', deadline: '2021-10-30'},
|
||||
{id: 10073, title: '实现任务看板视图中不同分组条件的看板展示方式', order: 11, pri: 2, estimate: 2, assignedTo: 'sunhao'},
|
||||
];
|
||||
var publishedColCards =
|
||||
[
|
||||
/* 需求数据结构参见 blacklogColCards 定义 */
|
||||
{id: 10080, title: '实现任务看板视图中泳道分组下拉菜单功能', order: 10, pri: 3, estimate: 2, assignedTo: 'admin'},
|
||||
];
|
||||
|
||||
/* Define kanban cards in lane 定义看板泳道内每一列的卡片,属性名为看板列类型,属性值为卡片列表 */
|
||||
var cards =
|
||||
{
|
||||
/* 看板列类型: 卡片列表 */
|
||||
blacklog: blacklogColCards,
|
||||
ready: readyColCards,
|
||||
'dev-doing': devDoingColCards,
|
||||
'dev-done': devDoneColCards,
|
||||
'test-doing': testDoingColCards,
|
||||
'test-done': testDoneColCards,
|
||||
accepted: acceptedColCards,
|
||||
published: publishedColCards,
|
||||
};
|
||||
|
||||
/* Define kanban lanes 定义看板泳道 */
|
||||
var lanes =
|
||||
[
|
||||
/* 泳道数据结构:
|
||||
id: 泳道 ID,确保页面上唯一,可以为数字或字符串,
|
||||
name: 名称,
|
||||
cards: 定义每列上的卡片
|
||||
color: 泳道名称背景色
|
||||
defaultCardType: 看板泳道上的卡片默认类型,例如:'story'(需求) */
|
||||
{id: 'story', name: '软件需求', cards: cards, color: '#3dc6fc', defaultCardType: 'story'},
|
||||
]
|
||||
|
||||
/* Return kanban data 返回看板数据 */
|
||||
/* 看板数据结构:
|
||||
id: ID,确保页面上唯一,可以为数字或字符串,
|
||||
columns: 定义看板上的所有列,
|
||||
lanes: 定义看板上的所有泳道
|
||||
defaultCardType: 看板上的卡片默认类型,例如:'story'(需求) */
|
||||
return kanbanGroup.story;
|
||||
return {id: 'story', columns: columns, lanes: lanes, defaultCardType: 'story'};
|
||||
}
|
||||
|
||||
/**
|
||||
* Get bug demo kanban data
|
||||
* 获取“Bug”看板演示数据
|
||||
* @returns {Object} Kanban data
|
||||
* @todo 该方法作为演示,应该在最终版本中移除
|
||||
*/
|
||||
function getBugKanbanDemoData()
|
||||
{
|
||||
return kanbanGroup.bug;
|
||||
/* Define kanban columns 定义看板列 */
|
||||
var columns =
|
||||
[
|
||||
/* 看板列定义数据结构:
|
||||
id: 列 ID(确保在页面上唯一),
|
||||
type: 类型,
|
||||
name: 显示的名称,
|
||||
color: 列名称颜色,
|
||||
parentType: 所属的父级列类型
|
||||
asParent: 是否作为父级列
|
||||
cardType: 看板卡片类型,例如:'story'(需求)
|
||||
limit: 最大数目,该列上允许展示的卡片最大数目,如果为 0 表示无限制 */
|
||||
{id: 'bug-wait', type: 'wait', name: '待确认', color: '', limit: 0},
|
||||
{id: 'bug-confirmed', type: 'confirmed', name: '已确认', color: '', limit: 4},
|
||||
{id: 'bug-resolving', type: 'resolving', name: '解决中', color: '', limit: 4, asParent: true},
|
||||
{id: 'bug-resolving-doing', type: 'resolving-doing',name: '进行中', color: '#126eed', limit: 2, parentType: 'resolving'},
|
||||
{id: 'bug-resolving-done', type: 'resolving-done', name: '完成', color: '#2fab8e', limit: 2, parentType: 'resolving'},
|
||||
{id: 'bug-test', type: 'test', name: '测试', color: '', limit: 4, asParent: true},
|
||||
{id: 'bug-test-doing', type: 'test-doing', name: '测试中', color: '#126eed', limit: 2, parentType: 'test'},
|
||||
{id: 'bug-test-done', type: 'test-done', name: '测试完毕', color: '#2fab8e', limit: 2, parentType: 'test'},
|
||||
{id: 'bug-closed', type: 'closed', name: '已关闭', color: '', limit: 0},
|
||||
];
|
||||
|
||||
/* Define cards in wait column 定义 待确认 列上的卡片 */
|
||||
var waitColCards =
|
||||
[
|
||||
/* bug 数据结构:
|
||||
id: ID,通常为 Bug ID,
|
||||
title: 名称,
|
||||
order: 显示顺序,如果指定为 0,则按 ID 倒序排序,
|
||||
pri: 优先级,
|
||||
severity: 紧急程度,
|
||||
assignedTo: 指派给 */
|
||||
{id: 10010, title: '在看板列中实现创建任务功能', order: 10, pri: 1, severity: 2, assignedTo: 'admin'},
|
||||
{id: 10011, title: '实现泳道的上下移动', order: 11, pri: 2, severity: 1, assignedTo: 'sunhao'},
|
||||
{id: 10014, title: '实现泳道的更多操作菜单', order: 15, pri: 0, severity: 1, assignedTo: 'sunhao'},
|
||||
];
|
||||
/* Define cards in confirmed column 定义 已确认 列上的卡片 */
|
||||
var confirmedColCards =
|
||||
[
|
||||
/* Bug 数据结构参见 waitColCards 定义 */
|
||||
{id: 10020, title: '在看板列中实现创建任务功能', order: 10, pri: 1, severity: 2, assignedTo: 'admin'},
|
||||
{id: 10021, title: '实现泳道的上下移动', order: 11, pri: 2, severity: 1, assignedTo: 'sunhao'},
|
||||
{id: 10024, title: '实现泳道的更多操作菜单', order: 15, pri: 0, severity: 1, assignedTo: 'sunhao'},
|
||||
];
|
||||
var resolvingDoingColCards = /* Define cards in resolving/doing column 定义 开发/进行中 列上的卡片 */
|
||||
[
|
||||
/* Bug 数据结构参见 waitColCards 定义 */
|
||||
{id: 10030, title: '实现看板的更多操作菜单', order: 10, pri: 3, severity: 1, assignedTo: 'admin'},
|
||||
{id: 10031, title: '实现卡片拖动效果功能', order: 11, pri: 2, severity: 2, assignedTo: 'sunhao'},
|
||||
];
|
||||
var resolvingDoneColCards = /* Define cards in resolving/done column 定义 开发/完成 列上的卡片 */
|
||||
[
|
||||
/* Bug 数据结构参见 waitColCards 定义 */
|
||||
{id: 10040, title: '实现看板列卡片排序功能', order: 10, pri: 1, severity: 4, assignedTo: 'admin'},
|
||||
];
|
||||
var testDoingColCards = /* Define cards in test/doing column 定义 测试/进行中 列上的卡片 */
|
||||
[
|
||||
/* Bug 数据结构参见 waitColCards 定义 */
|
||||
{id: 10050, title: '实现看板列的更多操作菜单', order: 10, pri: 3, severity: 3, assignedTo: 'admin'},
|
||||
{id: 10051, title: '实现Bug卡片的更多操作功能', order: 11, pri: 2, severity: 2, assignedTo: 'sunhao'},
|
||||
];
|
||||
var testDoneColCards = /* Define cards in test/done column 定义 测试/完成 列上的卡片 */
|
||||
[
|
||||
/* Bug 数据结构参见 waitColCards 定义 */
|
||||
{id: 10060, title: '实现任务卡片的更多操作功能', order: 10, pri: 1, severity: 4, assignedTo: 'admin'},
|
||||
];
|
||||
var closedColCards =
|
||||
[
|
||||
/* Bug 数据结构参见 waitColCards 定义 */
|
||||
{id: 10070, title: '实现执行看板的新建按钮组功能', order: 10, pri: 3, severity: 3, assignedTo: 'admin'},
|
||||
{id: 10071, title: '在看板列中实现提交Bug功能', order: 11, pri: 2, severity: 2, assignedTo: 'sunhao'},
|
||||
{id: 10072, title: '在看板列中实现需求的添加和关联功能', order: 10, pri: 3, severity: 3, assignedTo: 'admin'},
|
||||
{id: 10073, title: '实现任务看板视图中不同分组条件的看板展示方式', order: 11, pri: 2, severity: 2, assignedTo: 'sunhao'},
|
||||
];
|
||||
|
||||
/* Define kanban cards in lane 定义看板泳道内每一列的卡片,属性名为看板列类型,属性值为卡片列表 */
|
||||
var cards =
|
||||
{
|
||||
/* 看板列类型: 卡片列表 */
|
||||
wait: waitColCards,
|
||||
confirmed: confirmedColCards,
|
||||
'resolving-doing': resolvingDoingColCards,
|
||||
'resolving-done': resolvingDoneColCards,
|
||||
'test-doing': testDoingColCards,
|
||||
'test-done': testDoneColCards,
|
||||
closed: closedColCards,
|
||||
};
|
||||
|
||||
/* Define kanban lanes 定义看板泳道 */
|
||||
var lanes =
|
||||
[
|
||||
/* 泳道数据结构:
|
||||
id: 泳道 ID,确保页面上唯一,可以为数字或字符串,
|
||||
name: 名称,
|
||||
cards: 定义每列上的卡片
|
||||
color: 泳道名称背景色
|
||||
defaultCardType: 看板泳道上的卡片默认类型,例如:'bug'(Bug) */
|
||||
{id: 'bug', name: 'Bug', cards: cards, color: '#9c30b0', defaultCardType: 'bug'},
|
||||
]
|
||||
|
||||
/* Return kanban data 返回看板数据 */
|
||||
/* 看板数据结构:
|
||||
id: ID,确保页面上唯一,可以为数字或字符串,
|
||||
columns: 定义看板上的所有列,
|
||||
lanes: 定义看板上的所有泳道
|
||||
defaultCardType: 看板上的卡片默认类型,例如:'bug'(Bug) */
|
||||
return {id: 'bug', columns: columns, lanes: lanes, defaultCardType: 'bug'};
|
||||
}
|
||||
|
||||
/**
|
||||
* Get task demo kanban data
|
||||
* 获取“任务”看板演示数据
|
||||
* @returns {Object} Kanban data
|
||||
* @todo 该方法作为演示,应该在最终版本中移除
|
||||
*/
|
||||
function getTaskKanbanDemoData()
|
||||
{
|
||||
return kanbanGroup.task;
|
||||
/* Define kanban columns 定义看板列 */
|
||||
var columns =
|
||||
[
|
||||
/* 看板列定义数据结构:
|
||||
id: 列 ID(确保在页面上唯一),
|
||||
type: 类型,
|
||||
name: 显示的名称,
|
||||
color: 列名称颜色,
|
||||
parentType: 所属的父级列类型
|
||||
asParent: 是否作为父级列
|
||||
cardType: 看板卡片类型,例如:'task'(任务)
|
||||
limit: 最大数目,该列上允许展示的卡片最大数目,如果为 0 表示无限制 */
|
||||
{id: 'task-wait', type: 'wait', name: '未开始', color: '', limit: 0},
|
||||
{id: 'task-dev', type: 'dev', name: '开发', color: '', limit: 4, asParent: true},
|
||||
{id: 'task-dev-doing', type: 'dev-doing', name: '研发中', color: '#126eed', limit: 2, parentType: 'dev'},
|
||||
{id: 'task-dev-done', type: 'dev-done', name: '研发完成', color: '#2fab8e', limit: 2, parentType: 'dev'},
|
||||
{id: 'task-pause', type: 'pause', name: '已暂停', color: '', limit: 0},
|
||||
{id: 'task-cancel', type: 'cancel', name: '已取消', color: '', limit: 0},
|
||||
{id: 'task-closed', type: 'closed', name: '已关闭', color: '', limit: 0},
|
||||
];
|
||||
|
||||
/* Define cards in wait column 定义 未开始 列上的卡片 */
|
||||
var waitColCards =
|
||||
[
|
||||
/* 任务数据结构:
|
||||
id: ID,通常为任务 ID,
|
||||
name: 名称,
|
||||
order: 显示顺序,如果指定为 0,则按 ID 倒序排序,
|
||||
pri: 优先级,
|
||||
estimate: 预估时间,
|
||||
assignedTo: 指派给,
|
||||
deadline: 截止日期 */
|
||||
{id: 10020, name: '在看板列中实现创建任务功能', order: 10, pri: 1, estimate: 2, assignedTo: 'admin', deadline: '2021-10-30'},
|
||||
{id: 10021, name: '实现泳道的上下移动', order: 11, pri: 2, estimate: 0, assignedTo: 'sunhao', deadline: '2021-10-22'},
|
||||
{id: 10024, name: '实现泳道的更多操作菜单', order: 15, pri: 0, estimate: 0, assignedTo: 'sunhao'},
|
||||
];
|
||||
var devDoingColCards = /* Define cards in dev/doing column 定义 开发/进行中 列上的卡片 */
|
||||
[
|
||||
/* 任务数据结构参见 waitColCards 定义 */
|
||||
{id: 10030, name: '实现看板的更多操作菜单', order: 10, pri: 3, estimate: 0, assignedTo: 'admin', deadline: '2021-10-30'},
|
||||
{id: 10031, name: '实现卡片拖动效果功能', order: 11, pri: 2, estimate: 2, assignedTo: 'sunhao'},
|
||||
];
|
||||
var devDoneColCards = /* Define cards in dev/done column 定义 开发/完成 列上的卡片 */
|
||||
[
|
||||
/* 任务数据结构参见 waitColCards 定义 */
|
||||
{id: 10040, name: '实现看板列卡片排序功能', order: 10, pri: 1, estimate: 4, assignedTo: 'admin', deadline: '2021-10-30'},
|
||||
];
|
||||
var pauseColCards = /* Define cards in pause column 定义 已暂停 列上的卡片 */
|
||||
[
|
||||
/* 任务数据结构参见 waitColCards 定义 */
|
||||
{id: 10050, name: '实现看板列的更多操作菜单', order: 10, pri: 3, estimate: 0, assignedTo: 'admin', deadline: '2021-10-30'},
|
||||
{id: 10051, name: '实现Bug卡片的更多操作功能', order: 11, pri: 2, estimate: 2, assignedTo: 'sunhao'},
|
||||
];
|
||||
var cancelColCards = /* Define cards in cancel column 定义 已取消 列上的卡片 */
|
||||
[
|
||||
/* 任务数据结构参见 waitColCards 定义 */
|
||||
{id: 10060, name: '实现任务卡片的更多操作功能', order: 10, pri: 1, estimate: 4, assignedTo: 'admin', deadline: '2021-10-30'},
|
||||
];
|
||||
var closedColCards =
|
||||
[
|
||||
/* 任务数据结构参见 waitColCards 定义 */
|
||||
{id: 10070, name: '实现执行看板的新建按钮组功能', order: 10, pri: 3, estimate: 12, assignedTo: 'admin', deadline: '2021-10-30'},
|
||||
{id: 10071, name: '在看板列中实现提交Bug功能', order: 11, pri: 2, estimate: 2, assignedTo: 'sunhao'},
|
||||
{id: 10072, name: '在看板列中实现任务的添加和关联功能', order: 10, pri: 3, estimate: 10, assignedTo: 'admin', deadline: '2021-10-30'},
|
||||
{id: 10073, name: '实现任务看板视图中不同分组条件的看板展示方式', order: 11, pri: 2, estimate: 2, assignedTo: 'sunhao'},
|
||||
];
|
||||
|
||||
/* Define kanban cards in lane 定义看板泳道内每一列的卡片,属性名为看板列类型,属性值为卡片列表 */
|
||||
var cards =
|
||||
{
|
||||
/* 看板列类型: 卡片列表 */
|
||||
wait: waitColCards,
|
||||
'dev-doing': devDoingColCards,
|
||||
'dev-done': devDoneColCards,
|
||||
pause: pauseColCards,
|
||||
cancel: cancelColCards,
|
||||
closed: closedColCards,
|
||||
};
|
||||
|
||||
/* Define kanban lanes 定义看板泳道 */
|
||||
var lanes =
|
||||
[
|
||||
/* 泳道数据结构:
|
||||
id: 泳道 ID,确保页面上唯一,可以为数字或字符串,
|
||||
name: 名称,
|
||||
cards: 定义每列上的卡片
|
||||
color: 泳道名称背景色
|
||||
defaultCardType: 看板泳道上的卡片默认类型,例如:'task'(任务) */
|
||||
{id: 'task', name: '任务', cards: cards, color: '#126eed', defaultCardType: 'task'},
|
||||
]
|
||||
|
||||
/* Return kanban data 返回看板数据 */
|
||||
/* 看板数据结构:
|
||||
id: ID,确保页面上唯一,可以为数字或字符串,
|
||||
columns: 定义看板上的所有列,
|
||||
lanes: 定义看板上的所有泳道
|
||||
defaultCardType: 看板上的卡片默认类型,例如:'task'(任务) */
|
||||
return {id: 'task', columns: columns, lanes: lanes, defaultCardType: 'task'};
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Render user avatar
|
||||
* @param {String|{account: string, avatar: string}} user User account or user object
|
||||
@@ -693,11 +335,11 @@ $(function()
|
||||
};
|
||||
|
||||
/* Create story kanban 创建需求看板 */
|
||||
createKanban('story', getStoryKanbanDemoData(), commonOptions);
|
||||
createKanban('story', kanbanGroup.story, commonOptions);
|
||||
|
||||
/* Create bug kanban 创建 Bug 看板 */
|
||||
createKanban('bug', getBugKanbanDemoData(), commonOptions);
|
||||
createKanban('bug', kanbanGroup.bug, commonOptions);
|
||||
|
||||
/* Create task kanban 创建 任务 看板 */
|
||||
createKanban('task', getTaskKanbanDemoData(), commonOptions);
|
||||
createKanban('task', kanbanGroup.task, commonOptions);
|
||||
});
|
||||
|
||||
+40
-40
@@ -30,86 +30,89 @@ class kanbanModel extends model
|
||||
->fetchAll('id');
|
||||
|
||||
if(empty($lanes)) return array();
|
||||
|
||||
$columns = $this->dao->select('*')->from(TABLE_KANBANCOLUMN)
|
||||
->where('deleted')->eq(0)
|
||||
->andWhere('lane')->in(array_keys($lanes))
|
||||
->fetchGroup('lane', 'id');
|
||||
|
||||
/* Get parent column type pairs. */
|
||||
$parentTypes = $this->dao->select('id, type')->from(TABLE_KANBANCOLUMN)
|
||||
->where('deleted')->eq(0)
|
||||
->andWhere('lane')->in(array_keys($lanes))
|
||||
->andWhere('parent')->eq(-1)
|
||||
->fetchPairs('id', 'type');
|
||||
|
||||
if($objectType == 'story' or $objectType == 'all') $stories = $this->loadModel('story')->getExecutionStories($executionID);
|
||||
if($objectType == 'bug' or $objectType == 'all') $bugs = $this->loadModel('bug')->getExecutionBugs($executionID);
|
||||
if($objectType == 'task' or $objectType == 'all') $tasks = $this->loadModel('execution')->getKanbanTasks($executionID, "id");
|
||||
/* Get group objects. */
|
||||
$objectGroup['story'] = $this->loadModel('story')->getExecutionStories($executionID);
|
||||
$objectGroup['bug'] = $this->loadModel('bug')->getExecutionBugs($executionID);
|
||||
$objectGroup['task'] = $this->loadModel('execution')->getKanbanTasks($executionID, "id");
|
||||
|
||||
/* Init vars. */
|
||||
$kanban = array();
|
||||
/* Build kanban group data. */
|
||||
$kanbanGroup = array();
|
||||
foreach($lanes as $laneID => $lane)
|
||||
{
|
||||
$laneData = array();
|
||||
$columnData = array();
|
||||
$cards = array();
|
||||
$laneType = $lane->type;
|
||||
|
||||
$laneData['id'] = $lane->type;
|
||||
$laneData['id'] = $laneType;
|
||||
$laneData['name'] = $lane->name;
|
||||
$laneData['color'] = $lane->color;
|
||||
$laneData['defaultCardType'] = $lane->type;
|
||||
$laneData['order'] = $lane->order;
|
||||
$laneData['defaultCardType'] = $laneType;
|
||||
|
||||
foreach($columns[$laneID] as $colID => $col)
|
||||
foreach($columns[$laneID] as $columnID => $column)
|
||||
{
|
||||
$columnData[$col->id]['id'] = $lane->type . '-' . $col->type;
|
||||
$columnData[$col->id]['type'] = $col->type;
|
||||
$columnData[$col->id]['name'] = $col->name;
|
||||
$columnData[$col->id]['color'] = $col->color;
|
||||
$columnData[$col->id]['limit'] = $col->limit;
|
||||
$columnData[$col->id]['asParent'] = $col->parent == -1 ? true : false;
|
||||
$columnData[$column->id]['id'] = $laneType . '-' . $column->type;
|
||||
$columnData[$column->id]['type'] = $column->type;
|
||||
$columnData[$column->id]['name'] = $column->name;
|
||||
$columnData[$column->id]['color'] = $column->color;
|
||||
$columnData[$column->id]['limit'] = $column->limit;
|
||||
$columnData[$column->id]['asParent'] = $column->parent == -1 ? true : false;
|
||||
|
||||
if($col->parent > 0)
|
||||
if($column->parent > 0)
|
||||
{
|
||||
$columnData[$col->id]['parentType'] = zget($parentTypes, $col->parent, '');
|
||||
$columnData[$column->id]['parentType'] = zget($parentTypes, $column->parent, '');
|
||||
}
|
||||
|
||||
$cardIdList = array_filter(explode(',', $col->cards));
|
||||
$cardOrder = 1;
|
||||
$item = array();
|
||||
$cardIdList = array_filter(explode(',', $column->cards));
|
||||
foreach($cardIdList as $cardID)
|
||||
{
|
||||
if($lane->type == 'story') $object = zget($stories, $cardID, array());
|
||||
if($lane->type == 'task') $object = zget($tasks, $cardID, array());
|
||||
if($lane->type == 'bug') $object = zget($bugs, $cardID, array());
|
||||
$cardData = array();
|
||||
$objects = zget($objectGroup, $laneType, array());
|
||||
$object = zget($objects, $cardID, array());
|
||||
|
||||
$item['id'] = $object->id;
|
||||
$item['order'] = $cardOrder;
|
||||
$item['pri'] = $object->pri ? $object->pri : '';
|
||||
$item['estimate'] = $lane->type == 'bug' ? '' : $object->estimate;
|
||||
$item['assignedTo'] = $object->assignedTo;
|
||||
$item['deadline'] = $lane->type == 'task' ? $object->deadline : '';
|
||||
$cardData['id'] = $object->id;
|
||||
$cardData['order'] = $cardOrder;
|
||||
$cardData['pri'] = $object->pri ? $object->pri : '';
|
||||
$cardData['estimate'] = $laneType == 'bug' ? '' : $object->estimate;
|
||||
$cardData['assignedTo'] = $object->assignedTo;
|
||||
$cardData['deadline'] = $laneType == 'task' ? $object->deadline : '';
|
||||
$cardData['severity'] = $laneType == 'bug' ? $object->severity : '';
|
||||
|
||||
if($lane->type == 'task')
|
||||
if($laneType == 'task')
|
||||
{
|
||||
$item['name'] = $object->name;
|
||||
$cardData['name'] = $object->name;
|
||||
}
|
||||
else
|
||||
{
|
||||
$item['title'] = $object->title;
|
||||
$cardData['title'] = $object->title;
|
||||
}
|
||||
|
||||
$laneData['cards'][$col->type][] = $item;
|
||||
$laneData['cards'][$column->type][] = $cardData;
|
||||
$cardOrder ++;
|
||||
}
|
||||
}
|
||||
|
||||
$kanban[$lane->type]['id'] = $lane->type;
|
||||
$kanban[$lane->type]['columns'] = array_values($columnData);
|
||||
$kanban[$lane->type]['lanes'][] = $laneData;
|
||||
$kanban[$lane->type]['defaultCardType'] = $lane->type;
|
||||
$kanbanGroup[$laneType]['id'] = $laneType;
|
||||
$kanbanGroup[$laneType]['columns'] = array_values($columnData);
|
||||
$kanbanGroup[$laneType]['lanes'][] = $laneData;
|
||||
$kanbanGroup[$laneType]['defaultCardType'] = $laneType;
|
||||
}
|
||||
|
||||
return $kanban;
|
||||
return $kanbanGroup;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -411,8 +414,6 @@ class kanbanModel extends model
|
||||
return dao::isError();
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Update lane column.
|
||||
*
|
||||
@@ -428,5 +429,4 @@ class kanbanModel extends model
|
||||
->where('id')->eq($columnID)
|
||||
->exec();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user