{@ $member_srl = Context::get('member_srl'); $user_selected = []; $user_config = NcenterliteModel::getUserConfig($member_srl) ?: new stdClass; $notify_types = NcenterliteModel::getUserSetNotifyTypes(); foreach ( $notify_types as $notify_type => $notify_srl ): $key = $notify_type . '_notify'; $user_config_array = get_object_vars($user_config); $user_config_array[$notify_type . '_notify'] = (isset($user_config_array[$notify_type]) && $user_config_array[$notify_type]) ? 'Y' : 'N'; $user_selected[$notify_type] = []; foreach (['web', 'mail', 'sms', 'push'] as $item): $available = isset($ncenter_config->use[$notify_type][$item]) && $ncenter_config->use[$notify_type][$item] !== 'N'; $selected = !is_array($user_config_array[$notify_type] ?? null) || in_array($item, $user_config_array[$notify_type]); $user_selected[$notify_type][$item] = new stdClass(); $user_selected[$notify_type][$item]->available = $available; $user_selected[$notify_type][$item]->selected = $selected; endforeach; endforeach; Context::set('member_info', $member_info); Context::set('notify_types', $notify_types); Context::set('user_config', $user_config_array); Context::set('user_selected', $user_selected); Context::set('module_config', NcenterliteModel::getConfig()); Context::set('sms_available', Rhymix\Framework\SMS::getDefaultDriver()->getName() !== 'Dummy'); Context::set('push_available', count(Rhymix\Framework\Config::get('push.types') ?? []) > 0); }