$end_time) {
$item['_status'] = '종료';
$item['_sort'] = 3;
} else {
$item['_status'] = '진행';
$item['_sort'] = 0;
}
} else {
$item['_status'] = '기타';
$item['_sort'] = 9;
}
// 시작일 없을 경우를 고려한 비교용 날짜
$item['_start_date'] = $start_date ? $start_date : '9999-99-99';
}
unset($item);
// 정렬: 상태 우선순위(_sort) → 시작일 최근순(내림차순)
usort($list, function ($a, $b) {
if ($a['_sort'] === $b['_sort']) {
// strcmp를 역순으로: 시작일이 최근인 것을 먼저 (내림차순)
return strcmp($b['_start_date'], $a['_start_date']);
}
return $a['_sort'] <=> $b['_sort'];
});
// 종료 상태인 항목 제외 및 예약일(wr_4)이 오늘보다 이후인 항목 제외
$today_ts = strtotime($todays);
$list = array_filter($list, function ($item) use ($today_ts) {
// _status가 '종료'이면 제외
if (isset($item['_status']) && $item['_status'] === '종료') {
return false;
}
// wr_4(예약일)이 설정되어 있고, 예약일이 오늘보다 이후이면 제외
if (!empty($item['wr_4'])) {
$wr4_ts = strtotime($item['wr_4']);
if ($wr4_ts !== false && $wr4_ts > $today_ts) {
return false;
}
}
return true;
});
// array_filter 후 인덱스 재정렬 (중요!)
$list = array_values($list);
// 정렬 후 list_count 재설정
$list_count = count($list);
for ($i=0; $i<$list_count; $i++) {
//썸네일
$thumb = get_list_thumbnail($bo_table, $list[$i]['wr_id'], $thumb_width, $thumb_height, false, true);
//썸네일여부 확인
if($thumb['src']) {
if (strstr($list[$i]['wr_option'], 'secret')) {
$img = G5_THEME_URL.'/rb.img/sec_image.png';
} else {
$img = $thumb['src'];
}
} else {
$img = G5_THEME_URL.'/rb.img/no_image.png';
$thumb['alt'] = '이미지가 없습니다.';
}
//썸네일 출력 class="skin_list_image" 필수 (높이값 설정용)
$img_content = '
!['.$thumb['alt'].']('.$img.')
';
//게시물 링크
$wr_href = get_pretty_url($bo_table, $list[$i]['wr_id']);
$sec_txt = '
작성자 및 관리자 외 열람할 수 없습니다.
비밀글 기능으로 보호된 글입니다.';
$wr_content = strip_tags($list[$i]['wr_content']);
//이벤트 라벨
$rb_ev_ico = '';
switch ($list[$i]['_status']) {
case '예정':
$rb_ev_ico = '
예정';
break;
case '종료':
$rb_ev_ico = '
종료';
break;
case '진행':
$rb_ev_ico = '
진행';
break;
}
?>
style="width:100%">
-
-
-
댓글
조회
데이터가 없습니다.