<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>微博广场<?php echo V('-:tpl/title');?></title>
<link href="<?php echo W_BASE_URL;?>css/base.css" rel="stylesheet" type="text/css" />
<link href="<?php echo W_BASE_URL;?>css/skin_default/skin.css" rel="stylesheet" type="text/css" />
<link href="<?php echo W_BASE_URL;?>css/teahouse.css" rel="stylesheet" type="text/css" />

</head>
<body id="teahouse">
	<div id="wrapper">
		<!-- header -->
		<?php include APP::tplFile('header');?>
		<!-- end header -->	
        <div id="container">
        	<div class="sidebar">
            	<?php include APP::tplFile('intro');?> 
                <div class="top10">
                	<div class="sidebar-head">人气关注榜 Top10</div>
                    <ul>
                    	<?php for ($i=0,$count=count($top_followers); $i< $count; $i++) {?>
                    	<li>
							<div class="ranking skin-bg"><?php echo $i+1;?></div>
							<span><?php echo number_format($top_followers[$i]['followers_count']);?></span>
							<a href="<?php  echo URL('ta', 'id=' . $top_followers[$i]['uid']);?>"><?php echo $top_followers[$i]['screen_name'];?></a>
                        </li>
                        <?php }?>
                    </ul>
                </div>         
            </div>
            <div class="main">
                <div class="hot-topic column-a">
                    <div class="column-title">
                        <h3>今日话题</h3>
						<?php if(!empty($today_topic)) {?>
						<span class="theme">大家都在聊<a href="<?php echo URL('search','k='. urlencode($today_topic));?>"><?php echo $today_topic;?></a></span>
                        <a href="javascript:;" class="sendBtn" id="sendBtn">我也说几句</a>
						<?php }?>
                    </div>
                    <div class="column-body">
                        
                    </div>
                </div>
                <div class="random-list column-b">
                    <div class="column-title">
                        <h3>随便看看</h3>
                    </div>
                    <div class="column-body">
						<?php 
							$showBtn = $jsonOut = false;
							include APP::tplFile('feed_list');
						?>
                    </div>
                </div>
                <div class="recommand-list column-b">
                    <div class="column-title">
                        <h3>名人推荐</h3>
                    </div>
                    <div class="column-body">
					<?php foreach ($celebrity as $row) {?>
                        <div class="column-item">
						<a href="<?php echo URL('ta', 'id=' . $row['sina_uid']);?>" class="user-pic"><img src="<?php echo $row['image'];?>" alt="<?php echo $row['nick'];?>的头像" /></a>
							<a href="<?php echo URL('ta', 'id=' .$row['sina_uid']);?>" class="nick"><?php echo $row['nick'];?></a>
							<span class="info" title="<?php echo $row['description'];?>"><?php echo $row['description'];?></span>
						</div>
					<?php }?>
                    </div>
                    <a href="javascript:;" class="arrow leftBtn" title="向左" hidefocus="true"></a>
                    <a href="javascript:;" class="arrow rightBtn" title="向右" hidefocus="true"></a>
                </div>
                <div class="local-list column-b">
                    <div class="column-title">
                        <h3>同城推荐</h3>
                    </div>
                    <div class="column-body">
					<?php foreach ($recommend as $row) {?>
                        <div class="column-item">
						<a href="<?php  echo URL('ta', 'id=' .$row['user']['id']);?>" class="side user-pic"><img src="<?php echo $row['user']['profile_image_url'];?>" alt="<?php echo $row['user']['screen_name'];?>的头像" /></a>
                            <div class="content">
                                <a href="<?php  echo URL('ta', 'id=' . $row['user']['id']);?>" class="nick"><?php echo $row['user']['screen_name'];?></a>
                                <p class="feedback"><?php echo APP::F('format_text', $row['text']);?></p>
                            </div>
						</div>
					<?php }?>
                        
                    </div>
                </div>
            </div>
        </div>
        <!-- footer -->
		<?php include APP::tplFile('footer');?>
        <!-- end footer -->
    </div>

<img src='http://beacon.x.weibo.com/a.gif?xt=pv&p=pub&akey=<?php echo WB_AKEY;?>&uid=<?php echo $userinfo['id'];?>&random=<?php echo mt_rand();?>' style="display:none" />
<script type="text/javascript">
<?php
$today_topics = array();
foreach ($today_topic_weibo as $row) {

		$today_topics[$row['id']] = '<div class="column-item">' 
						.	(($row['user']['id'] != $userinfo['id']) ?
								((!$row['user']['following'] ) ? 
								'<a href="javascript:;" class="addfollow-btn all-bg" rel="'.$row['user']['id'].'">加关注</a>':
								'<span class="followed-icon icon-bg">已关注</span>'):
							 '')
						.	'<a href="' . URL('ta', 'id=' . $row['user']['id']) . '" class="side user-pic"><img src="' . $row['user']['profile_image_url'] . '" alt="' . $row['user']['screen_name'] . '的头像" /></a>'
                        .    '<div class="content">'
                        .        '<a href="' . URL('ta', 'id=' . $row['user']['id']) . '" class="nick">' . $row['user']['screen_name'] . '</a>'
						.		'<em class="info"><span class="gender ' . ($row['user']['gender'] == 'f'? 'female': 'male') . '"></span><span class="location">' . $row['user']['location'] . '</span> <span class="fans">粉丝<span>' . $row['user']['followers_count'] . '</span>人</span></em>'
						.		'<p class="feedback">' . (APP::F('format_text', $row['text'])) . '</p>'
                        .    '</div>' 
                        . '</div>';
}
echo 'var today_topic_weibo=', json_encode($today_topics) ;
?>
</script>
<script type="text/javascript" src="<?php echo W_BASE_URL;?>js/jquery.min.js"></script>
<script type="text/javascript" src="<?php echo W_BASE_URL;?>js/common.js"></script>
<script type="text/javascript" src="<?php echo W_BASE_URL;?>js/ui.js"></script>
<script type="text/javascript" src="<?php echo W_BASE_URL;?>js/teahouse.js"></script>
<script type="text/javascript">
XWEIBO = {emotions: <?php echo json_encode(V('-:sinaWeiboEmotions'));?>, autoshow: '<?php echo  V('-:userConfig/user_newfeed');?>', tipshow: '<?php echo  V('-:userConfig/user_newmsg');?>'};

$(function(){
	XWB.publishBox.init($('#sendBtn'), '<?php echo isset($today_topic)?'#' .$today_topic . '#':'';?>');
    XWB.bindSearch($('#search'), $('#searchSubmit'));
    setTimeout(function(){
		XWB.notifyChecker.start();
	}, 3000);
    $('#container div.user-intro strong').substrByWidth(105);
});
</script>
</body>
</html>
