* Adjusted programplan ajaxGetAttribute function.

This commit is contained in:
shenshulong
2023-05-06 07:51:16 +00:00
parent 645c4f40dd
commit 0cba2a33a0
2 changed files with 26 additions and 8 deletions
+8 -8
View File
@@ -326,26 +326,26 @@ class programplan extends control
}
/**
* AJAX: Get attributes.
* ajax请求:获取阶段ID的属性。
* AJAX: Get stageID attributes.
*
* @param int $stageID
* @param string $attribute
* @access public
* @return int
*/
public function ajaxGetAttribute($stageID, $attribute)
public function ajaxGetAttribute(int $stageID, string $attribute): int
{
$this->app->loadLang('stage');
$parentAttribute = $this->dao->select('attribute')->from(TABLE_EXECUTION)->where('id')->eq($stageID)->fetch('attribute');
if(empty($parentAttribute) or $parentAttribute == 'mix')
$stageAttribute = $this->programplan->getStageAttribute($stageID);
if(empty($stageAttribute) || $stageAttribute == 'mix')
{
return print(html::select('attribute', $this->lang->stage->typeList, $attribute, "class='form-control chosen'"));
}
else
{
return print(zget($this->lang->stage->typeList, $parentAttribute));
}
return print(zget($this->lang->stage->typeList, $stageAttribute));
}
/**
+18
View File
@@ -1724,4 +1724,22 @@ class programplanModel extends model
return true;
}
/**
* 获取阶段ID的属性。
* Get stageID attribute.
*
* @param int $stageID
* @access public
* @return false|string
*/
public function getStageAttribute(int $stageID): false|string
{
$stageAttribute = $this->dao->select('attribute')->from(TABLE_EXECUTION)->where('id')->eq($stageID)->fetch('attribute');
if(dao::isError()) return false;
return $stageAttribute;
}
}