* Fix bug #48464, set icon by project model.

This commit is contained in:
liumengyi
2024-04-25 16:48:22 +08:00
parent c5738c4129
commit 66bcb21455
3 changed files with 13 additions and 8 deletions
+3 -2
View File
@@ -925,10 +925,11 @@ class projectModel extends model
* @param string $model all|scrum|waterfall|kanban
* @param string $param noclosed
* @param int $projectID
* @param bool $pairs
* @access public
* @return array array(projectID => projectName, ...)
*/
public function getPairsByModel(string $model = 'all', string $param = '', int $projectID = 0): array
public function getPairsByModel(string $model = 'all', string $param = '', int $projectID = 0, bool $pairs = true): array
{
if(commonModel::isTutorialMode()) return $this->loadModel('tutorial')->getProjectPairs();
@@ -972,7 +973,7 @@ class projectModel extends model
$projectPairs = array();
foreach($allProjects as $programID => $projects)
{
foreach($projects as $project) $projectPairs[$project->id] = $project->name;
foreach($projects as $project) $projectPairs[$project->id] = $pairs ? $project->name : $project;
}
return $projectPairs;
}
+4 -4
View File
@@ -122,17 +122,17 @@ JS
$copyProjectsBox = array();
if(!empty($copyProjects))
{
foreach($copyProjects as $id => $name)
foreach($copyProjects as $id => $project)
{
$copyProjectsBox[] = btn
(
setClass('project-block justify-start'),
setClass($copyProjectID == $id ? 'primary-outline' : ''),
set('data-id', $id),
set('data-pinyin', zget($copyPinyinList, $name, '')),
icon(setClass('text-gray'), !empty($model) ? ($model == 'scrum' ? 'sprint' : $model) : $lang->icons['project']),
set('data-pinyin', zget($copyPinyinList, $project->name, '')),
icon(setClass('text-gray'), !empty($project->model) ? ($project->model == 'scrum' ? 'sprint' : $project->model) : $lang->icons['project']),
on::click($toggleActiveProject),
span($name, set::title($name), setClass('text-left'))
span($project->name, set::title($project->name), setClass('text-left'))
);
}
}
+6 -2
View File
@@ -316,6 +316,10 @@ class projectZen extends project
}
}
/* Get copy projects. */
$copyProjects = $this->project->getPairsByModel($model, '', 0, false);
$copyProjectPairs = array_combine(array_keys($copyProjects), array_column($copyProjects, 'name'));
$this->view->title = $this->lang->project->create;
$this->view->gobackLink = (isset($output['from']) && $output['from'] == 'global') ? $this->createLink('project', 'browse') : '';
$this->view->model = $model;
@@ -326,8 +330,8 @@ class projectZen extends project
$this->view->branchID = isset($output['branchID']) ? $output['branchID'] : 0;
$this->view->allProducts = $allProducts;
$this->view->multiBranchProducts = $this->product->getMultiBranchPairs((int)$topProgramID);
$this->view->copyProjects = $this->project->getPairsByModel($model);
$this->view->copyPinyinList = common::convert2Pinyin($this->view->copyProjects);
$this->view->copyProjects = $copyProjects;
$this->view->copyPinyinList = common::convert2Pinyin($copyProjectPairs);
$this->view->copyProjectID = $copyProjectID;
$this->view->parentProgram = $parentProgram;
$this->view->programList = $this->program->getParentPairs();