diff --git a/api/v1/entries/productprojects.php b/api/v1/entries/productprojects.php
index b493ed3fcd..c6540ea7a4 100644
--- a/api/v1/entries/productprojects.php
+++ b/api/v1/entries/productprojects.php
@@ -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')
diff --git a/api/v1/entries/projectreleases.php b/api/v1/entries/projectreleases.php
index 21c9eb3b73..c3ca3a0f9a 100644
--- a/api/v1/entries/projectreleases.php
+++ b/api/v1/entries/projectreleases.php
@@ -23,8 +23,10 @@ class projectReleasesEntry extends entry
if(empty($projectID)) $projectID = $this->param('project');
if(empty($projectID)) return $this->sendError(400, 'Need project id.');
+ $page = intval($this->param('page', 1));
+ $limit = intval($this->param('limit', 20));
$control = $this->loadController('projectrelease', 'browse');
- $control->browse($projectID, $this->param('execution', 0), $this->param('status', 'all'), $this->param('order', 't1.date_desc'));
+ $control->browse($projectID, $this->param('execution', 0), $this->param('status', 'all'), $this->param('order', 't1.date_desc'), 0, $limit, $page);
/* Response */
$data = $this->getData();
diff --git a/module/product/control.php b/module/product/control.php
index 66833d346f..65847d39ff 100644
--- a/module/product/control.php
+++ b/module/product/control.php
@@ -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();
}
diff --git a/module/product/model.php b/module/product/model.php
index 1999ef3c02..4537e9b12d 100644
--- a/module/product/model.php
+++ b/module/product/model.php
@@ -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);
diff --git a/module/product/view/project.html.php b/module/product/view/project.html.php
index c20a70ebfb..7e6c9a6fe5 100644
--- a/module/product/view/project.html.php
+++ b/module/product/view/project.html.php
@@ -107,6 +107,7 @@
+
diff --git a/module/project/css/browse.css b/module/project/css/browse.css
index c565f44625..7f51feabce 100644
--- a/module/project/css/browse.css
+++ b/module/project/css/browse.css
@@ -18,7 +18,6 @@ th.c-name {min-width: 240px;}
th.c-name {width: auto;}
}
[lang^='en'] .project-name > .label-warning {width: 55px !important;}
-[lang^='en'] .c-status {width: 100px !important;}
.table-responsive {overflow: auto !important;}
.checkbox-primary {margin-right: 10px;}
diff --git a/module/projectrelease/control.php b/module/projectrelease/control.php
index 993f8fab5c..2429bb101a 100644
--- a/module/projectrelease/control.php
+++ b/module/projectrelease/control.php
@@ -61,10 +61,13 @@ class projectrelease extends control
* @param int $executionID
* @param string $type
* @param string $orderBy
+ * @param int $recTotal
+ * @param int $recPerPage
+ * @param int $pageID
* @access public
* @return void
*/
- public function browse($projectID = 0, $executionID = 0, $type = 'all', $orderBy = 't1.date_desc')
+ public function browse($projectID = 0, $executionID = 0, $type = 'all', $orderBy = 't1.date_desc', $recTotal = 0, $recPerPage = 15, $pageID = 1)
{
$this->session->set('releaseList', $this->app->getURI(true), 'project');
$project = $this->project->getById($projectID);
@@ -75,16 +78,24 @@ class projectrelease extends control
$objectName = isset($project->name) ? $project->name : $execution->name;
+ /* Load pager. */
+ $this->app->loadClass('pager', $static = true);
+ $pager = new pager($recTotal, $recPerPage, $pageID);
+
$this->view->title = $objectName . $this->lang->colon . $this->lang->release->browse;
$this->view->position[] = $this->lang->release->browse;
$this->view->execution = $execution;
$this->view->project = $project;
$this->view->products = $this->loadModel('product')->getProducts($projectID);
- $this->view->releases = $this->projectrelease->getList($projectID, $type, $orderBy);
+ $this->view->releases = $this->projectrelease->getList($projectID, $type, $orderBy, $pager);
$this->view->projectID = $projectID;
$this->view->executionID = $executionID;
$this->view->type = $type;
$this->view->from = $this->app->tab;
+ $this->view->recTotal = $recTotal;
+ $this->view->recPerPage = $recPerPage;
+ $this->view->pageID = $pageID;
+ $this->view->pager = $pager;
$this->display();
}
diff --git a/module/projectrelease/model.php b/module/projectrelease/model.php
index ba8ff55508..a976dbebc6 100644
--- a/module/projectrelease/model.php
+++ b/module/projectrelease/model.php
@@ -49,7 +49,7 @@ class projectreleaseModel extends model
* @access public
* @return array
*/
- public function getList($projectID, $type = 'all', $orderBy = 't1.date_desc')
+ public function getList($projectID, $type = 'all', $orderBy = 't1.date_desc', $pager = null)
{
return $this->dao->select('t1.*, t2.name as productName, t3.id as buildID, t3.name as buildName, t3.execution, t4.name as executionName')
->from(TABLE_RELEASE)->alias('t1')
@@ -61,6 +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)
+ ->page($pager)
->fetchAll();
}
diff --git a/module/projectrelease/view/browse.html.php b/module/projectrelease/view/browse.html.php
index f748053199..36de8640c2 100644
--- a/module/projectrelease/view/browse.html.php
+++ b/module/projectrelease/view/browse.html.php
@@ -82,6 +82,7 @@
+
diff --git a/module/testtask/view/browse.html.php b/module/testtask/view/browse.html.php
index 0a636ab293..3006fdf351 100644
--- a/module/testtask/view/browse.html.php
+++ b/module/testtask/view/browse.html.php
@@ -24,16 +24,6 @@ $status = $this->session->testTaskVersionStatus;