From b7df1c565cd807c15d30f7af09233518e55f5537 Mon Sep 17 00:00:00 2001 From: wangchunsheng Date: Mon, 29 Nov 2010 03:40:02 +0000 Subject: [PATCH] + add feature bars to my task page. --- module/my/control.php | 7 +++++-- module/my/lang/en.php | 8 +++++++- module/my/lang/zh-cn.php | 6 ++++++ module/my/view/bug.html.php | 4 +--- module/my/view/task.html.php | 31 +++++++++++++++++++++++++++---- module/project/view/task.html.php | 17 ++++++----------- module/task/model.php | 13 ++++++++----- module/task/view/view.html.php | 4 ++-- 8 files changed, 62 insertions(+), 28 deletions(-) diff --git a/module/my/control.php b/module/my/control.php index 562e8b0827..8740535aaf 100644 --- a/module/my/control.php +++ b/module/my/control.php @@ -89,10 +89,11 @@ class my extends control /** * My tasks. * + * @param string $type the browse type * @access public * @return void */ - public function task() + public function task($type = 'assignedto') { /* Save session. */ $this->session->set('taskList', $this->app->getURI(true)); @@ -102,7 +103,9 @@ class my extends control $this->view->header->title = $this->lang->my->common . $this->lang->colon . $this->lang->my->task; $this->view->position[] = $this->lang->my->task; $this->view->tabID = 'task'; - $this->view->tasks = $this->loadModel('task')->getUserTasks($this->app->user->account, 'wait,doing'); + $this->view->tasks = $this->loadModel('task')->getUserTasks($this->app->user->account, $type); + $this->view->type = $type; + $this->view->users = $this->loadModel('user')->getPairs('noletter'); $this->display(); } diff --git a/module/my/lang/en.php b/module/my/lang/en.php index a48adeb067..36a8ada467 100644 --- a/module/my/lang/en.php +++ b/module/my/lang/en.php @@ -1,7 +1,7 @@ my->common = 'Dashboard'; -/* 方法列表。*/ +/* Methods. */ $lang->my->index = 'Index'; $lang->my->todo = 'Todo'; $lang->my->task = 'Task'; @@ -12,3 +12,9 @@ $lang->my->project = 'Project'; $lang->my->team = 'Team'; $lang->my->profile = 'Profile'; $lang->my->editProfile = 'Edit profile'; + +$lang->my->taskMenu->assignedToMe = 'To me'; +$lang->my->taskMenu->openedByMe = 'My opened'; +$lang->my->taskMenu->finishedByMe = 'My finished'; +$lang->my->taskMenu->closedByMe = 'My closed'; +$lang->my->taskMenu->canceledByMe = 'My canceled'; diff --git a/module/my/lang/zh-cn.php b/module/my/lang/zh-cn.php index c26e456e15..22b8c186bb 100644 --- a/module/my/lang/zh-cn.php +++ b/module/my/lang/zh-cn.php @@ -12,3 +12,9 @@ $lang->my->project = '我的项目'; $lang->my->team = '我的团队'; $lang->my->profile = '我的档案'; $lang->my->editProfile = '更新信息'; + +$lang->my->taskMenu->assignedToMe = '指派给我'; +$lang->my->taskMenu->openedByMe = '由我创建'; +$lang->my->taskMenu->finishedByMe = '由我完成'; +$lang->my->taskMenu->closedByMe = '由我关闭'; +$lang->my->taskMenu->canceledByMe = '由我取消'; diff --git a/module/my/view/bug.html.php b/module/my/view/bug.html.php index 06bb045e74..fe7231c933 100644 --- a/module/my/view/bug.html.php +++ b/module/my/view/bug.html.php @@ -63,7 +63,5 @@ show();?> - + diff --git a/module/my/view/task.html.php b/module/my/view/task.html.php index 3a6f1df2bb..05db380791 100644 --- a/module/my/view/task.html.php +++ b/module/my/view/task.html.php @@ -13,19 +13,33 @@
- +
+
+ " . html::a(inlink('task', "type=assignedto"), $lang->my->taskMenu->assignedToMe) . ""; + echo "" . html::a(inlink('task', "type=openedby"), $lang->my->taskMenu->openedByMe) . ""; + echo "" . html::a(inlink('task', "type=finishedby"), $lang->my->taskMenu->finishedByMe) . ""; + echo "" . html::a(inlink('task', "type=closedby"), $lang->my->taskMenu->closedByMe) . ""; + echo "" . html::a(inlink('task', "type=canceledby"), $lang->my->taskMenu->canceledByMe) . ""; + ?> +
+
+ +
+
- + - + + @@ -40,10 +54,19 @@ - + +
idAB;?> priAB;?>task->project;?>task->project;?> task->name;?> task->estimateAB;?> task->consumedAB;?> task->leftAB;?> task->deadlineAB;?> statusAB;?>actions;?>openedByAB;?>actions;?>
left;?> delay)) echo 'delayed';?>>deadline, 0, 4) > 0) echo $task->deadline;?> task->statusList[$task->status];?>createLink('task', 'edit', "taskID=$task->id"), $lang->task->edit, '_blank');?>openedBy];?> + status == 'wait') and common::printLink('task', 'start', "taskID=$task->id", $lang->task->buttonStart))) echo $lang->task->buttonStart . ' '; + if(!(($task->status == 'wait' or $task->status == 'doing') and common::printLink('task', 'finish', "taskID=$task->id", $lang->task->buttonDone))) echo $lang->task->buttonDone . ' '; + if(!(($task->status == 'done' or $task->status == 'cancel') and common::printLink('task', 'close', "taskID=$task->id", $lang->task->buttonClose))) echo $lang->task->buttonClose . ' '; + if(!(($task->status == 'closed' or $task->status == 'done' or $task->status == 'cancel') and common::printLink('task', 'activate', "taskID=$task->id", $lang->task->buttonActivate))) echo $lang->task->buttonActivate . ' '; + ?> +
+ diff --git a/module/project/view/task.html.php b/module/project/view/task.html.php index ee1a46d4b7..95f9288cfb 100644 --- a/module/project/view/task.html.php +++ b/module/project/view/task.html.php @@ -29,7 +29,7 @@ task->deadlineAB);?> statusAB);?> task->story);?> - actions;?> + actions;?> @@ -66,16 +66,11 @@ ?> - id", $lang->edit);?> - id", $lang->confirm, 'hiddenwin'); - } - else - { - common::printLink('task', 'delete', "projectID=$task->project&taskid=$task->id", $lang->delete, 'hiddenwin'); - } + status == 'wait' or $task->status == 'doing') and common::printLink('task', 'finish', "taskID=$task->id", $lang->task->buttonDone))) echo $lang->task->buttonDone . ' '; + if(!(($task->status == 'done' or $task->status == 'cancel') and common::printLink('task', 'close', "taskID=$task->id", $lang->task->buttonClose))) echo $lang->task->buttonClose . ' '; + if(!common::printLink('task', 'edit', "taskID=$task->id", $lang->task->buttonEdit)) echo $lang->task->buttonEdit . ' '; + if($browseType == 'needconfirm') common::printLink('task', 'confirmStoryChange', "taskid=$task->id", $lang->confirm, 'hiddenwin'); ?> diff --git a/module/task/model.php b/module/task/model.php index 0c949d4733..c13e619d75 100644 --- a/module/task/model.php +++ b/module/task/model.php @@ -342,11 +342,11 @@ class taskModel extends model * Get tasks of a user. * * @param string $account - * @param string $status + * @param string $type the query type * @access public * @return array */ - public function getUserTasks($account, $status = 'all') + public function getUserTasks($account, $type = 'assignedto') { $tasks = $this->dao->select('t1.*, t2.id as projectID, t2.name as projectName, t3.id as storyID, t3.title as storyTitle, t3.status AS storyStatus, t3.version AS latestStoryVersion') ->from(TABLE_TASK)->alias('t1') @@ -354,9 +354,12 @@ class taskModel extends model ->on('t1.project = t2.id') ->leftjoin(TABLE_STORY)->alias('t3') ->on('t1.story = t3.id') - ->where('t1.assignedTo')->eq($account) - ->andWhere('t1.deleted')->eq(0) - ->beginIF($status != 'all')->andWhere('t1.status')->in($status)->fi() + ->where('t1.deleted')->eq(0) + ->beginIF($type == 'openedby')->andWhere('t1.openedBy')->eq($account)->fi() + ->beginIF($type == 'assignedto')->andWhere('t1.assignedto')->eq($account)->fi() + ->beginIF($type == 'finishedby')->andWhere('t1.finishedby')->eq($account)->fi() + ->beginIF($type == 'closedby')->andWhere('t1.closedby')->eq($account)->fi() + ->beginIF($type == 'canceledby')->andWhere('t1.canceledby')->eq($account)->fi() ->fetchAll(); if($tasks) return $this->processTasks($tasks); return array(); diff --git a/module/task/view/view.html.php b/module/task/view/view.html.php index f53e209d35..a5d2c8ed12 100644 --- a/module/task/view/view.html.php +++ b/module/task/view/view.html.php @@ -22,7 +22,7 @@ if(!$task->deleted) { //if(!($task->status != 'closed' and $task->status != 'cancel' and common::printLink('task', 'logEfforts', "taskID=$task->id", $lang->task->buttonLogEfforts))) echo $lang->task->buttonLogEfforts . ' '; - if(!(($task->status == 'wait' or $task->status == 'cancel') and common::printLink('task', 'start', "taskID=$task->id", $lang->task->buttonStart))) echo $lang->task->buttonStart . ' '; + if(!(($task->status == 'wait') and common::printLink('task', 'start', "taskID=$task->id", $lang->task->buttonStart))) echo $lang->task->buttonStart . ' '; if(!(($task->status == 'wait' or $task->status == 'doing') and common::printLink('task', 'finish', "taskID=$task->id", $lang->task->buttonDone))) echo $lang->task->buttonDone . ' '; if(!(($task->status == 'done' or $task->status == 'cancel') and common::printLink('task', 'close', "taskID=$task->id", $lang->task->buttonClose))) echo $lang->task->buttonClose . ' '; if(!(($task->status == 'wait' or $task->status == 'doing') and common::printLink('task', 'cancel', "taskID=$task->id", $lang->task->buttonCancel))) echo $lang->task->buttonCancel . ' '; @@ -49,7 +49,7 @@ deleted) { - if(!(($task->status == 'wait' or $task->status == 'cancel') and common::printLink('task', 'start', "taskID=$task->id", $lang->task->buttonStart))) echo $lang->task->buttonStart . ' '; + if(!(($task->status == 'wait') and common::printLink('task', 'start', "taskID=$task->id", $lang->task->buttonStart))) echo $lang->task->buttonStart . ' '; if(!(($task->status == 'wait' or $task->status == 'doing') and common::printLink('task', 'finish', "taskID=$task->id", $lang->task->buttonDone))) echo $lang->task->buttonDone . ' '; if(!(($task->status == 'done' or $task->status == 'cancel') and common::printLink('task', 'close', "taskID=$task->id", $lang->task->buttonClose))) echo $lang->task->buttonClose . ' '; if(!(($task->status == 'wait' or $task->status == 'doing') and common::printLink('task', 'cancel', "taskID=$task->id", $lang->task->buttonCancel))) echo $lang->task->buttonCancel . ' ';