mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-03 16:51:40 +09:00
Improve point module
글 작성 후 x일 이후에는 댓글 작성 포인트를 부여하지 않는 기능을 확장하여 추천, 비추천, 글읽기 포인트에도 기간 제한을 둘 수 있도록 함.
This commit is contained in:
parent
5a158a6633
commit
f359a3448c
5 changed files with 127 additions and 72 deletions
|
|
@ -61,6 +61,10 @@ $lang->point_recal_message = 'Adjusting Point. (%d / %d)';
|
|||
$lang->point_recal_finished = 'Point recalculation is finished.';
|
||||
$lang->point_update_desc = 'Insert + in front of the number to increase the point or - to decrease, and update the point. If you don\'t insert + or -, the point will be set as the value you entered.';
|
||||
$lang->give_point = 'Give the point';
|
||||
$lang->point_given_prefix = 'give';
|
||||
$lang->point_given_suffix = 'points';
|
||||
$lang->point_time_limit_prefix = 'until';
|
||||
$lang->point_time_limit_suffix = 'days after submission';
|
||||
$lang->search_target_list['nick_name'] = 'Nick Name';
|
||||
$lang->search_target_list['user_name'] = 'User Name';
|
||||
$lang->search_target_list['regdate'] = 'Sign up Date';
|
||||
|
|
|
|||
|
|
@ -63,6 +63,10 @@ $lang->point_recal_message = '포인트 적용 중입니다. (%d / %d)';
|
|||
$lang->point_recal_finished = '포인트 재계산이 완료되었습니다.';
|
||||
$lang->point_update_desc = '포인트를 증가시키려면 +를 감소시키려면 -를 숫자앞에 표기한 후 업데이트해 주세요. + 또는 - 표시가 없으면 입력한 값으로 설정됩니다.';
|
||||
$lang->give_point = '포인트 부여';
|
||||
$lang->point_given_prefix = '';
|
||||
$lang->point_given_suffix = '포인트 부여';
|
||||
$lang->point_time_limit_prefix = '작성 후';
|
||||
$lang->point_time_limit_suffix = '일까지';
|
||||
$lang->search_target_list['nick_name'] = '닉네임';
|
||||
$lang->search_target_list['user_name'] = '이름';
|
||||
$lang->search_target_list['regdate'] = '가입일시';
|
||||
|
|
|
|||
|
|
@ -40,7 +40,11 @@ class pointAdminController extends point
|
|||
|
||||
// Check the point name
|
||||
$config->point_name = $args->point_name;
|
||||
if(!$config->point_name) $config->point_name = 'point';
|
||||
if(!$config->point_name)
|
||||
{
|
||||
$config->point_name = 'point';
|
||||
}
|
||||
|
||||
// Specify the default points
|
||||
$config->signup_point = (int)$args->signup_point;
|
||||
$config->login_point = (int)$args->login_point;
|
||||
|
|
@ -59,21 +63,35 @@ class pointAdminController extends point
|
|||
$config->blamer_comment = (int)$args->blamer_comment;
|
||||
$config->voted_comment = (int)$args->voted_comment;
|
||||
$config->blamed_comment = (int)$args->blamed_comment;
|
||||
|
||||
// Specify time limits
|
||||
$config->insert_comment_limit = $config->no_point_date = (int)$args->insert_comment_limit;
|
||||
$config->read_document_limit = (int)$args->read_document_limit;
|
||||
$config->voter_limit = (int)$args->voter_limit;
|
||||
$config->blamer_limit = (int)$args->blamer_limit;
|
||||
$config->voted_limit = (int)$args->voted_limit;
|
||||
$config->blamed_limit = (int)$args->blamed_limit;
|
||||
$config->read_document_author_limit = (int)$args->read_document_author_limit;
|
||||
$config->voter_comment_limit = (int)$args->voter_comment_limit;
|
||||
$config->blamer_comment_limit = (int)$args->blamer_comment_limit;
|
||||
$config->voted_comment_limit = (int)$args->voted_comment_limit;
|
||||
$config->blamed_comment_limit = (int)$args->blamed_comment_limit;
|
||||
|
||||
// The highest level
|
||||
$config->max_level = $args->max_level;
|
||||
if($config->max_level>1000) $config->max_level = 1000;
|
||||
if($config->max_level<1) $config->max_level = 1;
|
||||
|
||||
// Set the level icon
|
||||
$config->level_icon = $args->level_icon;
|
||||
|
||||
// Check if downloads are not allowed
|
||||
$config->disable_download = ($args->disable_download === 'Y') ? 'Y' : 'N';
|
||||
|
||||
// Check if reading a document is not allowed
|
||||
$config->disable_read_document = ($args->disable_read_document === 'Y') ? 'Y' : 'N';
|
||||
$config->disable_read_document_except_robots = ($args->disable_read_document_except_robots === 'Y') ? 'Y' : 'N';
|
||||
|
||||
//check is reading a document is not regdate setting
|
||||
$config->no_point_date = (int)$args->no_point_date;
|
||||
|
||||
$oMemberModel = getModel('member');
|
||||
$group_list = $oMemberModel->getGroups();
|
||||
$config->point_group = array();
|
||||
|
|
|
|||
|
|
@ -232,7 +232,8 @@ class pointController extends point
|
|||
|
||||
// Abort if the document is older than a configured limit.
|
||||
$config = $this->getConfig();
|
||||
if ($config->no_point_date > 0 && ztime($oDocument->get('regdate')) < time() - ($config->no_point_date * 86400))
|
||||
$time_limit = $config->insert_comment_limit ?: $config->no_point_date;
|
||||
if ($time_limit > 0 && ztime($oDocument->get('regdate')) < RX_TIME - ($time_limit * 86400))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
|
@ -284,7 +285,8 @@ class pointController extends point
|
|||
|
||||
// Abort if the document is older than a configured limit.
|
||||
$config = $this->getConfig();
|
||||
if ($config->no_point_date > 0 && ztime($oDocument->get('regdate')) < ztime($obj->regdate) - ($config->no_point_date * 86400))
|
||||
$time_limit = $config->insert_comment_limit ?: $config->no_point_date;
|
||||
if ($time_limit > 0 && ztime($oDocument->get('regdate')) < RX_TIME - ($time_limit * 86400))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
|
@ -439,6 +441,18 @@ class pointController extends point
|
|||
}
|
||||
}
|
||||
|
||||
// Give no points if the document is older than a configured limit.
|
||||
$regdate = ztime(getModel('document')->getDocument($obj->document_srl)->get('regdate'));
|
||||
$config = $this->getConfig();
|
||||
if ($config->read_document_limit > 0 && $regdate < RX_TIME - ($config->read_document_limit * 86400))
|
||||
{
|
||||
$reader_point = 0;
|
||||
}
|
||||
if ($config->read_document_author_limit > 0 && $regdate < RX_TIME - ($config->read_document_author_limit * 86400))
|
||||
{
|
||||
$author_point = 0;
|
||||
}
|
||||
|
||||
// Adjust points of the reader.
|
||||
if ($reader_point)
|
||||
{
|
||||
|
|
@ -446,7 +460,6 @@ class pointController extends point
|
|||
$cur_point = $logged_member_srl ? getModel('point')->getPoint($logged_member_srl) : 0;
|
||||
|
||||
// If the reader does not have enough points, deny access.
|
||||
$config = $this->getConfig();
|
||||
if ($cur_point + $reader_point < 0 && $config->disable_read_document == 'Y')
|
||||
{
|
||||
if (!$logged_member_srl && $config->disable_read_document_except_robots == 'Y' && isCrawler())
|
||||
|
|
@ -501,8 +514,25 @@ class pointController extends point
|
|||
// Document or comment?
|
||||
$is_comment = isset($obj->comment_srl) && $obj->comment_srl;
|
||||
|
||||
// Give no points if the document or comment is older than a configured limit.
|
||||
$config = $this->getConfig();
|
||||
if ($is_comment)
|
||||
{
|
||||
$regdate = ztime(getModel('comment')->getComment($obj->comment_srl)->get('regdate'));
|
||||
$logged_config_key = ($obj->point > 0) ? 'voter_comment_limit' : 'blamer_comment_limit';
|
||||
$target_config_key = ($obj->point > 0) ? 'voted_comment_limit' : 'blamed_comment_limit';
|
||||
}
|
||||
else
|
||||
{
|
||||
$regdate = ztime(getModel('document')->getDocument($obj->document_srl)->get('regdate'));
|
||||
$logged_config_key = ($obj->point > 0) ? 'voter_limit' : 'blamer_limit';
|
||||
$target_config_key = ($obj->point > 0) ? 'voted_limit' : 'blamed_limit';
|
||||
}
|
||||
$logged_enabled = !($config->$logged_config_key > 0 && $regdate < RX_TIME - ($config->$logged_config_key * 86400));
|
||||
$target_enabled = !($config->$target_config_key > 0 && $regdate < RX_TIME - ($config->$target_config_key * 86400));
|
||||
|
||||
// Adjust points of the voter.
|
||||
if ($logged_member_srl)
|
||||
if ($logged_member_srl && $logged_enabled)
|
||||
{
|
||||
$config_key = ($obj->point > 0) ? ($is_comment ? 'voter_comment' : 'voter') : ($is_comment ? 'blamer_comment' : 'blamer');
|
||||
$point = $this->_getModulePointConfig($obj->module_srl, $config_key);
|
||||
|
|
@ -518,7 +548,7 @@ class pointController extends point
|
|||
}
|
||||
|
||||
// Adjust points of the person who wrote the document or comment.
|
||||
if ($target_member_srl)
|
||||
if ($target_member_srl && $target_enabled)
|
||||
{
|
||||
$config_key = ($obj->point > 0) ? ($is_comment ? 'voted_comment' : 'voted') : ($is_comment ? 'blamed_comment' : 'blamed');
|
||||
$point = $this->_getModulePointConfig($obj->module_srl, $config_key);
|
||||
|
|
|
|||
|
|
@ -29,61 +29,6 @@
|
|||
{$lang->about_point_name}
|
||||
</div>
|
||||
</div>
|
||||
<div class="x_control-group">
|
||||
<label class="x_control-label">{$lang->give_point}</label>
|
||||
<div class="x_controls">
|
||||
<input type="number" value="{$config->signup_point}" name="signup_point" id="signup_point" style="text-align:right" /> :
|
||||
<label for="signup_point" class="x_inline">{$lang->point_signup}</label>
|
||||
<br />
|
||||
<input type="number" value="{$config->login_point}" name="login_point" id="login_point" style="text-align:right" /> :
|
||||
<label for="login_point" class="x_inline">{$lang->cmd_login}</label>
|
||||
<br />
|
||||
<input type="number" name="insert_document" value="{$config->insert_document}" id="insert_document" style="text-align:right" /> :
|
||||
<label for="insert_document" class="x_inline">{$lang->point_insert_document}</label>
|
||||
<br />
|
||||
<input type="number" name="insert_comment" value="{$config->insert_comment}" id="insert_comment" style="text-align:right" /> :
|
||||
<label for="insert_comment" class="x_inline">{$lang->point_insert_comment}</label>
|
||||
<br />
|
||||
<input type="number" name="upload_file" value="{$config->upload_file}" id="upload_file" style="text-align:right" /> :
|
||||
<label for="upload_file" class="x_inline">{$lang->point_upload_file}</label>
|
||||
<br />
|
||||
<input type="number" name="download_file" value="{$config->download_file}" id="download_file" style="text-align:right" /> :
|
||||
<label for="download_file" class="x_inline">{$lang->point_download_file}</label>
|
||||
<br />
|
||||
<input type="number" name="read_document" value="{$config->read_document}" id="read_document" style="text-align:right" /> :
|
||||
<label for="read_document" class="x_inline">{$lang->point_read_document}</label>
|
||||
<br />
|
||||
<input type="number" name="voter" value="{$config->voter}" style="text-align:right" id="voter" /> :
|
||||
<label for="voter" class="x_inline">{$lang->point_voter}</label>
|
||||
<br />
|
||||
<input type="number" name="blamer" value="{$config->blamer}" id="blamer" style="text-align:right" /> :
|
||||
<label for="blamer" class="x_inline">{$lang->point_blamer}</label>
|
||||
<br />
|
||||
<input type="number" name="voter_comment" value="{$config->voter_comment}" style="text-align:right" id="voter_comment" /> :
|
||||
<label for="voter_comment" class="x_inline">{$lang->point_voter_comment}</label>
|
||||
<br />
|
||||
<input type="number" name="blamer_comment" value="{$config->blamer_comment}" id="blamer_comment" style="text-align:right" /> :
|
||||
<label for="blamer_comment" class="x_inline">{$lang->point_blamer_comment}</label>
|
||||
<br />
|
||||
<input type="number" name="download_file_author" value="{$config->download_file_author}" id="download_file_author" style="text-align:right" /> :
|
||||
<label for="download_file_author" class="x_inline">{$lang->point_download_file_author}</label>
|
||||
<br />
|
||||
<input type="number" name="read_document_author" value="{$config->read_document_author}" id="read_document_author" style="text-align:right" /> :
|
||||
<label for="read_document_author" class="x_inline">{$lang->point_read_document_author}</label>
|
||||
<br />
|
||||
<input type="number" name="voted" value="{$config->voted}" style="text-align:right" id="voted" /> :
|
||||
<label for="voted" class="x_inline">{$lang->point_voted}</label>
|
||||
<br />
|
||||
<input type="number" name="blamed" value="{$config->blamed}" id="blamed" style="text-align:right" /> :
|
||||
<label for="blamed" class="x_inline">{$lang->point_blamed}</label>
|
||||
<br />
|
||||
<input type="number" name="voted_comment" value="{$config->voted_comment}" style="text-align:right" id="voted_comment" /> :
|
||||
<label for="voted_comment" class="x_inline">{$lang->point_voted_comment}</label>
|
||||
<br />
|
||||
<input type="number" name="blamed_comment" value="{$config->blamed_comment}" id="blamed_comment" style="text-align:right" /> :
|
||||
<label for="blamed_comment" class="x_inline">{$lang->point_blamed_comment}</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="x_control-group">
|
||||
<label for="level_icon" class="x_control-label">{$lang->level_icon}</label>
|
||||
<div class="x_controls">
|
||||
|
|
@ -111,14 +56,68 @@
|
|||
{$lang->disable_read_document_except_robots}
|
||||
</div>
|
||||
</div>
|
||||
<div class="x_control-group">
|
||||
<label for="no_point_date" class="x_control-label">{$lang->no_point_date}</label>
|
||||
<div class="x_controls" style="padding-top:3px">
|
||||
<input type="number" name="no_point_date" id="no_point_date" value="{$config->no_point_date}" style="width:50px;" />{$lang->day_ago}
|
||||
<p class="x_help-block">{$lang->about_no_point_date}</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="x_clearfix btnArea">
|
||||
|
||||
{@ $config_array = get_object_vars($config)}
|
||||
{@ $config_array['insert_comment_limit'] = $config_array['insert_comment_limit'] ?: $config_array['no_point_date']}
|
||||
{@ $action_types = array(
|
||||
'insert_document' => 0,
|
||||
'insert_comment' => 1,
|
||||
'upload_file' => 0,
|
||||
'download_file' => 0,
|
||||
'read_document' => 1,
|
||||
'voter' => 1,
|
||||
'blamer' => 1,
|
||||
'voter_comment' => 1,
|
||||
'blamer_comment' => 1,
|
||||
'download_file_author' => 0,
|
||||
'read_document_author' => 1,
|
||||
'voted' => 1,
|
||||
'blamed' => 1,
|
||||
'voted_comment' => 1,
|
||||
'blamed_comment' => 1,
|
||||
)}
|
||||
|
||||
<table class="x_table x_table-striped x_table-hover">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="nowr">{$lang->cmd_signup}</td>
|
||||
<td class="nowr">
|
||||
{$lang->point_given_prefix}
|
||||
<input type="number" value="{$config->signup_point ?: ''}" name="signup_point" id="signup_point" />
|
||||
{$lang->point_given_suffix}
|
||||
</td>
|
||||
<td class="nowr"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="nowr">{$lang->cmd_login}</td>
|
||||
<td class="nowr">
|
||||
{$lang->point_given_prefix}
|
||||
<input type="number" value="{$config->login_point ?: ''}" name="login_point" id="login_point" />
|
||||
{$lang->point_given_suffix}
|
||||
</td>
|
||||
<td class="nowr"></td>
|
||||
</tr>
|
||||
<!--@foreach($action_types as $action_type => $time_limit)-->
|
||||
<tr>
|
||||
<td class="nowr">{lang('point_' . $action_type)}</td>
|
||||
<td class="nowr">
|
||||
{$lang->point_given_prefix}
|
||||
<input type="number" value="{$config_array[$action_type] ?: ''}" name="{$action_type}" id="{$action_type}" />
|
||||
{$lang->point_given_suffix}
|
||||
</td>
|
||||
<td class="nowr">
|
||||
<block cond="$time_limit">
|
||||
{$lang->point_time_limit_prefix}
|
||||
<input type="number" value="{$config_array[$action_type . '_limit'] ?: ''}" name="{$action_type}_limit" id="{$action_type}_limit" />
|
||||
{$lang->point_time_limit_suffix}
|
||||
</block>
|
||||
</td>
|
||||
</tr>
|
||||
<!--@endforeach-->
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<div class="x_clearfix">
|
||||
<span class="x_pull-right"><input class="x_btn x_btn-primary" type="submit" value="{$lang->cmd_save}" /></span>
|
||||
</div>
|
||||
</section>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue