mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-04 17:21:39 +09:00
Add getStatus() and getStatusText() methods to document and comment for easy management
This commit is contained in:
parent
4a34b3dfa8
commit
76f3376670
8 changed files with 105 additions and 6 deletions
|
|
@ -144,6 +144,7 @@ define('_XE_PATH_', RX_BASEDIR);
|
|||
* Status constants for various content types.
|
||||
*/
|
||||
define('RX_STATUS_TEMP', 0);
|
||||
define('RX_STATUS_PRIVATE', 10);
|
||||
define('RX_STATUS_PUBLIC', 1);
|
||||
define('RX_STATUS_SECRET', 2);
|
||||
define('RX_STATUS_EMBARGO', 3);
|
||||
|
|
|
|||
|
|
@ -146,6 +146,48 @@ class commentItem extends BaseObject
|
|||
$this->setGrant();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the status code.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getStatus()
|
||||
{
|
||||
switch ($this->get('status'))
|
||||
{
|
||||
case RX_STATUS_TEMP: return 'TEMP';
|
||||
case RX_STATUS_PUBLIC: return $this->get('is_secret') !== 'Y' ? 'PUBLIC' : 'SECRET';
|
||||
case RX_STATUS_SECRET: return 'SECRET';
|
||||
case RX_STATUS_EMBARGO: return 'EMBARGO';
|
||||
case RX_STATUS_TRASH: return 'TRASH';
|
||||
case RX_STATUS_CENSORED: return 'CENSORED';
|
||||
case RX_STATUS_CENSORED_BY_ADMIN: return 'CENSORED_BY_ADMIN';
|
||||
case RX_STATUS_DELETED: return 'DELETED';
|
||||
case RX_STATUS_DELETED_BY_ADMIN: return 'DELETED_BY_ADMIN';
|
||||
case RX_STATUS_OTHER: return 'OTHER';
|
||||
default: return 'OTHER';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the status in human-readable text.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getStatusText()
|
||||
{
|
||||
$status = $this->getStatus();
|
||||
$statusList = lang('document.status_name_list');
|
||||
if ($status && isset($statusList[$status]))
|
||||
{
|
||||
return $statusList[$status];
|
||||
}
|
||||
else
|
||||
{
|
||||
return $statusList['OTHER'];
|
||||
}
|
||||
}
|
||||
|
||||
function isAccessible()
|
||||
{
|
||||
if(!$this->isExists())
|
||||
|
|
@ -195,7 +237,7 @@ class commentItem extends BaseObject
|
|||
|
||||
function isSecret()
|
||||
{
|
||||
return $this->get('is_secret') == 'Y';
|
||||
return $this->get('status') == RX_STATUS_SECRET || $this->get('is_secret') == 'Y';
|
||||
}
|
||||
|
||||
function isDeleted()
|
||||
|
|
|
|||
|
|
@ -63,6 +63,8 @@ $lang->improper_comment_reasons['pornography'] = 'Pornography.';
|
|||
$lang->improper_comment_reasons['privacy'] = 'Privacy issue.';
|
||||
$lang->improper_comment_reasons['others'] = 'Others (Write your own)';
|
||||
$lang->about_improper_comment_declare = 'Write here why you report this comment as an improper thing.';
|
||||
$lang->msg_censored_comment = 'This comment has been hidden.';
|
||||
$lang->msg_admin_censored_comment = 'This comment has been hidden by an administrator.';
|
||||
$lang->msg_deleted_comment = 'This comment has been deleted.';
|
||||
$lang->msg_admin_deleted_comment = 'This comment has been deleted by an administrator.';
|
||||
$lang->msg_no_text_comment = 'This comment contains no text.';
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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()];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -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.';
|
||||
|
|
|
|||
|
|
@ -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 = '선택한 글을 다음 위치로 옮기거나 복사할 수 있습니다.';
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue