From a1bbed1d5e1285554436baaa7a8ddcf3f2ca1afd Mon Sep 17 00:00:00 2001 From: wangyidong Date: Fri, 15 May 2020 11:24:09 +0800 Subject: [PATCH] * fix for roadmap sort for product view page. --- module/product/control.php | 18 +++++++++++++++++- module/product/view/view.html.php | 22 +++++++++------------- 2 files changed, 26 insertions(+), 14 deletions(-) diff --git a/module/product/control.php b/module/product/control.php index e6908a7352..56b8236165 100644 --- a/module/product/control.php +++ b/module/product/control.php @@ -409,6 +409,22 @@ class product extends control $product->desc = $this->loadModel('file')->setImgSize($product->desc); $this->product->setMenu($this->products, $productID); + /* Sort roadmaps. */ + $roadmapGroups = $this->product->getRoadmap($productID, 0, 6); + $roadmaps = array(); + foreach($roadmapGroups as $year => $mapBranches) + { + foreach($mapBranches as $branchID => $plans) + { + foreach($plans as $plan) + { + $date = isset($plan->begin) ? $plan->begin : $plan->date; + $roadmaps[$date . $branchID] = $plan; + } + } + } + krsort($roadmaps); + /* Load pager. */ $this->app->loadClass('pager', $static = true); $pager = new pager(0, 30, 1); @@ -425,7 +441,7 @@ class product extends control $this->view->lines = array('') + $this->loadModel('tree')->getLinePairs(); $this->view->branches = $this->loadModel('branch')->getPairs($productID); $this->view->dynamics = $this->loadModel('action')->getDynamic('all', 'all', 'date_desc', $pager, $productID); - $this->view->roadmaps = $this->product->getRoadmap($productID, 0, 6); + $this->view->roadmaps = $roadmaps; $this->display(); } diff --git a/module/product/view/view.html.php b/module/product/view/view.html.php index a6dba09bd3..6cb73513d8 100644 --- a/module/product/view/view.html.php +++ b/module/product/view/view.html.php @@ -25,27 +25,23 @@
createLink('product', 'roadmap', "productID={$product->id}"), $lang->product->iterationView . "", '', "class='btn btn-primary btn-circle btn-icon-right btn-sm pull-right'");?>