diff --git a/module/my/control.php b/module/my/control.php index 8740535aaf..28cbc46372 100644 --- a/module/my/control.php +++ b/module/my/control.php @@ -72,7 +72,7 @@ class my extends control * @access public * @return void */ - public function story() + public function story($type = 'assignedto') { /* Save session. */ $this->session->set('storyList', $this->app->getURI(true)); @@ -80,8 +80,9 @@ class my extends control /* Assign. */ $this->view->header->title = $this->lang->my->common . $this->lang->colon . $this->lang->my->story; $this->view->position[] = $this->lang->my->story; - $this->view->stories = $this->loadModel('story')->getUserStories($this->app->user->account, 'active,draft,changed'); + $this->view->stories = $this->loadModel('story')->getUserStories($this->app->user->account, $type); $this->view->users = $this->user->getPairs('noletter'); + $this->view->type = $type; $this->display(); } diff --git a/module/my/lang/en.php b/module/my/lang/en.php index 36a8ada467..073bc6abc0 100644 --- a/module/my/lang/en.php +++ b/module/my/lang/en.php @@ -18,3 +18,8 @@ $lang->my->taskMenu->openedByMe = 'My opened'; $lang->my->taskMenu->finishedByMe = 'My finished'; $lang->my->taskMenu->closedByMe = 'My closed'; $lang->my->taskMenu->canceledByMe = 'My canceled'; + +$lang->my->storyMenu->assignedToMe = 'To me'; +$lang->my->storyMenu->openedByMe = 'My opened'; +$lang->my->storyMenu->reviewedByMe = 'My reviewed'; +$lang->my->storyMenu->closedByMe = 'My closed'; diff --git a/module/my/lang/zh-cn.php b/module/my/lang/zh-cn.php index 22b8c186bb..9ff7793de9 100644 --- a/module/my/lang/zh-cn.php +++ b/module/my/lang/zh-cn.php @@ -18,3 +18,8 @@ $lang->my->taskMenu->openedByMe = '由我创建'; $lang->my->taskMenu->finishedByMe = '由我完成'; $lang->my->taskMenu->closedByMe = '由我关闭'; $lang->my->taskMenu->canceledByMe = '由我取消'; + +$lang->my->storyMenu->assignedToMe = '指派给我'; +$lang->my->storyMenu->openedByMe = '由我创建'; +$lang->my->storyMenu->reviewedByMe = '由我评审'; +$lang->my->storyMenu->closedByMe = '由我关闭'; diff --git a/module/my/view/story.html.php b/module/my/view/story.html.php index 676169af82..54f61b44c3 100644 --- a/module/my/view/story.html.php +++ b/module/my/view/story.html.php @@ -12,6 +12,18 @@ ?> +
+
+
+ " . html::a(inlink('story', "type=assignedto"), $lang->my->storyMenu->assignedToMe) . ""; + echo "" . html::a(inlink('story', "type=openedby"), $lang->my->storyMenu->openedByMe) . ""; + echo "" . html::a(inlink('story', "type=reviewedby"), $lang->my->storyMenu->reviewedByMe) . ""; + echo "" . html::a(inlink('story', "type=closedby"), $lang->my->storyMenu->closedByMe) . ""; + ?> +
+
+
@@ -53,4 +65,5 @@
+ diff --git a/module/story/model.php b/module/story/model.php index 02dcbc5769..6c6402b349 100644 --- a/module/story/model.php +++ b/module/story/model.php @@ -581,20 +581,24 @@ class storyModel extends model * Get stories of a user. * * @param string $account - * @param string $status + * @param string $type the query type * @param string $orderBy * @param object $pager * @access public * @return array */ - public function getUserStories($account, $status = 'all', $orderBy = 'id_desc', $pager = null) + public function getUserStories($account, $type = 'assignedto', $orderBy = 'id_desc', $pager = null) { + $type = strtolower($type); return $this->dao->select('t1.*, t2.title as planTitle, t3.name as productTitle') ->from(TABLE_STORY)->alias('t1') ->leftJoin(TABLE_PRODUCTPLAN)->alias('t2')->on('t1.plan = t2.id') ->leftJoin(TABLE_PRODUCT)->alias('t3')->on('t1.product = t3.id') - ->where('t1.assignedTo')->eq($account) - ->andWhere('t1.deleted')->eq(0) + ->where('t1.deleted')->eq(0) + ->beginIF($type == 'assignedto')->andWhere('assignedTo')->eq($this->app->user->account)->fi() + ->beginIF($type == 'openedby')->andWhere('openedby')->eq($this->app->user->account)->fi() + ->beginIF($type == 'reviewedby')->andWhere('reviewedby')->like('%' . $this->app->user->account . '%')->fi() + ->beginIF($type == 'closedby')->andWhere('closedby')->eq($this->app->user->account)->fi() ->orderBy($orderBy)->page($pager)->fetchAll(); }