<?php
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가

@include_once($list_skin_path.'/set/set.load.php');

$set = amina_set_list($amina['list_set']);

$list_nicon = $set['list_nicon'] ? ' data-icon="'.$set['list_nicon'].'"' : '';
$list_icon = $set['list_icon'] ? ' data-icon="'.$set['list_icon'].'"' : '';

$n = 0;

$list_jQm_txt = '';
switch($amina['list_css']) {
	case 'theme-A'	: $list_jQm_theme = ' data-theme="a"'; $list_jQm_txt = ' style="color:#fff;"'; break;
	case 'theme-B'	: $list_jQm_theme = ' data-theme="b"'; $list_jQm_txt = ' style="color:#fff;"'; break;
	case 'theme-C'	: $list_jQm_theme = ' data-theme="c"'; break;
	case 'theme-D'	: $list_jQm_theme = ' data-theme="d"'; break;
	case 'theme-E'	: $list_jQm_theme = ' data-theme="e"'; break;
	default			: $list_jQm_theme = ''; break;
}

?>
<section>
<style>
	.list-basic-jQm h3, .list-basic-jQm p {
		margin: .5em 0; padding:0; line-height:1.1;	
	}
</style>
<div class="data-role">
<ul data-role="listview" class="list-basic-jQm">
<? for ($i=0; $i<count($list); $i++) { 
	
	$list_selected=$nbsp=$wr_comment='';

	//첫페이지만 공지사항 나오도록
	if($list[$i]['is_notice'] && $page > 1) continue;

	//링크 재설정
	$list[$i]['href'] = $list[$i]['href'].$frame_opt;

	//xp 및 모바일 아이콘
	$wr_post = amina_array_write($list[$i]['wr_10']);
	$wr_icon = amina_array_icon($list[$i]['wr_5']);

	$list[$i]['subject'] = amina_cut($list[$i]['wr_subject'], 100);

	$image = '';
	$icon_secret = '';
	$icon_blind = '';
	$contents = $list[$i]['subject'];
	$wr_comment = $list[$i]['wr_comment'];
	$is_blind = ($list[$i]['wr_9'] == "lock" || $list[$i]['wr_9'] == "shingo") ? true : false;
	if($is_blind) {
		$icon_blind = '<img src="'.$list_skin_url.'/img/icon_shingo.gif" alt="" /> ';
		$contents = '블라인드 처리된 글입니다.';
	} else {
		if($list[$i]['icon_secret']){
			$icon_secret = '<img src="'.$list_skin_url.'/img/icon_secret.gif" alt="" /> ';
			$contents = '비밀글입니다.';
		} else {
			if($list[$i]['is_notice']) {
				;
			} else {
				list($list[$i]['img']) = amina_thumb_img($list[$i]['file'], $list[$i]['wr_6'], $list[$i]['wr_content'], 1, $list[$i]['wr_4'], $list[$i]['wr_8']);
				$thumb = amina_make_thumb($list[$i]['img'], 120, 120, 90);
				if($thumb) $list[$i]['img'] = $thumb;
				if($list[$i]['img']) $image = '<img src="'.$list[$i]['img'].'" width="80" height="80" alt="" />';
			}
		}
	}

	//아이콘 출력
	$icon = amina_array_icon($list[$i]['wr_5']);
	$icon_mobile = $icon['mobile'] ? '<img src="'.$list_skin_url.'/img/icon_mobile.gif" alt="" /> ' : '';
	$icon_new = $list[$i]['icon_new'] ? '<img src="'.$list_skin_url.'/img/icon_new.gif" alt="" /> ' : '';

	if($list[$i]['is_notice']) { //Notice
?>
	<li<?php echo $list_jQm_theme.$list_nicon?>>
		<a href="<?php echo $list[$i]['href']; ?>">
			<h3><span<?php echo $list_jQm_txt; ?>><img src="<?php echo $list_skin_url; ?>/img/icon_notice.gif" alt="" /> <?php echo $contents; ?></span>
			<?php if($wr_comment){ ?>
				<span class="ui-li-count"><?php echo $wr_comment; ?></span>
			<?php } ?>
			</h3>
		</a>
	</li>
<?php } else { ?>
	<li<?php echo $list_icon; ?>><a href="<?php echo $list[$i]['href']; ?>">
		<?php echo $image; ?>
		<h3><?php echo $icon_new.$icon_blind.$icon_secret.$icon_mobile.$contents?>
			<?php if($wr_comment){ ?>
				<span class="ui-li-count"><?php echo $wr_comment; ?></span>
			<?php } ?>
		</h3>
		<p>
			<?php 
				if($is_category) echo $list[$i]['ca_name'].' ★ ';
				echo $list[$i]['wr_name'].' / '.amina_date($list[$i]['wr_datetime']); 
			?>
		</p>
	</a>
	</li>
<?php $n++; } ?>
<?php } ?>
<?php if ($n == 0) echo '<li><a><h3>게시물이 없습니다.</h3></a></li>'; ?>
</ul>
</div>
</section>