* code for task #44323.
This commit is contained in:
@@ -9,7 +9,7 @@
|
||||
* @version 1
|
||||
* @link http://www.zentao.net
|
||||
*/
|
||||
class projectreleasesEntry extends entry
|
||||
class projectReleasesEntry extends entry
|
||||
{
|
||||
/**
|
||||
* GET method.
|
||||
@@ -20,7 +20,26 @@ class projectreleasesEntry extends entry
|
||||
*/
|
||||
public function get($projectID = 0)
|
||||
{
|
||||
$this->fetch('releases', 'get', array('productID' => 0, 'projectID' => $projectID));
|
||||
if(empty($projectID)) $projectID = $this->param('project');
|
||||
if(empty($projectID)) return $this->sendError(400, 'Need project id.');
|
||||
|
||||
$control = $this->loadController('projectrelease', 'browse');
|
||||
$control->browse($projectID, $this->param('execution', 0), $this->param('status', 'all'), $this->param('order', 't1.date_desc'));
|
||||
|
||||
/* Response */
|
||||
$data = $this->getData();
|
||||
if(isset($data->status) and $data->status == 'success')
|
||||
{
|
||||
$result = array();
|
||||
$releases = $data->data->releases;
|
||||
foreach($releases as $release) $result[] = $this->format($release, 'deleted:bool,date:date');
|
||||
|
||||
return $this->send(200, array('total' => count($result), 'releases' => $result));
|
||||
}
|
||||
|
||||
if(isset($data->status) and $data->status == 'fail') return $this->sendError(400, $data->message);
|
||||
|
||||
return $this->sendError(400, 'error');
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -62,10 +62,11 @@ class projectrelease extends control
|
||||
* @param int $projectID
|
||||
* @param int $executionID
|
||||
* @param string $type
|
||||
* @param string $orderBy
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function browse($projectID = 0, $executionID = 0, $type = 'all')
|
||||
public function browse($projectID = 0, $executionID = 0, $type = 'all', $orderBy = 't1.date_desc')
|
||||
{
|
||||
$this->session->set('releaseList', $this->app->getURI(true), 'project');
|
||||
$project = $this->project->getById($projectID);
|
||||
@@ -81,7 +82,7 @@ class projectrelease extends control
|
||||
$this->view->execution = $execution;
|
||||
$this->view->project = $project;
|
||||
$this->view->products = $this->loadModel('product')->getProducts($projectID);
|
||||
$this->view->releases = $this->projectrelease->getList($projectID, $type);
|
||||
$this->view->releases = $this->projectrelease->getList($projectID, $type, $orderBy);
|
||||
$this->view->projectID = $projectID;
|
||||
$this->view->executionID = $executionID;
|
||||
$this->view->type = $type;
|
||||
|
||||
@@ -45,10 +45,11 @@ class projectreleaseModel extends model
|
||||
*
|
||||
* @param int $projectID
|
||||
* @param string $type
|
||||
* @param string $orderBy
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getList($projectID, $type = 'all')
|
||||
public function getList($projectID, $type = 'all', $orderBy = 't1.date_desc')
|
||||
{
|
||||
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')
|
||||
@@ -58,7 +59,7 @@ class projectreleaseModel extends model
|
||||
->where('t1.project')->eq((int)$projectID)
|
||||
->beginIF($type != 'all')->andWhere('t1.status')->eq($type)->fi()
|
||||
->andWhere('t1.deleted')->eq(0)
|
||||
->orderBy('t1.date DESC')
|
||||
->orderBy($orderBy)
|
||||
->fetchAll();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user