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

@ -19,10 +19,26 @@ class document extends ModuleObject
public $search_option = array('title', 'content', 'title_content', 'user_name');
/**
* Status list
* List of status texts supported by Rhymix.
*
* Also see status constants in common/constants.php
* and integer status codes used in the comment module.
*
* @var array
*/
public static $statusList = array('private' => 'PRIVATE', 'public' => 'PUBLIC', 'secret' => 'SECRET', 'temp' => 'TEMP');
public static $statusList = array(
'temp' => 'TEMP',
'private' => 'PRIVATE',
'public' => 'PUBLIC',
'secret' => 'SECRET',
'embargo' => 'EMBARGO',
'trash' => 'TRASH',
'censored' => 'CENSORED',
'censored_by_admin' => 'CENSORED_BY_ADMIN',
'deleted' => 'DELETED',
'deleted_by_admin' => 'DELETED_BY_ADMIN',
'other' => 'OTHER',
);
/**
* Implement if additional tasks are necessary when installing

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()];
}
}
/**

View file

@ -79,6 +79,13 @@ $lang->status_name_list['PRIVATE'] = 'Private';
$lang->status_name_list['PUBLIC'] = 'Public';
$lang->status_name_list['SECRET'] = 'Secret';
$lang->status_name_list['TEMP'] = 'Temporary';
$lang->status_name_list['TRASH'] = 'Trash';
$lang->status_name_list['EMBARGO'] = 'Embargo';
$lang->status_name_list['CENSORED'] = 'Hidden';
$lang->status_name_list['CENSORED_BY_ADMIN'] = 'Hidden by Admin';
$lang->status_name_list['DELETED'] = 'Deleted';
$lang->status_name_list['DELETED_BY_ADMIN'] = 'Deleted by Admin';
$lang->status_name_list['OTHER'] = 'Other';
$lang->document_manager = 'Manage selected articles';
$lang->selected_document = 'Selected articles';
$lang->selected_document_move = 'You can move or copy the selected articles to the following position.';

View file

@ -78,6 +78,13 @@ $lang->status_name_list['PRIVATE'] = '비공개';
$lang->status_name_list['PUBLIC'] = '공개';
$lang->status_name_list['SECRET'] = '비밀';
$lang->status_name_list['TEMP'] = '임시';
$lang->status_name_list['TRASH'] = '휴지통';
$lang->status_name_list['EMBARGO'] = '엠바고';
$lang->status_name_list['CENSORED'] = '블라인드';
$lang->status_name_list['CENSORED_BY_ADMIN'] = '관리자 블라인드';
$lang->status_name_list['DELETED'] = '삭제';
$lang->status_name_list['DELETED_BY_ADMIN'] = '관리자 삭제';
$lang->status_name_list['OTHER'] = '기타';
$lang->document_manager = '선택한 글 관리';
$lang->selected_document = '선택한 글';
$lang->selected_document_move = '선택한 글을 다음 위치로 옮기거나 복사할 수 있습니다.';

View file

@ -68,7 +68,7 @@ xe.lang.msg_empty_search_keyword = '{$lang->msg_empty_search_keyword}';
<span class="rx_simple_marks">{$oDocument->getRegdate($oDocument->getRegdateTime() > time() - 86400 ? 'H:i' : 'm-d')}</span>
</td>
<td class="nowr rx_detail_marks"><a href="{getUrl('search_target','ipaddress','search_keyword',$oDocument->get('ipaddress'))}">{$oDocument->get('ipaddress')}</a></td>
<td class="nowr rx_detail_marks">{$status_name_list[$oDocument->get('status')]}</td>
<td class="nowr rx_detail_marks">{$oDocument->getStatusText()}</td>
<td><input type="checkbox" name="cart" value="{$oDocument->document_srl}" /></td>
</tr>
</tbody>