mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-04-22 03:42:18 +09:00
#944 포인트 모듈 비활성화 방법 추가
포인트 모듈을 켜고 끌 수 있게 하여서 트리거를 거치지 않을 수 있도록 하는 방법 추가. https://github.com/xpressengine/xe-core/issues/944
This commit is contained in:
parent
c5893358d5
commit
b1dadd21c4
6 changed files with 188 additions and 78 deletions
|
|
@ -24,75 +24,98 @@ class pointAdminController extends point
|
|||
$config = $oModuleModel->getModuleConfig('point');
|
||||
// Arrange variables
|
||||
$args = Context::getRequestVars();
|
||||
// Check the point name
|
||||
$config->point_name = $args->point_name;
|
||||
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;
|
||||
$config->insert_document = (int)$args->insert_document;
|
||||
$config->read_document = (int)$args->read_document;
|
||||
$config->insert_comment = (int)$args->insert_comment;
|
||||
$config->upload_file = (int)$args->upload_file;
|
||||
$config->download_file = (int)$args->download_file;
|
||||
$config->voted = (int)$args->voted;
|
||||
$config->blamed = (int)$args->blamed;
|
||||
// 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
|
||||
if($args->disable_download == 'Y') $config->disable_download = 'Y';
|
||||
else $config->disable_download = 'N';
|
||||
// Check if reading a document is not allowed
|
||||
if($args->disable_read_document == 'Y') $config->disable_read_document = 'Y';
|
||||
else $config->disable_read_document = 'N';
|
||||
|
||||
$oMemberModel = getModel('member');
|
||||
$group_list = $oMemberModel->getGroups();
|
||||
|
||||
// Per-level group configurations
|
||||
foreach($group_list as $group)
|
||||
//if module IO config is off
|
||||
if($args->able_module == 'Y')
|
||||
{
|
||||
// Admin group should not be connected to point.
|
||||
if($group->is_admin == 'Y' || $group->is_default == 'Y') continue;
|
||||
|
||||
$group_srl = $group->group_srl;
|
||||
|
||||
//if group level is higher than max level, change to max level
|
||||
if($args->{'point_group_'.$group_srl} > $args->max_level)
|
||||
// Re-install triggers, if it was disabled.
|
||||
if($config->able_module == 'N')
|
||||
{
|
||||
$args->{'point_group_'.$group_srl} = $args->max_level;
|
||||
$this->moduleUpdate();
|
||||
}
|
||||
|
||||
//if group level is lower than 1, change to 1
|
||||
if($args->{'point_group_'.$group_srl} < 1)
|
||||
//module IO config is on
|
||||
$config->able_module = 'Y';
|
||||
|
||||
// Check the point name
|
||||
$config->point_name = $args->point_name;
|
||||
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;
|
||||
$config->insert_document = (int)$args->insert_document;
|
||||
$config->read_document = (int)$args->read_document;
|
||||
$config->insert_comment = (int)$args->insert_comment;
|
||||
$config->upload_file = (int)$args->upload_file;
|
||||
$config->download_file = (int)$args->download_file;
|
||||
$config->voted = (int)$args->voted;
|
||||
$config->blamed = (int)$args->blamed;
|
||||
// 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
|
||||
if($args->disable_download == 'Y') $config->disable_download = 'Y';
|
||||
else $config->disable_download = 'N';
|
||||
// Check if reading a document is not allowed
|
||||
if($args->disable_read_document == 'Y') $config->disable_read_document = 'Y';
|
||||
else $config->disable_read_document = 'N';
|
||||
|
||||
$oMemberModel = getModel('member');
|
||||
$group_list = $oMemberModel->getGroups();
|
||||
|
||||
// Per-level group configurations
|
||||
foreach($group_list as $group)
|
||||
{
|
||||
$args->{'point_group_'.$group_srl} = 1;
|
||||
// Admin group should not be connected to point.
|
||||
if($group->is_admin == 'Y' || $group->is_default == 'Y') continue;
|
||||
|
||||
$group_srl = $group->group_srl;
|
||||
|
||||
//if group level is higher than max level, change to max level
|
||||
if($args->{'point_group_'.$group_srl} > $args->max_level)
|
||||
{
|
||||
$args->{'point_group_'.$group_srl} = $args->max_level;
|
||||
}
|
||||
|
||||
//if group level is lower than 1, change to 1
|
||||
if($args->{'point_group_'.$group_srl} < 1)
|
||||
{
|
||||
$args->{'point_group_'.$group_srl} = 1;
|
||||
}
|
||||
|
||||
if($args->{'point_group_'.$group_srl})
|
||||
{
|
||||
$config->point_group[$group_srl] = $args->{'point_group_'.$group_srl};
|
||||
}
|
||||
else
|
||||
{
|
||||
unset($config->point_group[$group_srl]);
|
||||
}
|
||||
}
|
||||
|
||||
if($args->{'point_group_'.$group_srl})
|
||||
$config->group_reset = $args->group_reset;
|
||||
// Per-level point configurations
|
||||
unset($config->level_step);
|
||||
for($i=1;$i<=$config->max_level;$i++)
|
||||
{
|
||||
$config->point_group[$group_srl] = $args->{'point_group_'.$group_srl};
|
||||
}
|
||||
else
|
||||
{
|
||||
unset($config->point_group[$group_srl]);
|
||||
$key = "level_step_".$i;
|
||||
$config->level_step[$i] = (int)$args->{$key};
|
||||
}
|
||||
// A function to calculate per-level points
|
||||
$config->expression = $args->expression;
|
||||
}
|
||||
|
||||
$config->group_reset = $args->group_reset;
|
||||
// Per-level point configurations
|
||||
unset($config->level_step);
|
||||
for($i=1;$i<=$config->max_level;$i++)
|
||||
else
|
||||
{
|
||||
$key = "level_step_".$i;
|
||||
$config->level_step[$i] = (int)$args->{$key};
|
||||
//module IO config is OFF, Other settings will not be modified.
|
||||
$config->able_module = 'N';
|
||||
|
||||
// Delete Triggers
|
||||
$oModuleController = getController('module');
|
||||
$oModuleController->deleteModuleTriggers('point');
|
||||
}
|
||||
// A function to calculate per-level points
|
||||
$config->expression = $args->expression;
|
||||
// Save
|
||||
$oModuleController = getController('module');
|
||||
$oModuleController->insertModuleConfig('point', $config);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue