Add option to keep existing group when point is reduced #610

This commit is contained in:
Kijin Sung 2017-03-02 17:47:50 +09:00
parent 9791808b87
commit dafbfadc93
6 changed files with 45 additions and 14 deletions

View file

@ -25,8 +25,12 @@ $lang->cmd_point_recal = 'Reset Point';
$lang->about_cmd_point_recal = 'All point will be initialized only with articles/comments/attachments/join points. Only members who do website activities will get signup points after reset. Please use this function when complete initialization is required in case of data transferring or other situations.';
$lang->default_group = 'Default Group';
$lang->point_link_group = 'Group Change by Level';
$lang->point_group_reset_and_add = 'Reset adjusted groups and add new groups';
$lang->point_group_add_only = 'Only to new groups';
$lang->point_group_reset_type = 'Change Type';
$lang->point_group_reset_and_add = 'Remove from other groups and add new group';
$lang->point_group_add_only = 'Keep other groups and add new group';
$lang->point_group_ratchet = 'Change on Point Reduction';
$lang->point_group_ratchet_yes = 'Maintain current group if point is reduced';
$lang->point_group_ratchet_no = 'Move to lower group if point is reduced';
$lang->about_point_link_group = 'If you specify level for a specific group, users are assigned into the group when they advance to the level by getting points.';
$lang->about_module_point = 'You can set point for each module, and modules which don\'t have any value will use the default point. All points will be restored on acting reverse.';
$lang->point_signup = 'Sign up';

View file

@ -25,8 +25,12 @@ $lang->cmd_point_recal = '포인트 초기화';
$lang->about_cmd_point_recal = '게시글/댓글/첨부파일/회원가입 점수만 이용하여 모든 포인트 점수를 초기화합니다. 회원 가입 점수는 초기화 후 해당 회원이 활동을 하면 부여되고 그 전에는 부여되지 않습니다. 데이터 이전 등을 하여 포인트를 완전히 초기화해야 할 경우에만 사용하세요.';
$lang->default_group = '기본 그룹';
$lang->point_link_group = '그룹 연동';
$lang->point_group_reset_and_add = '설정된 그룹 초기화 후 새 그룹 부여';
$lang->point_group_add_only = '새 그룹만 부여';
$lang->point_group_reset_type = '그룹 연동 방식';
$lang->point_group_reset_and_add = '예전 그룹을 제거하고 새 그룹을 추가';
$lang->point_group_add_only = '예전 그룹을 유지하며 새 그룹을 추가';
$lang->point_group_ratchet = '포인트 감소 처리 방식';
$lang->point_group_ratchet_yes = '포인트가 감소하더라도 기존 그룹을 유지';
$lang->point_group_ratchet_no = '포인트가 감소하면 하위 그룹으로 이동';
$lang->about_point_link_group = '그룹에 원하는 레벨을 지정하면, 회원의 포인트가 해당 레벨의 포인트에 도달할 때 그룹이 변경됩니다.';
$lang->about_module_point = '모듈별 포인트를 지정할 수 있으며 지정되지 않은 모듈은 기본 포인트를 이용합니다. 모든 점수는 반대 행동을 하였을 경우 원상복구 됩니다.';
$lang->point_signup = '가입';

View file

@ -99,6 +99,7 @@ class pointAdminController extends point
}
$config->group_reset = $args->group_reset;
$config->group_ratchet = $args->group_ratchet;
// Per-level point configurations
unset($config->level_step);
for($i=1;$i<=$config->max_level;$i++)

View file

@ -129,6 +129,8 @@ class point extends ModuleObject
$config->level_icon = 'default';
$config->disable_read_document = 'N';
$config->disable_download = 'N';
$config->group_reset = 'Y';
$config->group_ratchet = 'N';
$config->max_level = 30;
for ($i = 1; $i <= 30; $i++)
{

View file

@ -585,7 +585,18 @@ class pointController extends point
$level = $oPointModel->getLevel($point, $config->level_step);
// If existing level and a new one are different attempt to set a point group
if($level != $current_level)
$new_group_list = array();
$del_group_list = array();
if ($config->group_ratchet === 'Y')
{
$change_group = ($level > $current_level);
}
else
{
$change_group = ($level != $current_level);
}
if ($change_group)
{
// Check if the level, for which the current points are prepared, is calculate and set the correct group
$point_group = $config->point_group;
@ -594,11 +605,8 @@ class pointController extends point
{
// Get the default group
$default_group = $oMemberModel->getDefaultGroup();
// Get the removed group and the newly granted group
$del_group_list = array();
$new_group_list = array();
asort($point_group);
// Reset group after initialization
if($config->group_reset != 'N')
{

View file

@ -105,11 +105,23 @@
<section class="section">
<h1>{$lang->point_link_group}</h1>
<div class="x_clearfix" style="margin-bottom:-10px">
<p class="x_pull-left">{$lang->about_point_link_group}</p>
<div class="x_pull-right">
<label for="group_reset_y" class="x_inline"><input type="radio" name="group_reset" id="group_reset_y" value="Y" checked="checked"|cond="$config->group_reset != 'N'" /> {$lang->point_group_reset_and_add}</label>
<label for="group_reset_n" class="x_inline"><input type="radio" name="group_reset" id="group_reset_n" value="N" checked="checked"|cond="$config->group_reset == 'N'" /> {$lang->point_group_add_only}</label>
<p>{$lang->about_point_link_group}</p>
<div class="x_control-group">
<label for="group_reset" class="x_control-label">{$lang->point_group_reset_type}</label>
<div class="x_controls">
<select name="group_reset" id="group_reset">
<option value="Y" selected="selected"|cond="$config->group_reset != 'N'" />{$lang->point_group_reset_and_add}</option>
<option value="N" selected="selected"|cond="$config->group_reset == 'N'" />{$lang->point_group_add_only}</option>
</select>
</div>
</div>
<div class="x_control-group">
<label for="group_ratchet" class="x_control-label">{$lang->point_group_ratchet}</label>
<div class="x_controls">
<select name="group_ratchet" id="group_ratchet">
<option value="Y" selected="selected"|cond="$config->group_ratchet == 'Y'" />{$lang->point_group_ratchet_yes}</option>
<option value="N" selected="selected"|cond="$config->group_ratchet != 'Y'" />{$lang->point_group_ratchet_no}</option>
</select>
</div>
</div>
<div class="x_control-group" loop="$group_list => $key,$val">