* fix for roadmap sort for product view page.

This commit is contained in:
wangyidong
2020-05-15 11:24:09 +08:00
parent 7dc69e1f83
commit a1bbed1d5e
2 changed files with 26 additions and 14 deletions
+17 -1
View File
@@ -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();
}
+9 -13
View File
@@ -25,27 +25,23 @@
<div class="panel-body">
<div class="release-path">
<ul class="release-line">
<?php foreach($roadmaps as $year => $mapBranches):?>
<?php foreach($mapBranches as $plans):?>
<?php foreach($plans as $plan):?>
<?php if(isset($plan->begin)):?>
<li <?php if(date('Y-m-d') < $plan->begin) echo "class='active'";?>>
<a href="<?php echo $this->createLink('productplan', 'view', "planID={$plan->id}");?>">
<span class="title" title='<?php echo $plan->title;?>'><?php echo $plan->title;?></span>
<span class="date"><?php echo $plan->begin;?></span>
<?php foreach($roadmaps as $roadmap):?>
<?php if(isset($roadmap->begin)):?>
<li <?php if(date('Y-m-d') < $roadmap->begin) echo "class='active'";?>>
<a href="<?php echo $this->createLink('productplan', 'view', "planID={$roadmap->id}");?>">
<span class="title" title='<?php echo $roadmap->title;?>'><?php echo $roadmap->title;?></span>
<span class="date"><?php echo $roadmap->begin;?></span>
</a>
</li>
<?php else:?>
<li>
<a href="<?php echo $this->createLink('release', 'view', "releaseID={$plan->id}");?>">
<span class="title" title='<?php echo $plan->name;?>'><?php echo $plan->name;?></span>
<span class="date"><?php echo $plan->date;?></span>
<a href="<?php echo $this->createLink('release', 'view', "releaseID={$roadmap->id}");?>">
<span class="title" title='<?php echo $roadmap->name;?>'><?php echo $roadmap->name;?></span>
<span class="date"><?php echo $roadmap->date;?></span>
</a>
</li>
<?php endif;?>
<?php endforeach;?>
<?php endforeach;?>
<?php endforeach;?>
</ul>
</div>
<?php echo html::a($this->createLink('product', 'roadmap', "productID={$product->id}"), $lang->product->iterationView . "<span class='label label-badge label-icon'><i class='icon icon-arrow-right'></i></span>", '', "class='btn btn-primary btn-circle btn-icon-right btn-sm pull-right'");?>