@version(2) @php // 커머스 스킨 공용 헬퍼(가격 표기)는 커머스 컨트롤러가 로드한다. // 대문은 다른 모듈이므로 여기서 직접 불러 둔다. 커머스 미설치면 그냥 넘어간다. if (!function_exists('shop_item_price')) { $rl_helper = \RX_BASEDIR . 'modules/commerce/helpers.php'; if (is_file($rl_helper)) { require_once $rl_helper; } } if (!function_exists('rl_price')) { function rl_price($rl_amount) { if (function_exists('shop_money')) { return shop_money((int)$rl_amount); } return number_format((int)$rl_amount); } } if (!function_exists('rl_flat')) { // 꺾쇠를 직접 쓰면 템플릿 컴파일이 깨지므로 chr 로 만든다 function rl_flat($rl_t) { $rl_lt = chr(60); $rl_gt = chr(62); $rl_t = preg_replace('/' . $rl_lt . 'br[^' . $rl_gt . ']*' . $rl_gt . '/i', ' ', (string)$rl_t); return trim(strip_tags($rl_t)); } } if (!function_exists('rl_post_thumb')) { // 코어 썸네일은 사이트 설정이 '첨부파일'이면 본문 이미지를 쓰지 않는다. // 그런 사이트에서도 카드가 비지 않게 본문 첫 이미지를 폴백으로 쓴다. function rl_post_thumb($rl_doc, $rl_w, $rl_h) { $rl_t = $rl_doc->getThumbnail($rl_w, $rl_h); if ($rl_t) { return $rl_t; } $rl_body = (string)$rl_doc->get('content'); $rl_lt = chr(60); if (preg_match('/' . $rl_lt . 'img\s[^>]*?src=("|\')([^"\' ]+)("|\')/i', $rl_body, $rl_m)) { return htmlspecialchars_decode(trim($rl_m[2])); } return ''; } } if (!function_exists('rl_cmp_new')) { function rl_cmp_new($rl_a, $rl_b) { return (int)$rl_b->item_srl <=> (int)$rl_a->item_srl; } } if (!function_exists('rl_board_rows')) { function rl_board_rows($rl_mid, $rl_count) { if ($rl_mid === '') { foreach (ModuleModel::getMidList((object)['module' => 'board'], ['mid']) ?: [] as $rl_brow) { $rl_mid = (string)($rl_brow->mid ?? ''); break; } } if ($rl_mid === '') { return ['mid' => '', 'rows' => []]; } $rl_binfo = ModuleModel::getModuleInfoByMid($rl_mid); if (!is_object($rl_binfo) || empty($rl_binfo->module_srl)) { return ['mid' => $rl_mid, 'rows' => []]; } $rl_args = new stdClass; $rl_args->module_srl = (int)$rl_binfo->module_srl; $rl_args->list_count = $rl_count; $rl_args->sort_index = 'list_order'; $rl_args->order_type = 'asc'; $rl_args->statusList = ['PUBLIC']; $rl_out = getModel('document')->getDocumentList($rl_args); $rl_rows = []; foreach ((array)($rl_out->data ?? []) as $rl_doc) { $rl_rows[] = $rl_doc; } return ['mid' => $rl_mid, 'rows' => $rl_rows]; } } // 굿즈 상점 $rl_shop = trim((string)($rl->shop_mid ?? '')); if ($rl_shop === '') { foreach (ModuleModel::getMidList((object)['module' => 'commerce'], ['mid']) ?: [] as $rl_row) { $rl_shop = (string)($rl_row->mid ?? ''); break; } } // 섹션 구성 $rl_secs = []; foreach (array_values((array)($rl->home_sections ?? [])) as $rl_srow) { $rl_srow = (array)$rl_srow; if (empty($rl_srow['stype'])) { continue; } $rl_secs[] = [ 'stype' => (string)$rl_srow['stype'], 'title' => trim((string)($rl_srow['title'] ?? '')), 'text' => trim((string)($rl_srow['text'] ?? '')), 'image' => trim((string)($rl_srow['image'] ?? '')), 'source' => trim((string)($rl_srow['source'] ?? '')), 'link_text' => trim((string)($rl_srow['link_text'] ?? '')), 'link_url' => trim((string)($rl_srow['link_url'] ?? '')), 'count' => max(2, min(12, (int)($rl_srow['count'] ?? 8))), ]; } if (!count($rl_secs)) { $rl_secs = [ ['stype' => 'statement', 'title' => '', 'text' => '', 'image' => '', 'source' => '', 'link_text' => '', 'link_url' => '', 'count' => 4], ['stype' => 'riders', 'title' => '', 'text' => '', 'image' => '', 'source' => '', 'link_text' => '', 'link_url' => '', 'count' => 8], ['stype' => 'stats', 'title' => '', 'text' => '', 'image' => '', 'source' => '', 'link_text' => '', 'link_url' => '', 'count' => 4], ['stype' => 'goods', 'title' => '', 'text' => '', 'image' => '', 'source' => '', 'link_text' => '', 'link_url' => '', 'count' => 8], ['stype' => 'journal', 'title' => '', 'text' => '', 'image' => '', 'source' => '', 'link_text' => '', 'link_url' => '', 'count' => 3], ]; } // 상품 풀. 굿즈 섹션이 하나라도 있으면 한 번만 조회한다 $rl_pool = []; $rl_need_items = false; foreach ($rl_secs as $rl_s) { if (strpos($rl_s['stype'], 'goods') === 0) { $rl_need_items = true; } } if ($rl_need_items && $rl_shop !== '') { $rl_out = executeQuery('commerce.getItemList', (object)[ 'status_list' => 'sale,soldout', 'sort_index' => 'list_order', 'order_type' => 'asc', 'list_count' => 120, ]); if ($rl_out->toBool() && !empty($rl_out->data)) { $rl_rows = is_array($rl_out->data) ? $rl_out->data : [$rl_out->data]; $rl_now = date('YmdHis'); foreach ($rl_rows as $rl_it) { if (empty($rl_it->item_srl)) { continue; } if (!empty($rl_it->sale_start) && $rl_now < $rl_it->sale_start) { continue; } if (!empty($rl_it->sale_end) && $rl_now > $rl_it->sale_end) { continue; } $rl_it->item_name = \Context::replaceUserLang((string)$rl_it->item_name); $rl_pool[] = $rl_it; } } } $rl_riders = []; foreach (array_values((array)($rl->riders ?? [])) as $rl_rr) { $rl_rr = (array)$rl_rr; if (trim((string)($rl_rr['name'] ?? '')) === '') { continue; } $rl_riders[] = $rl_rr; } $rl_stats = []; foreach (array_values((array)($rl->stats ?? [])) as $rl_st) { $rl_st = (array)$rl_st; if (trim((string)($rl_st['value'] ?? '')) === '') { continue; } $rl_stats[] = $rl_st; } @endphp
@foreach ($rl_secs as $rl_sec) @php $rl_type_now = $rl_sec['stype']; $rl_items = []; $rl_more = ''; $rl_title = $rl_sec['title']; if (strpos($rl_type_now, 'goods') === 0) { foreach ($rl_pool as $rl_it) { if ($rl_type_now === 'goods_new' && ($rl_it->is_new ?? 'N') !== 'Y') { continue; } if ($rl_type_now === 'goods_sale' && !((int)($rl_it->sale_price ?? 0) > 0 && (int)$rl_it->sale_price < (int)$rl_it->price)) { continue; } $rl_items[] = $rl_it; } if ($rl_type_now === 'goods_new') { usort($rl_items, 'rl_cmp_new'); } $rl_items = array_slice($rl_items, 0, $rl_sec['count']); $rl_more = $rl_shop !== '' ? getUrl('', 'mid', $rl_shop, 'v', 'list') : ''; if ($rl_title === '') { if ($rl_type_now === 'goods_new') { $rl_title = $lang->rl_sec_goods_new; } elseif ($rl_type_now === 'goods_sale') { $rl_title = $lang->rl_sec_goods_sale; } else { $rl_title = $lang->rl_sec_goods; } } } @endphp @if ($rl_type_now === 'statement')
{{ $rl_title !== '' ? $rl_title : $lang->rl_sec_statement }}

