* [task#141578,doing,0.5h] add build model list func.

This commit is contained in:
sunguangming
2025-04-16 10:18:25 +08:00
committed by 刘刚
parent 81ae731992
commit 39aeffa60d
+45 -13
View File
@@ -14,34 +14,66 @@ class deliverableModel extends model
return $deliverables;
}
/**
* 创建交付物。
* Create deliverable.
*
* @param object $deliverable
* @access public
* @return bool
*/
public function create($deliverable)
{
$this->dao->insert(TABLE_DELIVERABLE)->data($deliverable)->exec();
$deliverableID = $this->dao->lastInsertID();
$files = $this->loadModel('file')->saveUpload('deliverable', $deliverableID);
if(!empty($files))
{
$fileIdList = implode(',', array_keys($files));
$this->dao->update(TABLE_DELIVERABLE)->set('files')->eq($fileIdList)->where('id')->eq($deliverableID)->exec();
}
$this->loadModel('action')->create('deliverable', $deliverableID, 'opened');
return !dao::isError();
}
/**
* 构造交付物适用范围列表。
* Build deliverable model list.
*
* @param string $type all|project|execution
* @access public
* @return array
*/
public function buildModelList()
public function buildModelList($type = 'all')
{
$this->app->loadLang('stage');
$this->app->loadLang('execution');
$modelList = $this->lang->deliverable->modelList;
$stageList = $this->lang->stage->typeList;
$lifeTimeList = $this->lang->execution->lifeTimeList;
foreach($modelList as $key => $value)
$modelList = array();
if($type == 'all' || $type == 'project') $modelList = $this->lang->deliverable->modelList;
if($type == 'all' || $type == 'execution')
{
if(strpos($key, 'waterfall') !== false)
$stageList = $this->lang->stage->typeList;
$lifeTimeList = $this->lang->execution->lifeTimeList;
foreach($this->lang->deliverable->modelList as $key => $value)
{
foreach($stageList as $stageKey => $stageValue)
if(strpos($key, 'waterfall') !== false)
{
$modelList[$key . '_' . $stageKey] = $value . '/' . $stageValue . $this->lang->execution->typeList['stage'];
foreach($stageList as $stageKey => $stageValue)
{
$modelList[$key . '_' . $stageKey] = $value . '/' . $stageValue . $this->lang->execution->typeList['stage'];
}
}
}
elseif(strpos($key, 'scrum') !== false)
{
foreach($lifeTimeList as $lifeTimeKey => $lifeTimeValue)
elseif(strpos($key, 'scrum') !== false)
{
$modelList[$key . '_' . $lifeTimeKey] = $value . '/' . $lifeTimeValue . $this->lang->execution->typeList['sprint'];
foreach($lifeTimeList as $lifeTimeKey => $lifeTimeValue)
{
$modelList[$key . '_' . $lifeTimeKey] = $value . '/' . $lifeTimeValue . $this->lang->execution->typeList['sprint'];
}
}
}
}