From 55a8e375c66ce1add55c5c3906d9c817553ccfb4 Mon Sep 17 00:00:00 2001 From: "chencongzhi520@gmail.com" Date: Thu, 14 Jun 2012 02:14:36 +0000 Subject: [PATCH] * Code for task#693. --- module/common/model.php | 33 +++++++++++++++++++++------------ module/my/control.php | 7 ++++++- module/project/control.php | 5 +++++ module/testtask/control.php | 5 +++++ 4 files changed, 37 insertions(+), 13 deletions(-) diff --git a/module/common/model.php b/module/common/model.php index dae17fada3..6ab8b818e0 100644 --- a/module/common/model.php +++ b/module/common/model.php @@ -451,18 +451,27 @@ class commonModel extends model default:break; } - /* Get objectIDs. */ - $queryCondition = $type . 'QueryCondition'; - $queryCondition = $this->session->$queryCondition; - $orderBy = $type . 'OrderBy'; - $orderBy = $this->session->$orderBy; - $objects = $this->dao->select('*')->from($table) - ->beginIF($queryCondition != false)->where($queryCondition)->fi() - ->beginIF($orderBy != false)->orderBy($orderBy)->fi() - ->fetchAll(); - $tmpObjectIDs = array(); - foreach($objects as $object) $tmpObjectIDs[$object->id] = $object->id; - $objectIDs = ',' . implode(',', $tmpObjectIDs) . ','; + $typeIDs = $type . 'IDs'; + if($this->session->$typeIDs) + { + $objectIDs = $this->session->$typeIDs; + } + else + { + /* Get objectIDs. */ + $queryCondition = $type . 'QueryCondition'; + $queryCondition = $this->session->$queryCondition; + $orderBy = $type . 'OrderBy'; + $orderBy = $this->session->$orderBy; + $objects = $this->dao->select('*')->from($table) + ->beginIF($queryCondition != false)->where($queryCondition)->fi() + ->beginIF($orderBy != false)->orderBy($orderBy)->fi() + ->fetchAll(); + $tmpObjectIDs = array(); + foreach($objects as $object) $tmpObjectIDs[$object->id] = $object->id; + $objectIDs = ',' . implode(',', $tmpObjectIDs) . ','; + $this->session->set($type . 'IDs', $objectIDs); + } /* Current object. */ $currentStart = strpos($objectIDs, ',' . $objectID . ',') + 1; diff --git a/module/my/control.php b/module/my/control.php index fc66b5987f..e314204436 100644 --- a/module/my/control.php +++ b/module/my/control.php @@ -208,7 +208,12 @@ class my extends control ->andWhere('deleted')->eq(0) ->orderBy($orderBy)->page($pager)->fetchAll(); } - + + /* Save bugIDs session for get the pre and next bug. */ + $bugIDs = ''; + foreach($bugs as $bug) $bugIDs .= ',' . $bug->id; + $this->session->set('bugIDs', $bugIDs . ','); + /* assign. */ $this->view->header->title = $this->lang->my->common . $this->lang->colon . $this->lang->my->bug; $this->view->position[] = $this->lang->my->bug; diff --git a/module/project/control.php b/module/project/control.php index 3adfd6e8fd..a171f60282 100644 --- a/module/project/control.php +++ b/module/project/control.php @@ -476,6 +476,11 @@ class project extends control $storyTasks = $this->task->getStoryTaskCounts(array_keys($stories), $projectID); $users = $this->user->getPairs('noletter'); + /* Save storyIDs session for get the pre and next story. */ + $storyIDs = ''; + foreach($stories as $story) $storyIDs .= ',' . $story->id; + $this->session->set('storyIDs', $storyIDs . ','); + /* Get project's product. */ $productID = 0; $products = $this->loadModel('product')->getProductsByProject($projectID); diff --git a/module/testtask/control.php b/module/testtask/control.php index 3c254c02d3..014e9bcd73 100644 --- a/module/testtask/control.php +++ b/module/testtask/control.php @@ -227,6 +227,11 @@ class testtask extends control $this->view->runs = $this->testtask->getUserRuns($taskID, $this->session->user->account, $pager); } + /* Save testcaseIDs session for get the pre and next testcase. */ + $testcaseIDs = ''; + foreach($this->view->runs as $run) $testcaseIDs .= ',' . $run->case; + $this->session->set('testcaseIDs', $testcaseIDs . ','); + $this->view->header['title'] = $this->products[$productID] . $this->lang->colon . $this->lang->testtask->cases; $this->view->position[] = html::a($this->createLink('testtask', 'browse', "productID=$productID"), $this->products[$productID]); $this->view->position[] = $this->lang->testtask->cases;