lsf
|
/**
* Get project list. * * @param string $status * @access public * @return array */ public function getList($status = null, $pager = null) { $projects = $this->dao->select('*')->from(TABLE_PROJECT) ->where('deleted')->eq(0) ->beginIF($status and $status != 'involved')->andWhere('status')->eq($status)->fi() ->beginIF($status and $status == 'involved')->andWhere('status')->eq('doing')->fi() ->page($pager) ->fetchAll('id'); $members = $this->dao->select('*')->from(TABLE_TEAM)->where('type')->eq('project')->fetchGroup('id', 'account'); foreach($projects as $project) { $project->members = isset($members[$project->id]) ? $members[$project->id] : array(); foreach($project->members as $member) if($member->role == 'manager') $project->PM = $member->account; if($status == 'involved' and !isset($project->members[$this->app->user->account])) unset($projects[$project->id]); if(!$this->checkPriv($project->id)) unset($projects[$project->id]); } return $projects; } 这段代码有问题,主要出在 ->page($pager)上,当每页显示10行时,
$projects = $this->dao->select('*')->from(TABLE_PROJECT)
projects 只会返回10个记录,比如系统一共有36个项目,当前用户建立了其中的2个,当10个记录循环时,如果当前用户建立的2个记录不在这10个记录里,
if(!$this->checkPriv($project->id)) unset($projects[$project->id]); 这个就把
10个记录都unset了,当前用户 显示空白,实际上该用户是有记录的。
|
chujilu
|
我记录一下,谢谢反馈
。
|