* code for task#2171.
This commit is contained in:
@@ -43,18 +43,26 @@ class product extends control
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function index($locate = 'yes', $productID = 0)
|
||||
public function index($locate = 'yes', $productID = 0, $orderBy = 'code_asc', $recTotal = 0, $recPerPage = 10, $pageID = 1)
|
||||
{
|
||||
if($locate == 'yes') $this->locate($this->createLink($this->moduleName, 'browse'));
|
||||
|
||||
$this->session->set('productList', $this->app->getURI(true));
|
||||
if($this->app->getViewType() != 'mhtml') $this->product->setMenu($this->products, $productID);
|
||||
|
||||
/* Load pager and get tasks. */
|
||||
$this->app->loadClass('pager', $static = true);
|
||||
$pager = new pager($recTotal, $recPerPage, $pageID);
|
||||
|
||||
$this->app->loadLang('my');
|
||||
$this->view->title = $this->lang->product->allProduct;
|
||||
$this->view->position[] = $this->lang->product->allProduct;
|
||||
$this->view->productStats = $this->product->getStats();
|
||||
$this->view->productStats = $this->product->getStats($orderBy, $pager);
|
||||
$this->view->productID = $productID;
|
||||
$this->view->pager = $pager;
|
||||
$this->view->recTotal = $pager->recTotal;
|
||||
$this->view->recPerPage = $pager->recPerPage;
|
||||
$this->view->orderBy = $orderBy;
|
||||
$this->display();
|
||||
}
|
||||
|
||||
|
||||
+19
-17
@@ -466,15 +466,24 @@ class productModel extends model
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getStats()
|
||||
public function getStats($orderBy = 'code asc', $pager = null)
|
||||
{
|
||||
$this->loadModel('report');
|
||||
$this->loadModel('story');
|
||||
$this->loadModel('bug');
|
||||
|
||||
$products = $this->getList(',normal');
|
||||
$stats = array();
|
||||
foreach($products as $productID => $product)
|
||||
{
|
||||
if(!$this->checkPriv($product)) unset($products[$productID]);
|
||||
}
|
||||
$products = $this->dao->select('*')->from(TABLE_PRODUCT)
|
||||
->where('id')->in(array_keys($products))
|
||||
->orderBy($orderBy)
|
||||
->page($pager)
|
||||
->fetchAll('id');
|
||||
|
||||
$stats = array();
|
||||
$stories = $this->dao->select('product, status, count(status) AS count')
|
||||
->from(TABLE_STORY)
|
||||
->where('deleted')->eq(0)
|
||||
@@ -536,23 +545,16 @@ class productModel extends model
|
||||
->fetchPairs();
|
||||
foreach($products as $key => $product)
|
||||
{
|
||||
if($this->checkPriv($product))
|
||||
if($product->status != 'closed')
|
||||
{
|
||||
if($product->status != 'closed')
|
||||
{
|
||||
$product->stories = $stories[$product->id];
|
||||
$product->plans = isset($plans[$product->id]) ? $plans[$product->id] : 0;
|
||||
$product->releases= isset($releases[$product->id]) ? $releases[$product->id] : 0;
|
||||
$product->stories = $stories[$product->id];
|
||||
$product->plans = isset($plans[$product->id]) ? $plans[$product->id] : 0;
|
||||
$product->releases= isset($releases[$product->id]) ? $releases[$product->id] : 0;
|
||||
|
||||
$product->bugs = isset($bugs[$product->id]) ? $bugs[$product->id] : 0;
|
||||
$product->unResolved = isset($unResolved[$product->id]) ? $unResolved[$product->id] : 0;
|
||||
$product->assignToNull = isset($assignToNull[$product->id]) ? $assignToNull[$product->id] : 0;
|
||||
$stats[] = $product;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
unset($products[$key]);
|
||||
$product->bugs = isset($bugs[$product->id]) ? $bugs[$product->id] : 0;
|
||||
$product->unResolved = isset($unResolved[$product->id]) ? $unResolved[$product->id] : 0;
|
||||
$product->assignToNull = isset($assignToNull[$product->id]) ? $assignToNull[$product->id] : 0;
|
||||
$stats[] = $product;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -31,11 +31,12 @@
|
||||
</div>
|
||||
<?php else:?>
|
||||
<form method='post' action='<?php echo inLink('batchEdit', "productID=$productID");?>'>
|
||||
<table class='table table-condensed table-hover table-striped'>
|
||||
<table class='table table-condensed table-hover table-striped tablesorter'>
|
||||
<?php $vars = "locate=no&productID=$productID&orderBy=%s&recTotal={$pager->recTotal}&recPerPage={$pager->recPerPage}&pageID={$pager->pageID}";?>
|
||||
<thead>
|
||||
<tr>
|
||||
<th class='w-id'> <?php echo $lang->idAB;?></th>
|
||||
<th class='w-150px'><?php echo $lang->product->name;?></th>
|
||||
<th class='w-id'><?php common::printOrderLink('id', $orderBy, $vars, $lang->idAB);?></th>
|
||||
<th class='w-200px'><?php common::printOrderLink('name', $orderBy, $vars, $lang->product->name);?></th>
|
||||
<th><?php echo $lang->story->statusList['active'] . $lang->story->common;?></th>
|
||||
<th><?php echo $lang->story->statusList['changed'] . $lang->story->common;?></th>
|
||||
<th><?php echo $lang->story->statusList['draft'] . $lang->story->common;?></th>
|
||||
@@ -76,6 +77,7 @@
|
||||
<?php echo "<div class='btn-group'>" . html::selectButton() . '</div>';?>
|
||||
<?php echo html::submitButton($lang->product->batchEdit, '', '');?>
|
||||
</div>
|
||||
<div class='text-right'><?php $pager->show();?></div>
|
||||
</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
|
||||
Reference in New Issue
Block a user