diff --git a/module/project/control.php b/module/project/control.php index 52e11d0094..f06f61852e 100644 --- a/module/project/control.php +++ b/module/project/control.php @@ -300,6 +300,13 @@ class project extends control */ public function kanban() { + extract($this->project->getStats4Kanban()); + + $this->view->title = $this->lang->project->kanban; + $this->view->kanbanGroup = $kanbanGroup; + $this->view->latestExecutions = $latestExecutions; + $this->view->programPairs = $this->loadModel('program')->getPairs(true); + $this->display(); } diff --git a/module/project/css/kanban.css b/module/project/css/kanban.css new file mode 100644 index 0000000000..8fa74f8f20 --- /dev/null +++ b/module/project/css/kanban.css @@ -0,0 +1,17 @@ +.main-table .table {cursor: default;} +.main-table .table td {background: #efefef;} + +.board-item {border: 1px solid #EBEBEB; padding: 5px 10px; cursor: default; border-radius: 2px; background-color: #fff;} +.board-item:hover {border-color: #ccc;} +.board-item + .board-item {margin-top: 10px;} + +.board-project {padding: 5px;} +.board-doing-project, .board-doing-execution {padding: 5px;} + +.board-doing-project .table-row .table-col:last-child, .c-progress {width: 30px;} +.board-doing-execution .table-row .table-col:last-child, .c-progress {width: 30px;} +.table-row .table-col:first-child {overflow: hidden; text-overflow: ellipsis; white-space: nowrap;} + +table th, td {border: 2px solid #fff !important;} + +#kanban {padding-bottom: 10px} diff --git a/module/project/lang/zh-cn.php b/module/project/lang/zh-cn.php index 623899fdf9..dad2abdc15 100644 --- a/module/project/lang/zh-cn.php +++ b/module/project/lang/zh-cn.php @@ -131,6 +131,17 @@ $lang->project->moreProject = '更多项目'; $lang->project->days = '可用工作日'; $lang->project->etc = "等"; +$lang->project->kanban = new stdclass(); +$lang->project->kanban->typeList['my'] = '我负责的项目'; +$lang->project->kanban->typeList['other'] = '其他项目'; + +$lang->project->kanban->waitProjects = '未开始的项目'; +$lang->project->kanban->doingProjects = '进行中的项目'; +$lang->project->kanban->doingExecutions = '进行中的执行'; +$lang->project->kanban->closedProjects = '已关闭的项目'; + +$lang->project->kanban->laneColorList = array('#32C5FF', '#006AF1', '#9D28B2', '#FF8F26', '#FFC20E', '#00A78E', '#7FBB00', '#424BAC', '#C0E9FF', '#EC2761'); + $lang->project->productNotEmpty = '请关联产品或创建产品。'; $lang->project->existProductName = '产品名称已存在。'; $lang->project->changeProgram = '%s > 修改项目集'; diff --git a/module/project/model.php b/module/project/model.php index 319570cb95..bf5c04778b 100644 --- a/module/project/model.php +++ b/module/project/model.php @@ -1794,6 +1794,50 @@ class projectModel extends model return array_merge($parents, $orphan); } + /** + * Get stats for project kanban. + * + * @access public + * @return void + */ + public function getStats4Kanban() + { + $this->loadModel('program'); + + $projects = $this->program->getProjectStats(0, 'all'); + $executions = $this->getStats(0, 'doing'); + + $doingExecutions = array(); + $latestExecutions = array(); + foreach($executions as $execution) $doingExecutions[$execution->project][$execution->id] = $execution; + foreach($doingExecutions as $projectID => $executions) + { + krsort($doingExecutions[$projectID]); + $latestExecutions[$projectID] = current($doingExecutions[$projectID]); + } + + $myProjects = array(); + $otherProjects = array(); + foreach($projects as $project) + { + if(strpos('wait,doing,closed', $project->status) === false) continue; + + $projectPath = explode(',', trim($project->path, ',')); + $topProgram = !empty($project->parent) ? $projectPath[0] : $project->parent; + + if($project->PM == $this->app->user->account) + { + $myProjects[$topProgram][$project->status][$project->id] = $project; + } + else + { + $otherProjects[$topProgram][$project->status][$project->id] = $project; + } + } + + return array('kanbanGroup' => array('my' => $myProjects, 'other' => $otherProjects), 'latestExecutions' => $latestExecutions); + } + /** * Set menu of project module. * diff --git a/module/project/view/kanban.html.php b/module/project/view/kanban.html.php new file mode 100644 index 0000000000..771c44c2e3 --- /dev/null +++ b/module/project/view/kanban.html.php @@ -0,0 +1,119 @@ + + + + + +
+

project->empty;?>

+
+ + + $projectGroup):?> + +
+
+
+
project->kanban->typeList[$type];?>
+
+ + + + + + + + + + + + + + + $statusList):?> + + + + + + + + + + + + 9) $colorIndex = 0;?> + + +
project->kanban->waitProjects;?>project->statusList['doing'];?>project->kanban->closedProjects;?>
project->kanban->doingProjects;?>project->kanban->doingExecutions;?>
+
+ + +
+
+
> +
+
+ name;?> +
+
+
+
+
hours->progress);?>
+
+
+
+
+
+
+
+ id])):?> + id];?> +
> +
+
+ name;?> +
+
+
+
+
hours->progress);?>
+
+
+
+
+
+ +
+
+ + +
+
+
+ + +
> + name;?> +
+ + +
+
+
+
+
+
+ + + + +