* Finish task #7951. Fix bug 3369.

This commit is contained in:
holan20180123
2020-09-28 08:54:14 +08:00
parent a335a811f7
commit ed523a1442
7 changed files with 198 additions and 76 deletions
+20 -6
View File
@@ -1232,11 +1232,27 @@ EOD;
*/
public function getPreAndNextObject($type, $objectID)
{
$preAndNextObject = new stdClass();
$preAndNextObject = new stdClass();
$preAndNextObject->pre = '';
$preAndNextObject->next = '';
/* Use existObject when the preAndNextObject of this objectID has exist in session. */
$existObject = $type . 'PreAndNext';
if(isset($_SESSION[$existObject]) and $_SESSION[$existObject]['objectID'] == $objectID) return $_SESSION[$existObject]['preAndNextObject'];
if($type == 'story' and !empty($_SESSION['planStoryOrder']))
{
$objects = explode(',', $_SESSION['planStoryOrder']);
$key = array_search($objectID, $objects);
if($key > 0)
{
$preObjectID = $objects[$key - 1];
$preAndNextObject->pre = $this->loadModel('story')->getByID($preObjectID);
}
if($key < (count($objects) - 1))
{
$nextObjectID = $objects[$key + 1];
$preAndNextObject->next = $this->loadModel('story')->getByID($nextObjectID);
}
return $preAndNextObject;
}
/* Get objectIDList. */
$table = $this->config->objectTables[$type];
@@ -1258,8 +1274,6 @@ EOD;
}
$preObj = false;
$preAndNextObject->pre = '';
$preAndNextObject->next = '';
while($object = $queryObjects->fetch())
{
$key = (!$this->session->$typeOnlyCondition and $type == 'testcase' and isset($object->case)) ? 'case' : 'id';