Merge branch 'master_xieqiyu_23185' into 'master'
* Fix bug#23185. See merge request easycorp/zentaopms!3707
This commit is contained in:
@@ -52,9 +52,9 @@ class program extends control
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Get pager for top program and projects whithout program. */
|
||||
$this->program->getList($status, $orderBy, $pager, 'top');
|
||||
$programs = $this->program->getList($status, $orderBy);
|
||||
/* Get top programs and projects. */
|
||||
$topObjects = $this->program->getList($status, $orderBy, $pager, 'top');
|
||||
$programs = $this->program->getList($status, $orderBy, NULL, 'child', array_keys($topObjects));
|
||||
|
||||
/* Get summary. */
|
||||
$topCount = $indCount = 0;
|
||||
|
||||
@@ -131,12 +131,12 @@ class programModel extends model
|
||||
* @param string $orderBy
|
||||
* @param object $pager
|
||||
* @param string $type top|child
|
||||
* @param array $topIdList
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getList($status = 'all', $orderBy = 'id_asc', $pager = NULL, $type = '')
|
||||
public function getList($status = 'all', $orderBy = 'id_asc', $pager = NULL, $type = '', $topIdList = '')
|
||||
{
|
||||
$objectIdList = array();
|
||||
if(!$this->app->user->admin)
|
||||
{
|
||||
$objectIdList = trim($this->app->user->view->programs, ',') . ',' . trim($this->app->user->view->projects, ',');
|
||||
@@ -145,9 +145,20 @@ class programModel extends model
|
||||
|
||||
if($this->app->rawMethod == 'browse')
|
||||
{
|
||||
$pathList = $this->dao->select('id,path')->from(TABLE_PROJECT)->where('id')->in($objectIdList)->andWhere('deleted')->eq(0)->fetchPairs('id');
|
||||
$pathList = $this->dao->select('id,path')->from(TABLE_PROJECT)
|
||||
->where('id')->in($objectIdList)
|
||||
->andWhere('deleted')->eq(0)
|
||||
->fetchPairs('id');
|
||||
|
||||
$objectIdList = array();
|
||||
foreach($pathList as $path)
|
||||
{
|
||||
if($type == 'child' and !empty($topIdList))
|
||||
{
|
||||
$topID = $this->getTopByPath($path);
|
||||
if(!in_array($topID, $topIdList)) continue;
|
||||
}
|
||||
|
||||
foreach(explode(',', trim($path, ',')) as $pathID) $objectIdList[$pathID] = $pathID;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user