* [bug#56248,done,1h,0h] Project dropdown compatible with old pages.

This commit is contained in:
hufangzhou
2024-10-18 09:38:06 +08:00
committed by 谢杞钰
parent 7789197d71
commit 3f21895933
4 changed files with 296 additions and 2 deletions
+42
View File
@@ -127,6 +127,48 @@ class project extends control
$this->display();
}
/**
* 旧页面:设置1.5级项目下拉菜单。
* Ajax get project drop menu.
*
* @param int $projectID
* @param string $module
* @param string $method
* @access public
* @return void
*/
public function ajaxGetOldDropMenu(int $projectID, string $module, string $method, string $extra = '')
{
/* Set cookie for show all project. */
$_COOKIE['showClosed'] = 1;
/* Query user's project and program. */
$projects = $this->project->getListByCurrentUser();
$involvedProjects = $this->project->getInvolvedListByCurrentUser();
$programs = $this->loadModel('program')->getPairs(true);
/* Generate project tree. */
$orderedProjects = array();
foreach($projects as $project)
{
$project->parent = $this->program->getTopByID($project->parent);
$project->parent = isset($programs[$project->parent]) ? $project->parent : $project->id;
$orderedProjects[$project->parent][] = $project;
}
$this->view->link = $this->project->getProjectLink($module, $method, $projectID, $extra); // Create the link from module,method.
$this->view->projectID = $projectID;
$this->view->module = $module;
$this->view->method = $method;
$this->view->programs = $programs;
$this->view->projects = $orderedProjects;
$this->view->involvedProjects = $involvedProjects;
$this->display();
}
/**
* 移除项目团队成员时进行提示。
* Ajax prompts when removing project team members.