* Adjusted programplan ajaxGetAttribute function.
This commit is contained in:
@@ -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));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user