From 25262593fc56eea0eb2716709cc7c5284aede24a Mon Sep 17 00:00:00 2001 From: xia0ta0 Date: Wed, 5 Mar 2014 10:05:08 +0800 Subject: [PATCH] * code for task#1800. --- module/story/model.php | 21 +++++++++++++++++---- module/task/control.php | 2 +- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/module/story/model.php b/module/story/model.php index 861a1720ae..ced3738f85 100644 --- a/module/story/model.php +++ b/module/story/model.php @@ -1071,10 +1071,11 @@ class storyModel extends model * @param int $projectID * @param int $productID * @param array|string $moduleIds + * @param string $type * @access public * @return array */ - public function getProjectStoryPairs($projectID = 0, $productID = 0, $moduleIds = 0) + public function getProjectStoryPairs($projectID = 0, $productID = 0, $moduleIds = 0, $type = 'full') { $stories = $this->dao->select('t2.id, t2.title, t2.module, t2.pri, t2.estimate, t3.name AS product') ->from(TABLE_PROJECTSTORY)->alias('t1') @@ -1088,7 +1089,7 @@ class storyModel extends model ->beginIF($moduleIds)->andWhere('t2.module')->in($moduleIds)->fi() ->fetchAll(); if(!$stories) return array(); - return $this->formatStories($stories); + return $this->formatStories($stories, $type); } /** @@ -1228,10 +1229,11 @@ class storyModel extends model * Format stories * * @param array $stories + * @param string $type * @access public * @return void */ - public function formatStories($stories) + public function formatStories($stories, $type = 'full') { /* Get module names of stories. */ /*$modules = array(); @@ -1240,7 +1242,18 @@ class storyModel extends model /* Format these stories. */ $storyPairs = array('' => ' '); - foreach($stories as $story) $storyPairs[$story->id] = $story->id . ':' . $story->title . "({$this->lang->story->pri}:$story->pri, {$this->lang->story->estimate}: $story->estimate)"; + foreach($stories as $story) + { + if($type == 'short') + { + $property = '[p' . $story->pri . ', ' . $story->estimate . 'h]'; + } + else + { + $property = '(' . $this->lang->story->pri . ':' . $story->pri . ',' . $this->lang->story->estimate . ':' . $story->estimate . ')'; + } + $storyPairs[$story->id] = $story->id . ':' . $story->title . $property; + } return $storyPairs; } diff --git a/module/task/control.php b/module/task/control.php index 68856871b9..fadadc6371 100644 --- a/module/task/control.php +++ b/module/task/control.php @@ -161,7 +161,7 @@ class task extends control die(js::locate($storyLink, 'parent')); } - $stories = $this->story->getProjectStoryPairs($projectID); + $stories = $this->story->getProjectStoryPairs($projectID, 0, 0, 'short'); $members = $this->project->getTeamMemberPairs($projectID, 'nodeleted'); $modules = $this->loadModel('tree')->getTaskOptionMenu($projectID); $title = $project->name . $this->lang->colon . $this->lang->task->batchCreate;