* Divide program/project/execution.
This commit is contained in:
@@ -110,13 +110,106 @@ class programModel extends model
|
||||
->andWhere('deleted')->eq(0)
|
||||
->beginIF(!$this->app->user->admin)
|
||||
->andWhere('id')->in($this->app->user->view->programs)
|
||||
->orWhere('id')->in($this->app->user->view->projects)
|
||||
->fi()
|
||||
->beginIF($status != 'all')->andWhere('status')->eq($status)->fi()
|
||||
->beginIF(!$this->cookie->showClosed)->andWhere('status')->ne('closed')->fi()
|
||||
->orWhere('id')->in($this->app->user->view->projects)
|
||||
->fi()
|
||||
->beginIF($status != 'all')->andWhere('status')->eq($status)->fi()
|
||||
->beginIF(!$this->cookie->showClosed)->andWhere('status')->ne('closed')->fi()
|
||||
->orderBy($orderBy)
|
||||
->page($pager)
|
||||
->fetchAll('id');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get project list data.
|
||||
*
|
||||
* @param int $programID
|
||||
* @param string $browseType
|
||||
* @param string $queryID
|
||||
* @param string $orderBy
|
||||
* @param object $pager
|
||||
* @param int $programTitle
|
||||
* @param int $PRJMine
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function getProjectList($programID = 0, $browseType = 'all', $queryID = 0, $orderBy = 'id_desc', $pager = null, $programTitle = 0, $PRJMine = 0)
|
||||
{
|
||||
$path = '';
|
||||
if($programID)
|
||||
{
|
||||
$program = $this->getByID($programID);
|
||||
$path = $program->path;
|
||||
}
|
||||
|
||||
$projectList = $this->dao->select('*')->from(TABLE_PROJECT)
|
||||
->where('deleted')->eq('0')
|
||||
->beginIF($this->config->systemMode == 'new')->andWhere('type')->eq('project')->fi()
|
||||
->beginIF($browseType != 'all')->andWhere('status')->eq($browseType)->fi()
|
||||
->beginIF($path)->andWhere('path')->like($path . '%')->fi()
|
||||
->beginIF(!$this->app->user->admin and $this->config->systemMode == 'new')->andWhere('id')->in($this->app->user->view->projects)->fi()
|
||||
->beginIF(!$this->app->user->admin and $this->config->systemMode == 'classic')->andWhere('id')->in($this->app->user->view->sprints)->fi()
|
||||
->beginIF($this->cookie->PRJMine or $PRJMine)
|
||||
->andWhere('openedBy', true)->eq($this->app->user->account)
|
||||
->orWhere('PM')->eq($this->app->user->account)
|
||||
->markRight(1)
|
||||
->fi()
|
||||
->orderBy($orderBy)
|
||||
->page($pager)
|
||||
->fetchAll('id');
|
||||
|
||||
/* Determine how to display the name of the program. */
|
||||
if($programTitle and $this->config->systemMode == 'new')
|
||||
{
|
||||
$programList = $this->getPairs();
|
||||
foreach($projectList as $id => $project)
|
||||
{
|
||||
$path = explode(',', $project->path);
|
||||
$path = array_filter($path);
|
||||
array_pop($path);
|
||||
$programID = $programTitle == 'base' ? current($path) : end($path);
|
||||
if(empty($path) || $programID == $id) continue;
|
||||
|
||||
$programName = isset($programList[$programID]) ? $programList[$programID] : '';
|
||||
|
||||
$projectList[$id]->name = $programName . '/' . $projectList[$id]->name;
|
||||
}
|
||||
}
|
||||
return $projectList;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get stakeholders by program id.
|
||||
*
|
||||
* @param int $programID
|
||||
* @param string $orderBy
|
||||
* @param object $paper
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getStakeholders($programID = 0, $orderBy, $pager = null)
|
||||
{
|
||||
return $this->dao->select('t2.account,t2.realname,t2.role,t2.qq,t2.mobile,t2.phone,t2.weixin,t2.email,t1.id,t1.type,t1.key')->from(TABLE_STAKEHOLDER)->alias('t1')
|
||||
->leftJoin(TABLE_USER)->alias('t2')->on('t1.user=t2.account')
|
||||
->where('t1.objectID')->eq($programID)
|
||||
->andWhere('t1.objectType')->eq('program')
|
||||
->orderBy($orderBy)
|
||||
->page($pager)
|
||||
->fetchAll('id');
|
||||
->fetchAll();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get stakeholders by program id list.
|
||||
*
|
||||
* @param string $programIdList
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getStakeholdersByPrograms($programIdList = 0)
|
||||
{
|
||||
return $this->dao->select('distinct user as account')->from(TABLE_STAKEHOLDER)
|
||||
->where('objectID')->in($programIdList)
|
||||
->andWhere('objectType')->eq('program')
|
||||
->fetchAll();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -713,7 +806,7 @@ class programModel extends model
|
||||
public function getProjectStats($programID = 0, $browseType = 'undone', $queryID = 0, $orderBy = 'id_desc', $pager = null, $programTitle = 0, $PRJMine = 0)
|
||||
{
|
||||
/* Init vars. */
|
||||
$projects = $this->getPRJList($programID, $browseType, $queryID, $orderBy, $pager, $programTitle, $PRJMine);
|
||||
$projects = $this->getProjectList($programID, $browseType, $queryID, $orderBy, $pager, $programTitle, $PRJMine);
|
||||
if(empty($projects)) return array();
|
||||
|
||||
$projectKeys = array_keys($projects);
|
||||
|
||||
Reference in New Issue
Block a user