* Finish task #71906.

This commit is contained in:
曹延义
2022-10-08 17:17:42 +08:00
parent 62cc57a8e7
commit 9e7e1f6969
5 changed files with 27 additions and 12 deletions
+1 -1
View File
@@ -25,7 +25,7 @@ class productProjectsEntry extends entry
$appendFields = $this->param('fields', '');
$control = $this->loadController('product', 'project');
$control->project($this->param('status', 'all'), $productID, $this->param('branch', 0), $this->param('involved', 0), $this->param('order', 'order_desc'));
$control->project($this->param('status', 'all'), $productID, $this->param('branch', 0), $this->param('involved', 0), $this->param('order', 'order_desc'), 0, $this->param('limit', 20), $this->param('page', 1));
$data = $this->getData();
if(isset($data->status) and $data->status == 'success')
+13 -2
View File
@@ -73,10 +73,13 @@ class product extends control
* @param int $branch
* @param int $involved
* @param string $orderBy
* @param int $recTotal
* @param int $recPerPage
* @param int $pageID
* @access public
* @return void
*/
public function project($status = 'all', $productID = 0, $branch = '', $involved = 0, $orderBy = 'order_desc')
public function project($status = 'all', $productID = 0, $branch = '', $involved = 0, $orderBy = 'order_desc', $recTotal = 0, $recPerPage = 20, $pageID = 1)
{
$this->app->loadLang('execution');
$this->loadModel('project');
@@ -87,9 +90,13 @@ class product extends control
$this->product->setMenu($productID, $branch);
/* Load pager. */
$this->app->loadClass('pager', $static = true);
$pager = new pager($recTotal, $recPerPage, $pageID);
/* Get PM id list. */
$accounts = array();
$projectStats = $this->product->getProjectStatsByProduct($productID, $status, $branch, $involved, $orderBy);
$projectStats = $this->product->getProjectStatsByProduct($productID, $status, $branch, $involved, $orderBy, $pager);
$product = $this->product->getByID($productID);
$projects = $this->project->getPairsByProgram($product->program, 'all', false, 'order_asc');
@@ -112,6 +119,10 @@ class product extends control
$this->view->users = $this->loadModel('user')->getPairs('noletter');
$this->view->branchID = $branch;
$this->view->branchStatus = $this->loadModel('branch')->getByID($branch, 0, 'status');
$this->view->recTotal = $recTotal;
$this->view->recPerPage = $recPerPage;
$this->view->pageID = $pageID;
$this->view->pager = $pager;
$this->display();
}
+11 -8
View File
@@ -1183,15 +1183,16 @@ class productModel extends model
/**
* Get project list by product.
*
* @param int $productID
* @param string $browseType
* @param int $branch
* @param int $involved
* @param string $orderBy
* @param int $productID
* @param string $browseType
* @param int $branch
* @param int $involved
* @param string $orderBy
* @param object $pager
* @access public
* @return array
*/
public function getProjectListByProduct($productID, $browseType = 'all', $branch = 0, $involved = 0, $orderBy = 'order_desc')
public function getProjectListByProduct($productID, $browseType = 'all', $branch = 0, $involved = 0, $orderBy = 'order_desc', $pager = null)
{
$projectList = $this->dao->select('t2.*')->from(TABLE_PROJECTPRODUCT)->alias('t1')
->leftJoin(TABLE_PROJECT)->alias('t2')->on('t1.project = t2.id')
@@ -1210,6 +1211,7 @@ class productModel extends model
->beginIF($branch !== '' and $branch !== 'all')->andWhere('t1.branch')->in($branch)->fi()
->andWhere('t2.deleted')->eq('0')
->orderBy($orderBy)
->page($pager)
->fetchAll('id');
/* Determine how to display the name of the program. */
@@ -1231,12 +1233,13 @@ class productModel extends model
* @param int $branch
* @param int $involved
* @param string $orderBy
* @param object $pager
* @access public
* @return array
*/
public function getProjectStatsByProduct($productID, $browseType = 'all', $branch = 0, $involved = 0, $orderBy = 'order_desc')
public function getProjectStatsByProduct($productID, $browseType = 'all', $branch = 0, $involved = 0, $orderBy = 'order_desc', $pager = null)
{
$projects = $this->getProjectListByProduct($productID, $browseType, $branch, $involved, $orderBy);
$projects = $this->getProjectListByProduct($productID, $browseType, $branch, $involved, $orderBy, $pager);
if(empty($projects)) return array();
$projectKeys = array_keys($projects);
+1
View File
@@ -107,6 +107,7 @@
<?php endforeach;?>
</tbody>
</table>
<div class='table-footer'><?php echo $pager->show('left', 'pagerjs');?></div>
</form>
<?php endif;?>
</div>
+1 -1
View File
@@ -61,7 +61,7 @@ class projectreleaseModel extends model
->beginIF($type == 'review')->andWhere("FIND_IN_SET('{$this->app->user->account}', t1.reviewers)")->fi()
->andWhere('t1.deleted')->eq(0)
->orderBy($orderBy)
->beginIF($pager)->page($pager)->fi()
->page($pager)
->fetchAll();
}