불필요한 조건문 삭제

This commit is contained in:
BJRambo 2021-02-03 12:58:27 +09:00
parent c6614a9d02
commit 041860f9ee
5 changed files with 56 additions and 65 deletions

View file

@ -19,7 +19,6 @@
<p>{$lang->ncenterlite_userconfig_about} <strong style="color:#ff0000" cond="$member_srl && $member_srl != $logged_info->member_srl">({$lang->ncenterlite_userconfig_about_warning})</strong></p>
{@ $uc = get_object_vars($user_config)}
<!--@foreach($notify_types as $notify_type => $notify_srl)-->
<!--@if($notify_type !== 'admin_content' && $notify_type !== 'custom')-->
<div class="control-group">
<label class="x_control-label">{$lang->get('ncenterlite_type_' . $notify_type)}</label>
<div class="x_controls">
@ -42,7 +41,6 @@
<p class="help-block">{sprintf($lang->get('ncenterlite_' . $notify_type . '_noti_about'), $logged_info->nick_name)}</p>
</div>
</div>
<!--@endif-->
<!--@endforeach-->
</section>
<div class="clearfix btnArea">

View file

@ -75,7 +75,7 @@ class ncenterliteController extends ncenterlite
}
$vars = Context::getRequestVars();
$notify_types = NcenterliteModel::getNotifyTypes();
$notify_types = NcenterliteModel::getUserSetNotifyTypes();
$is_old_skin = false;
foreach ($notify_types as $type => $srl)
{
@ -90,31 +90,28 @@ class ncenterliteController extends ncenterlite
$args->member_srl = $member_srl;
foreach ($notify_types as $type => $srl)
{
if ($type !== 'admin_content' && $type !== 'custom')
$disabled_list = array();
if ($is_old_skin)
{
$disabled_list = array();
if ($is_old_skin)
if (isset($vars->{$type . '_notify'}) && $vars->{$type . '_notify'} === 'N')
{
if (isset($vars->{$type . '_notify'}) && $vars->{$type . '_notify'} === 'N')
{
$disabled_list = ['!web', '!mail', '!sms', '!push'];
}
$disabled_list = ['!web', '!mail', '!sms', '!push'];
}
else
}
else
{
foreach (['web', 'mail', 'sms', 'push'] as $method)
{
foreach (['web', 'mail', 'sms', 'push'] as $method)
if (isset($config->use[$type][$method]) && $config->use[$type][$method])
{
if (isset($config->use[$type][$method]) && $config->use[$type][$method])
if (!isset($vars->use[$type][$method]) || !$vars->use[$type][$method])
{
if (!isset($vars->use[$type][$method]) || !$vars->use[$type][$method])
{
$disabled_list[] = '!' . $method;
}
$disabled_list[] = '!' . $method;
}
}
}
$args->{$type . '_notify'} = implode(',', $disabled_list);
}
$args->{$type . '_notify'} = implode(',', $disabled_list);
}
$user_config = NcenterliteModel::getUserConfig($member_srl);

View file

@ -69,7 +69,7 @@ class ncenterliteView extends ncenterlite
}
$user_config = NcenterliteModel::getUserConfig($member_srl) ?: new stdClass;
$notify_types = NcenterliteModel::getNotifyTypes();
$notify_types = NcenterliteModel::getUserSetNotifyTypes();
foreach ($notify_types as $type => $srl)
{
$user_config->{$type . '_notify'} = $user_config->{$type} ? 'Y' : 'N';

View file

@ -21,30 +21,28 @@
<p>{$lang->ncenterlite_userconfig_about} <strong style="color:#ff0000" cond="$member_srl && $member_srl != $logged_info->member_srl">({$lang->ncenterlite_userconfig_about_warning})</strong></p>
{@ $uc = get_object_vars($user_config)}
<!--@foreach($notify_types as $notify_type => $notify_srl)-->
<!--@if($notify_type !== 'admin_content' && $notify_type !== 'custom')-->
<div class="control-group">
<label class="x_control-label">{$lang->get('ncenterlite_type_' . $notify_type)}</label>
<div class="x_controls">
{@ $available = isset($module_config->use[$notify_type]['web']) && $module_config->use[$notify_type]['web'] !== 'N'}
{@ $selected = (is_array($uc[$notify_type]) && in_array('web', $uc[$notify_type]))}
<label class="x_inline"><input type="checkbox" name="use[{$notify_type}][web]" value="1" disabled="disabled"|cond="!$available" checked="checked"|cond="$available && $selected" /> {$lang->cmd_web_notify}</label>
{@ $available = isset($module_config->use[$notify_type]['mail']) && $module_config->use[$notify_type]['mail'] !== 'N'}
{@ $selected = (is_array($uc[$notify_type]) && in_array('mail', $uc[$notify_type]))}
<label class="x_inline"><input type="checkbox" name="use[{$notify_type}][mail]" value="1" disabled="disabled"|cond="!$available" checked="checked"|cond="$available && $selected" /> {$lang->cmd_mail_notify}</label>
<!--@if($sms_available)-->
{@ $available = isset($module_config->use[$notify_type]['sms']) && $module_config->use[$notify_type]['sms'] !== 'N'}
{@ $selected = (is_array($uc[$notify_type]) && in_array('sms', $uc[$notify_type]))}
<label class="x_inline"><input type="checkbox" name="use[{$notify_type}][sms]" value="1" disabled="disabled"|cond="!$available" checked="checked"|cond="$available && $selected" /> {$lang->cmd_sms_notify}</label>
<!--@endif-->
<!--@if($push_available)-->
{@ $available = isset($module_config->use[$notify_type]['push']) && $module_config->use[$notify_type]['push'] !== 'N'}
{@ $selected = (is_array($uc[$notify_type]) && in_array('push', $uc[$notify_type]))}
<label class="x_inline"><input type="checkbox" name="use[{$notify_type}][push]" value="1" disabled="disabled"|cond="!$available" checked="checked"|cond="$available && $selected" /> {$lang->cmd_push_notify}</label>
<!--@endif-->
<p class="help-block">{sprintf($lang->get('ncenterlite_' . $notify_type . '_noti_about'), $logged_info->nick_name)}</p>
</div>
<div class="control-group">
<label class="x_control-label">{$lang->get('ncenterlite_type_' . $notify_type)}</label>
<div class="x_controls">
{@ $available = isset($module_config->use[$notify_type]['web']) && $module_config->use[$notify_type]['web'] !== 'N'}
{@ $selected = (is_array($uc[$notify_type]) && in_array('web', $uc[$notify_type]))}
<label class="x_inline"><input type="checkbox" name="use[{$notify_type}][web]" value="1" disabled="disabled"|cond="!$available" checked="checked"|cond="$available && $selected" /> {$lang->cmd_web_notify}</label>
{@ $available = isset($module_config->use[$notify_type]['mail']) && $module_config->use[$notify_type]['mail'] !== 'N'}
{@ $selected = (is_array($uc[$notify_type]) && in_array('mail', $uc[$notify_type]))}
<label class="x_inline"><input type="checkbox" name="use[{$notify_type}][mail]" value="1" disabled="disabled"|cond="!$available" checked="checked"|cond="$available && $selected" /> {$lang->cmd_mail_notify}</label>
<!--@if($sms_available)-->
{@ $available = isset($module_config->use[$notify_type]['sms']) && $module_config->use[$notify_type]['sms'] !== 'N'}
{@ $selected = (is_array($uc[$notify_type]) && in_array('sms', $uc[$notify_type]))}
<label class="x_inline"><input type="checkbox" name="use[{$notify_type}][sms]" value="1" disabled="disabled"|cond="!$available" checked="checked"|cond="$available && $selected" /> {$lang->cmd_sms_notify}</label>
<!--@endif-->
<!--@if($push_available)-->
{@ $available = isset($module_config->use[$notify_type]['push']) && $module_config->use[$notify_type]['push'] !== 'N'}
{@ $selected = (is_array($uc[$notify_type]) && in_array('push', $uc[$notify_type]))}
<label class="x_inline"><input type="checkbox" name="use[{$notify_type}][push]" value="1" disabled="disabled"|cond="!$available" checked="checked"|cond="$available && $selected" /> {$lang->cmd_push_notify}</label>
<!--@endif-->
<p class="help-block">{sprintf($lang->get('ncenterlite_' . $notify_type . '_noti_about'), $logged_info->nick_name)}</p>
</div>
<!--@endif-->
</div>
<!--@endforeach-->
</section>
<div class="clearfix btnArea">

View file

@ -21,30 +21,28 @@
<p>{$lang->ncenterlite_userconfig_about} <strong style="color:#ff0000" cond="$member_srl && $member_srl != $logged_info->member_srl">({$lang->ncenterlite_userconfig_about_warning})</strong></p>
{@ $uc = get_object_vars($user_config)}
<!--@foreach($notify_types as $notify_type => $notify_srl)-->
<!--@if($notify_type !== 'admin_content' && $notify_type !== 'custom')-->
<div class="control-group">
<label class="x_control-label">{$lang->get('ncenterlite_type_' . $notify_type)}</label>
<div class="x_controls">
{@ $available = isset($module_config->use[$notify_type]['web']) && $module_config->use[$notify_type]['web'] !== 'N'}
{@ $selected = (is_array($uc[$notify_type]) && in_array('web', $uc[$notify_type]))}
<label class="x_inline"><input type="checkbox" name="use[{$notify_type}][web]" value="1" disabled="disabled"|cond="!$available" checked="checked"|cond="$available && $selected" /> {$lang->cmd_web_notify}</label>
{@ $available = isset($module_config->use[$notify_type]['mail']) && $module_config->use[$notify_type]['mail'] !== 'N'}
{@ $selected = (is_array($uc[$notify_type]) && in_array('mail', $uc[$notify_type]))}
<label class="x_inline"><input type="checkbox" name="use[{$notify_type}][mail]" value="1" disabled="disabled"|cond="!$available" checked="checked"|cond="$available && $selected" /> {$lang->cmd_mail_notify}</label>
<!--@if($sms_available)-->
{@ $available = isset($module_config->use[$notify_type]['sms']) && $module_config->use[$notify_type]['sms'] !== 'N'}
{@ $selected = (is_array($uc[$notify_type]) && in_array('sms', $uc[$notify_type]))}
<label class="x_inline"><input type="checkbox" name="use[{$notify_type}][sms]" value="1" disabled="disabled"|cond="!$available" checked="checked"|cond="$available && $selected" /> {$lang->cmd_sms_notify}</label>
<!--@endif-->
<!--@if($push_available)-->
{@ $available = isset($module_config->use[$notify_type]['push']) && $module_config->use[$notify_type]['push'] !== 'N'}
{@ $selected = (is_array($uc[$notify_type]) && in_array('push', $uc[$notify_type]))}
<label class="x_inline"><input type="checkbox" name="use[{$notify_type}][push]" value="1" disabled="disabled"|cond="!$available" checked="checked"|cond="$available && $selected" /> {$lang->cmd_push_notify}</label>
<!--@endif-->
<p class="help-block">{sprintf($lang->get('ncenterlite_' . $notify_type . '_noti_about'), $logged_info->nick_name)}</p>
</div>
<div class="control-group">
<label class="x_control-label">{$lang->get('ncenterlite_type_' . $notify_type)}</label>
<div class="x_controls">
{@ $available = isset($module_config->use[$notify_type]['web']) && $module_config->use[$notify_type]['web'] !== 'N'}
{@ $selected = (is_array($uc[$notify_type]) && in_array('web', $uc[$notify_type]))}
<label class="x_inline"><input type="checkbox" name="use[{$notify_type}][web]" value="1" disabled="disabled"|cond="!$available" checked="checked"|cond="$available && $selected" /> {$lang->cmd_web_notify}</label>
{@ $available = isset($module_config->use[$notify_type]['mail']) && $module_config->use[$notify_type]['mail'] !== 'N'}
{@ $selected = (is_array($uc[$notify_type]) && in_array('mail', $uc[$notify_type]))}
<label class="x_inline"><input type="checkbox" name="use[{$notify_type}][mail]" value="1" disabled="disabled"|cond="!$available" checked="checked"|cond="$available && $selected" /> {$lang->cmd_mail_notify}</label>
<!--@if($sms_available)-->
{@ $available = isset($module_config->use[$notify_type]['sms']) && $module_config->use[$notify_type]['sms'] !== 'N'}
{@ $selected = (is_array($uc[$notify_type]) && in_array('sms', $uc[$notify_type]))}
<label class="x_inline"><input type="checkbox" name="use[{$notify_type}][sms]" value="1" disabled="disabled"|cond="!$available" checked="checked"|cond="$available && $selected" /> {$lang->cmd_sms_notify}</label>
<!--@endif-->
<!--@if($push_available)-->
{@ $available = isset($module_config->use[$notify_type]['push']) && $module_config->use[$notify_type]['push'] !== 'N'}
{@ $selected = (is_array($uc[$notify_type]) && in_array('push', $uc[$notify_type]))}
<label class="x_inline"><input type="checkbox" name="use[{$notify_type}][push]" value="1" disabled="disabled"|cond="!$available" checked="checked"|cond="$available && $selected" /> {$lang->cmd_push_notify}</label>
<!--@endif-->
<p class="help-block">{sprintf($lang->get('ncenterlite_' . $notify_type . '_noti_about'), $logged_info->nick_name)}</p>
</div>
<!--@endif-->
</div>
<!--@endforeach-->
</section>
<div class="clearfix btnArea">