Add getStatus() and getStatusText() methods to document and comment for easy management

This commit is contained in:
Kijin Sung 2021-04-20 22:38:42 +09:00
parent 4a34b3dfa8
commit 76f3376670
8 changed files with 105 additions and 6 deletions

View file

@ -1308,10 +1308,34 @@ class documentItem extends BaseObject
return $buffs;
}
/**
* Return the status code.
*
* @return string
*/
function getStatus()
{
if(!$this->get('status')) return getClass('document')->getDefaultStatus();
return $this->get('status');
$status = $this->get('status');
return $status ?: Document::getDefaultStatus();
}
/**
* Return the status in human-readable text.
*
* @return string
*/
function getStatusText()
{
$status = $this->get('status');
$statusList = lang('document.status_name_list');
if ($status && isset($statusList[$status]))
{
return $statusList[$status];
}
else
{
return $statusList[Document::getDefaultStatus()];
}
}
/**