From 769ef6c968e2d19b1514cc746eb011384c93a03a Mon Sep 17 00:00:00 2001 From: wangchunsheng Date: Tue, 5 Jan 2010 05:09:13 +0000 Subject: [PATCH] + init the code to import task. --- trunk/module/project/model.php | 15 ++++++ trunk/module/project/view/task.html.php | 5 +- trunk/module/task/control.php | 15 ++++++ trunk/module/task/lang/zh-cn.php | 1 + trunk/module/task/view/import.html.php | 72 +++++++++++++++++++++++++ 5 files changed, 107 insertions(+), 1 deletion(-) create mode 100644 trunk/module/task/view/import.html.php diff --git a/trunk/module/project/model.php b/trunk/module/project/model.php index 0a5d098823..b7c566dbcc 100644 --- a/trunk/module/project/model.php +++ b/trunk/module/project/model.php @@ -139,6 +139,21 @@ class projectModel extends model foreach($products as $productID) $this->dao->insert(TABLE_PROJECTPRODUCT)->set('project')->eq((int)$projectID)->set('product')->eq((int)$productID)->exec(); } + /* 获得相关项目列表。*/ + public function getRelatedProjects($projectID) + { + $products = $this->dao->select('product')->from(TABLE_PROJECTPRODUCT)->where('project')->eq((int)$projectID)->fetchAll('product'); + if(!$products) return array(); + $products = array_keys($products); + return $this->dao->select('t1.id, t1.name')->from(TABLE_PROJECT)->alias('t1') + ->leftJoin(TABLE_PROJECTPRODUCT)->alias('t2') + ->on('t1.id = t2.project') + ->where('t2.product')->in($products) + ->andWhere('t1.id')->ne((int)$projectID) + ->orderBy('t1.id') + ->fetchPairs(); + } + /* 获得相关的子项目列表。*/ public function getChildProjects($projectID) { diff --git a/trunk/module/project/view/task.html.php b/trunk/module/project/view/task.html.php index e3b7d69169..eb25d6a538 100644 --- a/trunk/module/project/view/task.html.php +++ b/trunk/module/project/view/task.html.php @@ -30,7 +30,10 @@
- createLink('task', 'create', "project=$project->id"), $lang->task->create);?> + id", $lang->task->create); + common::printLink('task', 'import', "project=$project->id", $lang->task->import); + ?>
diff --git a/trunk/module/task/control.php b/trunk/module/task/control.php index 4259bf14cf..0beafe671b 100644 --- a/trunk/module/task/control.php +++ b/trunk/module/task/control.php @@ -77,6 +77,21 @@ class task extends control $this->display(); } + /* 导入任务。*/ + //public function import($projectID) + //{ + // /* 设置菜单。*/ + // $this->project->setMenu($this->project->getPairs(), $projectID); + + // $relatedProjects = $this->project->getRelatedProjects($projectID); + // $tasks = array(); + // foreach($relatedProjects as $projectID => $projectName) $tasks = array_merge($tasks, $this->task->getProjectTasks($projectID)); + // $this->view->header->title = $this->lang->task->import; + // $this->view->position = $this->lang->task->import; + // $this->view->tasks = $tasks; + // $this->display(); + //} + /* 编辑任务。*/ public function edit($taskID) { diff --git a/trunk/module/task/lang/zh-cn.php b/trunk/module/task/lang/zh-cn.php index 38e972d710..d330e3b45e 100644 --- a/trunk/module/task/lang/zh-cn.php +++ b/trunk/module/task/lang/zh-cn.php @@ -24,6 +24,7 @@ $lang->task->common = '任务'; $lang->task->index = "任务一览"; $lang->task->create = "新增任务"; +$lang->task->import = "导入之前未完任务"; $lang->task->edit = "更新"; $lang->task->delete = "删除"; $lang->task->view = "查看任务"; diff --git a/trunk/module/task/view/import.html.php b/trunk/module/task/view/import.html.php new file mode 100644 index 0000000000..0e840aa8cf --- /dev/null +++ b/trunk/module/task/view/import.html.php @@ -0,0 +1,72 @@ +. + * + * @copyright Copyright: 2009 Chunsheng Wang + * @author Chunsheng Wang + * @package task + * @version $Id$ + * @link http://www.zentao.cn + */ +?> + +
+
+ + + + + + + + + + + + + + + + + + owner == $app->user->account ? 'style=color:red' : '';?> + + + + + + + + + + + + + + + +
task->id;?>task->pri;?>task->name;?>task->owner;?>task->estimate;?>task->consumed;?>task->left;?>task->type;?>task->status;?>task->story;?>action;?>
createLink('task', 'view', "task=$task->id"), sprintf('%03d', $task->id)); else printf('%03d', $task->id);?>pri;?>name;?>>ownerRealName;?>estimate;?>consumed;?>left;?>task->typeList[$task->type];?>status;?> >task->statusList->{$task->status};?> + storyID) + { + if(common::hasPriv('story', 'view')) echo html::a($this->createLink('story', 'view', "storyid=$task->storyID"), $task->storyTitle); + else echo $task->storyTitle; + } + ?> + +
+ +