{{ $rl_sec['text'] !== '' ? $rl_sec['text'] : $lang->rl_statement_default }}

@if ($rl_sec['link_url'] !== '' && $rl_sec['link_text'] !== '') {{ $rl_sec['link_text'] }} @endif
@endif @if ($rl_type_now === 'riders' && count($rl_riders))

{{ $rl_title !== '' ? $rl_title : $lang->rl_sec_riders }}

@if ($rl_sec['link_url'] !== '') {{ $rl_sec['link_text'] !== '' ? $rl_sec['link_text'] : $lang->rl_view_all }} @endif
@foreach (array_slice($rl_riders, 0, $rl_sec['count']) as $rl_ri => $rl_rd) @php $rl_rd_url = trim((string)($rl_rd['link_url'] ?? '')); @endphp
@if ($rl_rd_url !== '')@endif {{ sprintf('%02d', $rl_ri + 1) }}
{{ $rl_rd['name'] }} {{ $rl_rd['role'] ?? '' }} @if (!empty($rl_rd['since'])){{ $rl_rd['since'] }}@endif
@endforeach
@endif @if ($rl_type_now === 'stats' && count($rl_stats))
@foreach (array_slice($rl_stats, 0, 6) as $rl_st)
{{ $rl_st['value'] }}{{ $rl_st['suffix'] ?? '' }} {{ $rl_st['label'] ?? '' }}
@endforeach
@endif @if (strpos($rl_type_now, 'goods') === 0 && count($rl_items))

