<?php
	if (!empty($list)):

	//是否显示功能键
	$showBtn = isset($showBtn) ? $showBtn: true;
?>
<div class="feed-list <?php if ('profile' == $tab):?>mblog-list box-body<?php endif;?>">
	<!-- 提到我的微博 -->
	<?php if ($tab == 'atme'):?>
	<div class="feed-title">
	提到我的微博
	</div>
	<?php endif;?>
	<!-- end 提到我的微博 -->

	<!-- 我的收藏 -->
	<?php if ($tab == 'favs'):?>
	<div class="feed-title">
	<!--
	<span>共<?php echo $total;?>条</span>
	-->
	我的收藏
	</div>
	<?php endif;?>
	<!-- end 我的收藏 -->
	<a href="javascript:;" class="new-feed" hidefocus="true" style="display:none"  rel="reload" id="new-feed"></a>
	<ul id="<?php echo empty($list_id) ? 'feed-list': $list_id;?>">
	<?php
		$json = array();

		foreach ($list as $item):

		$json_element = array(
			'cr' => $item['created_at'], //create time
			'f' => $item['favorited'] ? 1: 0, //is favorited
			's' => $item['source'], //来源
			'tx' => $item['text'] //文本内容
//			,'c' => $item['truncated'] ? 1: 0 //内容是否被截断
		);

		if ($item['thumbnail_pic']) {
			$json_element['tp'] = $item['thumbnail_pic'];
			$json_element['mp'] = $item['bmiddle_pic'];
			$json_element['op'] = $item['original_pic'];
		}

		$user = $item['user'];

		$json_element['u'] = array(
//							'ct' => $user['city'],  //城市ID
//							'cr' => $user['created_at'], //创建时间
//							'ds' => $user['description']
			'id' => (string)$user['id'], //用户ID
//			'n' => $user['name'], //昵称名称
			'sn' => $user['screen_name'], //显示的名称
			'p' => $user['profile_image_url'],
			'v' => $user['verified'] ? 1: 0
		);

		//转发消息
		if ($item['retweeted_status']) {
			$rt = $item['retweeted_status'];

			$json_element['rt'] = array(
				'cr' => $rt['created_at'],
				'f' => $rt['favorited'],
				'id' => (string)$rt['id'],
				's' => $rt['source'],
				'tx' => $rt['text'],
				'fl' => $rt['fllowing'] ? 1: 0,
				'sn' => $rt['screen_name'],
				'u' => array(
					'id' => (string)$rt['user']['id'],
					'sn' => $rt['user']['screen_name'],
					'v' => $rt['user']['verified']? 1: 0,
					'p' => $rt['user']['profile_image_url']
				)
			);

			if ($rt['thumbnail_pic']) {
				$json_element['rt']['tp'] = $rt['thumbnail_pic'];
				$json_element['rt']['mp'] = $rt['bmiddle_pic'];
				$json_element['rt']['op'] = $rt['original_pic'];
			}
		}

		$json[(string)$item['id']] = $json_element;
	?>
	<li id="i<?php echo $item['id'];?>">
		<?php if ($tab != 'profile'):?>
		<div class="user-pic">
		<a href="<?php  echo URL('ta',array('id' => $item['user']['id']));?>"><img width="50" height="50" src="<?php echo APP::F('profile_image_url', $item['user']['profile_image_url']);?>" alt="<?php echo htmlspecialchars($item['user']['screen_name']);?>" title="<?php echo htmlspecialchars($item['user']['screen_name']);?>" /></a>
	    </div>
		<?php endif;?>
	    <div class="feed-content">
			<p class="feed-main">
				<?php if ($tab != 'profile'):?>
				<a <?php if ($item['user']['sina_v'] == 1):?>class="v-icon icon-bg"<?php endif;?> href="<?php  echo URL('ta',array('id' => $item['user']['id']));?>" title="<?php echo htmlspecialchars($item['user']['screen_name']);?>">
                <?php echo htmlspecialchars($item['user']['screen_name']);?></a>：
				<?php endif;?>
                <?php echo APP::F('format_text', $item['text']);?>
			</p>
		<?php if ($item['thumbnail_pic']): ?>
			<div class="preview-img">
				<div class="feed-img">
				<?php if ($showBtn): ?>
					<img class="zoom-move" src="<?php echo $item['thumbnail_pic'];?>" rel=4 alt="" />
				<?php else:?>
					<a href="<?php  echo URL('show',array('id' => $item['id']));?>"><img src="<?php echo $item['thumbnail_pic'];?>" alt="" /></a>
				<?php endif;?>
				</div>
			</div>
		<?php endif;?>
		<!-- 转发微博内容部分 -->
		<?php if ($item['retweeted_status']): ?>
			<div class="box-style">
				<div class="box-t skin-bg"><span class="skin-bg"></span></div>
				<div class="forward box-content  showbox-f">
					<p><a <?php if ($item['retweeted_status']['user']['sina_v'] == 1):?>class="v-icon icon-bg"<?php endif;?> href="<?php  echo URL('ta',array('id' => $item['retweeted_status']['user']['id']));?>">@<?php echo htmlspecialchars($rt['user']['screen_name']);?></a>：<?php echo  APP::F('format_text', $rt['text']);?>
					<span>
					<a href="<?php  echo URL('show',array('id' => $item['retweeted_status']['id']));?>">原文转发<?php if ($batch_counts[$item['retweeted_status']['id']]['rt'] > 0):?>(<?php echo $batch_counts[$item['retweeted_status']['id']]['rt'];?>)<?php endif;?></a>|
					<a href="<?php  echo URL('show',array('id' => $item['retweeted_status']['id']));?>">原文评论<?php if ($batch_counts[$item['retweeted_status']['id']]['comments'] > 0):?>(<?php echo $batch_counts[$item['retweeted_status']['id']]['comments'];?>)<?php endif;?></a>
					</span>
					</p>
				<?php if ($rt['thumbnail_pic']): ?>
					<div class="preview-img">
						<div class="feed-img ">
					<?php if ($showBtn): ?>
						<img class="zoom-move"  src="<?php echo $rt['thumbnail_pic'];?>" rel=12 alt="" />
					<?php else:?>
						<a href="<?php  echo URL('show',array('id' => $item['id']));?>"><img src="<?php echo $item['thumbnail_pic'];?>" alt="" /></a>
					<?php endif;?>
						</div>
					</div>
				<?php endif;?>
				</div>
				<div class="box-b skin-bg"><span class="skin-bg"></span></div>
				<span class="box-arrow skin-bg"></span>
			</div>
		<?php endif; ?>
		<!-- end 转发微博内容部分 -->
			<div class="feed-info">
				<p>
				<?php if ($showBtn): ?>
					<?php if ($tab != 'favs'):?>
						<?php if ($uid == $item['user']['id']):?>
						<a href="#" rel=16>删除</a>
						<?php endif;?>
					<?php endif;?>
					<a href="#" rel=1>转发<?php if ($batch_counts[$item['id']]['rt'] > 0):?>(<?php echo $batch_counts[$item['id']]['rt'];?>)<?php endif;?></a>|
                    <?php if ($tab == 'favs'):?>
						<a href="#" rel=20>取消收藏</a>|
					<?php else:?>
						<a href="#" rel=2>收藏</a>|
					<?php endif;?>

					<a href="#" rel=3>评论<?php if ($batch_counts[$item['id']]['comments'] > 0):?>(<?php echo $batch_counts[$item['id']]['comments'];?>)<?php endif;?></a>
				<?php endif;?>
               </p>
				<span><a href="<?php  echo URL('show',array('id' => $item['id']));?>"><?php echo APP::F('format_time', $item['created_at']);?></a> 来自 <?php echo $item['source'];?></span>
			</div>
	    </div>
	</li>
	<?php endforeach;?>
    </ul>
    <div class="list-footer">
	<div class="page">
		<?php echo $makePage;?>
	</div>
	<a class="gotop-icon icon-bg" href="#">返回顶部</a>
    </div>
</div>
<?php if ((isset($jsonOut) && $jsonOut) || !isset($jsonOut)): ?>
<script type="text/javascript">
XWEIBO = {data: <?php echo json_encode($json);?>, uid: '<?php echo $uid?>', maxid: '<?php echo $endmid;?>', emotions: <?php echo json_encode(V('-:sinaWeiboEmotions'));?>, page: <?php echo $page ? $page : 1;?>, autoshow: '<?php echo  V('-:userConfig/user_newfeed');?>', tipshow: '<?php echo  V('-:userConfig/user_newmsg');?>'};
//XWEIBO_DATA = <?php //echo json_encode($list);?>;
</script>
<?php endif;?>

<?php endif;?>
