diff --git a/module/personnel/control.php b/module/personnel/control.php index 217ac5006a..1977d4da88 100644 --- a/module/personnel/control.php +++ b/module/personnel/control.php @@ -18,7 +18,7 @@ class personnel extends control * @param int $deptID * @param string $browseType * @param int $param - * @param int $orderBy + * @param string $orderBy * @param int $recTotal * @param int $recPerPage * @param int $pageID @@ -61,8 +61,8 @@ class personnel extends control $this->view->orderBy = $orderBy; $this->view->browseType = $browseType; $this->view->personnelList = $personnelList; - $this->view->dept = $this->dept->getByID($deptID); $this->view->deptList = $deptList; + $this->view->dept = $this->dept->getByID($deptID); $this->view->deptTree = $this->personnel->getTreeMenu($deptID = 0, array('personnelModel', 'createMemberLink'), $programID); $this->display(); @@ -83,15 +83,13 @@ class personnel extends control $this->lang->program->switcherMenu = $this->program->getPGMCommonAction() . $this->program->getPGMSwitcher($programID); $this->program->setPGMViewMenu($programID); - $inputPersonnel = $this->personnel->getInputPersonnel($programID, $browseType, $orderBy); - $this->view->title = $this->lang->personnel->putInto; $this->view->position[] = $this->lang->personnel->putInto; $this->view->programID = $programID; $this->view->orderBy = $orderBy; $this->view->browseType = $browseType; - $this->view->inputPersonnel = $inputPersonnel; + $this->view->inputPersonnel = $this->personnel->getInputPersonnel($programID, $browseType, $orderBy); $this->display(); } diff --git a/module/personnel/model.php b/module/personnel/model.php index 00d8d76d1b..08f5ac265a 100644 --- a/module/personnel/model.php +++ b/module/personnel/model.php @@ -64,7 +64,7 @@ class personnelModel extends model $personnelList = array(); /* Get all projects under the current program. */ - $projects = $this->dao->select('id,model,type,template,parent,path,name')->from(TABLE_PROJECT) + $projects = $this->dao->select('id,model,type,parent,path,name')->from(TABLE_PROJECT) ->where('type')->eq('project') ->andWhere('path')->like("%,$programID,%") ->beginIF($browseType == 'scrum')->andWhere('model')->eq('scrum')->fi() @@ -77,11 +77,11 @@ class personnelModel extends model $personnelList['projects'] = $projects; if(empty($projects)) return $personnelList; - $teams = $this->getTeams($projects); - $personnelList['sprintAndStage'] = $teams['sprintAndStage']; - $personnelList['childrenStage'] = $teams['childrenStage']; - $personnelList['teams'] = $teams['teams']; - $personnelList['objectRows'] = $teams['objectRows']; + $sprintAndStage = $this->getSprintAndStage($projects); + $personnelList['sprintAndStage'] = $sprintAndStage['sprintAndStage']; + $personnelList['childrenStage'] = $sprintAndStage['childrenStage']; + $personnelList['teams'] = $sprintAndStage['teams']; + $personnelList['objectRows'] = $sprintAndStage['objectRows']; /* Get the program name for each level. */ $programNameList = $this->getProgramPairs(); @@ -109,7 +109,7 @@ class personnelModel extends model * @access public * @return array */ - public function getTeams($projects) + public function getSprintAndStage($projects) { /* Get all sprints and iterations under the project. */ $projectKeys = array_keys($projects); diff --git a/module/program/model.php b/module/program/model.php index 231cdecd18..ff143b066e 100644 --- a/module/program/model.php +++ b/module/program/model.php @@ -379,10 +379,7 @@ class programModel extends model if(!dao::isError()) { $this->file->updateObjectID($this->post->uid, $programID, 'project'); - if($program->acl != 'open' and ($program->acl != $oldProgram->acl or $program->whitelist != $oldProgram->whitelist)) - { - $this->loadModel('user')->updateUserView($programID, 'program'); - } + if($program->acl != 'open') $this->loadModel('user')->updateUserView($programID, 'program'); if($oldProgram->parent != $program->parent) $this->processNode($programID, $program->parent, $oldProgram->path, $oldProgram->grade); @@ -872,10 +869,10 @@ class programModel extends model ->page($pager) ->fetchAll('id'); - /* Determine whether the program name is displayed. */ + /* Determine how to display the name of the program. */ if($programTitle) { - $programList = array(); + $programList = $this->getPGMPairs(); foreach($projectList as $id => $project) { $path = explode(',', $project->path); @@ -884,10 +881,9 @@ class programModel extends model $programID = $programTitle == 'base' ? current($path) : end($path); if(empty($path) || $programID == $id) continue; - $program = isset($programList[$programID]) ? $programList[$programID] : $this->getPRJPairs($programID); - $programList[$programID] = $program; + $programName = isset($programList[$programID]) ? $programList[$programID] : ''; - $projectList[$id]->name = $program->name . '/' . $projectList[$id]->name; + $projectList[$id]->name = $programName . '/' . $projectList[$id]->name; } } return $projectList; @@ -1192,10 +1188,7 @@ class programModel extends model if(!dao::isError()) { $this->file->updateObjectID($this->post->uid, $projectID, 'project'); - if($project->acl != 'open' and ($project->acl != $oldProject->acl or $project->whitelist != $oldProject->whitelist)) - { - $this->loadModel('user')->updateUserView($projectID, 'project'); - } + if($project->acl != 'open') $this->loadModel('user')->updateUserView($projectID, 'project'); if($oldProject->parent != $project->parent) $this->processNode($projectID, $project->parent, $oldProject->path, $oldProject->grade); diff --git a/module/project/model.php b/module/project/model.php index 45fbebb6ba..61d0d05566 100644 --- a/module/project/model.php +++ b/module/project/model.php @@ -308,9 +308,9 @@ class projectModel extends model { $this->lang->project->team = $this->lang->project->teamname; $project = fixer::input('post') + ->setDefault('project', $this->session->PRJ) ->setDefault('status', 'wait') ->setDefault('type', 'sprint') - ->setDefault('project', $this->session->PRJ) ->setDefault('parent', $this->session->PRJ) ->setIF($this->post->acl != 'custom', 'whitelist', '') ->setDefault('openedBy', $this->app->user->account)