{{ $rl_title }}

@if ($rl_more !== '') {{ $lang->rl_view_all }} @endif
@foreach ($rl_items as $rl_it) @php $rl_p = (int)($rl_it->price ?? 0); $rl_s = (int)($rl_it->sale_price ?? 0); $rl_on = $rl_s > 0 && $rl_s < $rl_p; $rl_off = ($rl_on && $rl_p > 0) ? (int)round(($rl_p - $rl_s) / $rl_p * 100) : 0; @endphp thumb)) style="background-image:url('{{ escape($rl_it->thumb) }}')" @endif> @if (($rl_it->status ?? '') === 'soldout'){{ $lang->rl_soldout }} @elseif ($rl_on){{ $rl_off }}% @elseif (($rl_it->is_new ?? 'N') === 'Y')NEW@endif {{ $rl_it->item_name }} @if ($rl_on){{ rl_price($rl_p) }}{{ rl_price($rl_s) }} @else{{ rl_price($rl_p) }}@endif @endforeach
@endif @if ($rl_type_now === 'band')
@if ($rl_title !== '')

{{ $rl_title }}

@endif @if ($rl_sec['text'] !== '')

{{ $rl_sec['text'] }}

@endif @if ($rl_sec['link_url'] !== '' && $rl_sec['link_text'] !== '') {{ $rl_sec['link_text'] }} @endif
@endif @if ($rl_type_now === 'marquee') @php $rl_mq_items = []; foreach (explode('|', $rl_sec['text'] !== '' ? $rl_sec['text'] : (string)($rl->marquee_text ?? '')) as $rl_mq) { $rl_mq = trim($rl_mq); if ($rl_mq !== '') { $rl_mq_items[] = $rl_mq; } } @endphp @if (count($rl_mq_items)) @endif @endif @if ($rl_type_now === 'journal') @php $rl_j = rl_board_rows($rl_sec['source'], $rl_sec['count']); @endphp @if (count($rl_j['rows']))

{{ $rl_title !== '' ? $rl_title : $lang->rl_sec_journal }}

{{ $lang->rl_view_all }}
@foreach ($rl_j['rows'] as $rl_doc) @php $rl_thumb = rl_post_thumb($rl_doc, 720, 480); @endphp {{ $rl_doc->getTitleText() }} @endforeach
@endif @endif @endforeach