<?php TPL::output('global/header.tpl.htm'); ?>

<div class="tny-basic main tny-clear ">
           <div class="tny-left lsidebar b_restrain">
           	<h3 class="trends-H3 qAll rel content-H3 ">
           	<?php if ($this->user_id) { ?>
                <p class="navC abs" id="topic">
                  <a href="javascript:;" >Have concern</a>
                  <a href="javascript:;" class="cur">Square</a>
                </p>
            <?php } ?>
                Topic
            </h3>
          <div>
          <div id="topic_1" >
           <?php if ($this->today_topic) { ?>
              <p class="topic_today tny-gloCor">Topic of the day</p>
              <div class="tindex rel ttitle-main">
                
                <h3><b><?php echo $this->today_topic['topic_title']; ?></b> </h3>
                <p class="txtBreak tny-cl_01 tny-basicted"><?php echo nl2br(utf8_substr($this->today_topic['topic_description'], 0, 128, 'UTF-8', '...')); ?><a href="topic/<?php echo $this->today_topic['url_token']; ?>">Enter topic »</a></p>
                <a class="topicHead abs"><img title="<?php echo $this->today_topic['topic_title']; ?>" alt="<?php echo $this->today_topic['topic_title']; ?>" class="tny-radiu5" src="<?php echo get_topic_pic_url('max', $this->today_topic['topic_pic']); ?>"></a> 
                
                <ul class="list">
                		<?php if ($this->today_topic['action_list']) { ?>
                		<?php foreach ($this->today_topic['action_list'] AS $key => $val) { ?>
                        <li>
                            <span class="replys tny-right"><?php echo $val['answer_count']; ?> Replies</span>
                            <span class="txt_link tny-txtHide"><a href="question/<?php echo $val['question_id']; ?>#reply<?php echo $val['answer_count']; ?>"><?php echo $val['question_content']; ?></a></span>
                        </li>
                        <?php } ?>
                        <?php } ?>
                        <?php if ($this->today_topic['best_answer_users']) { ?>
                        <li>
                            <span class="user_x2 tny-right">Adepts:
                            <?php foreach ($this->today_topic['best_answer_users'] AS $key => $val) { ?>
                            	<a href="people/<?php echo $val['user_info']['url_token']; ?>"><img data-message="&uid=<?php echo $val['user_info']['uid']; ?>&card=user" class="tny-radiu3 umsg" alt="jinshuo" src="<?php echo get_avatar_url($val['user_info']['uid'], 'mid'); ?>"></a>
                            <?php } ?>		
                            </span>
                            <!--<p class="glotxtclass user_x3 rel"><input  type="text" value="The issues related to the problem..." onfocus="$.topic.akQues(this);" class="txt_x2"/><a href="javascript:;" class="askQuestion abs tny-radiu3">Ask</a></p>-->
                    </li>
                    <?php } ?>
                </ul>
                </div>
                <?php } ?>
                <p class="topic_today tny-gloCor x2">Recommended topics</p>
                <?php foreach ($this->related_topics AS $key => $val) { ?>
                <div class="mgtopic rel recommend-topic tny-radiu5">
                	<p><a class="glotopic" href="topic/<?php echo $val['url_token']; ?>"><?php echo $val['topic_title']; ?></a></p>
                    <div class="tny-cl_03 tny-basicted tx2">
                    	<p class="txtBreak tx3"><?php echo nl2br(utf8_substr($val['topic_description'], 0, 128, 'UTF-8', '...')); ?><a href="topic/<?php echo $val['url_token']; ?>">Topic details »</a>
                    	<p class="tx4 tny-cl_02"><span><?php echo $val['discuss_count']; ?> question</span>&nbsp;&nbsp;<span><?php echo $val['focus_count']; ?> participants</span></p>
                    </div>
                    <?php if ($val['related_topics']) { ?>
                    <p class="tx">Related topic: 
                	<?php foreach ($val['related_topics'] AS $related_key => $related_val) { ?>
                        <a href="topic/<?php echo $related_val['url_token']; ?>" class="glotopic umsg" data-message="&uid=<?php echo $related_val['topic_id']; ?>&card=topic"><?php echo $related_val['topic_title']; ?></a>
                    <?php } ?>
                    </p>
                    <?php } ?>
                    
                     <a class="topicHead abs" href="topic/<?php echo $val['url_token']; ?>"><img title="<?php echo $val['topic_title']; ?>" alt="<?php echo $val['topic_title']; ?>" class="tny-radiu5" src="<?php echo get_topic_pic_url('max', $val['topic_pic']); ?>"></a>
                </div>
                <?php } ?>
                
                <p class="topic_today tny-gloCor">All topics</p>
                <ul class="pri_letter tny-clear t_hot mg_topic_mdan" id="c_topics_list"></ul>
                
                <p id="io_topics_more"><a class="ajax-more" href="javascript:;">Show More</a></p>
                
                <script type="text/javascript">
                	$(document).ready(function () {
	                	io_more_load(GET_BASE_URL + '/topic/ajax/topics_list/', $('#io_topics_more'), $('#c_topics_list'));
                	});
                </script>
              </div>
              <div id="topic_0" style="display:none;">  
                <?php if ($this->user_id) { ?>
                <p class="topic_today tny-gloCor">My followed topics</p>
                
                <div id="c_focus_list"></div>
                
                <p id="io_focus_more"><a class="ajax-more" href="javascript:;">Show More</a></p>
                
                <script type="text/javascript">
                	$(document).ready(function () {
	                	io_more_load(GET_BASE_URL + '/topic/ajax/focus_list/', $('#io_focus_more'), $('#c_focus_list'));
                	});
                </script>
                <?php } ?>
              </div>
           </div>
     </div><!--end l sidebar div-->
            
     <div class="rsidebar">
              <div class="rightMain">
                <div class="topic_hrx">
                	<h3 class="tny-gloCor">Popular topic</h3>
                    <div class="topic_x3">
                    	<ul class="topic_x4">
                    		<?php foreach ($this->hot_topics AS $key => $val) { ?>
                    		<li><em<?php if ($key + 1 <= 3) { ?> class="top"<?php } ?>><?php echo ($key + 1); ?></em><a data-message="&uid=<?php echo $val['topic_id']; ?>&card=topic" class="glotopic umsg" href="topic/<?php echo $val['url_token']; ?>"><?php echo $val['topic_title']; ?></a></li>
                    		<?php } ?>
                         </ul>                       
                    </div>
                    
                    <h3 class="tny-gloCor">Topic Edit</h3>
                     <div class="topic_edits">
                     	<?php if ($this->edit_log) { ?>
                     	<?php foreach ($this->edit_log AS $key => $val) { ?>
                     	<a data-message="&uid=<?php echo $val['topic_info']['topic_id']; ?>&card=topic" class="glotopic umsg" href="topic/<?php echo $val['topic_info']['url_token']; ?>"><?php echo $val['topic_info']['topic_title']; ?></a>
                        <p><a href="people/<?php echo $val['user_info']['url_token']; ?>" data-message="&uid=<?php echo $val['user_info']['uid']; ?>&card=user" class="umsg"><?php echo $val['user_info']['user_name']; ?></a> <?php echo date_friendly($val['add_time']); ?> edit this topic</p>
                        <?php } ?>
                        <?php } ?>
                     </div>
                     
                     <?php if ($this->unedit_topics) { ?>
                     <h3 class="tny-gloCor">Topics to be edited</h3>
                     <div class="topic_edits">
                     	<?php foreach ($this->unedit_topics AS $key => $val) { ?>
                     	<a data-message="&uid=<?php echo $val['topic_id']; ?>&card=topic" class="glotopic umsg" href="topic/<?php echo $val['url_token']; ?>"><?php echo $val['topic_title']; ?></a>
                        <?php } ?>
                     </div>
                     <?php } ?>
                </div>
                
              </div>
        </div>
     

</div>

<script type="text/javascript">
	$.tabs('#topic'); //Switching topics Square
	//$.tabs('#topic_banner');//All problems switching
</script>

<?php TPL::output('global/footer.tpl.htm'); ?>