<? if(count($forumTopic) > 0) { ?>
<style>.list-group-item .h5 a{ font-size:13px;}</style>
<div class="panel-body" id="main_div">
                  <ul class="list-group m-b-n no-borders">
                     <? for($i=0;$i<count($forumTopic);$i++) { ?>  
                     <li class="list-group-item">                       
                        <div class="clear"> 
							<div class="col-sm-7">
							<span class="pull-left">
								<? if($forumTopic[$i]['is_lock']==1){?>
									<i class="vh vh-lg vh-lock m-r-sm" title="Locked topic"></i>
								<? } else if($forumTopic[$i]['is_sticky']==1){ ?>
									<i class="vh vh-lg vh-paperclip m-r-sm" title="Sticky topic"></i>
								<? } else { ?>
								<i class="vh vh-lg vh-file-o m-r-sm"></i><? } ?>
							</span>
                          <span class="h5 m-t-xs m-l-xs m-r-n"><a class="link" href="?/forums/topic-details/<?= $forumTopic[$i]['topic_url']; ?>/<?= $forumTopic[$i]['topic_id']; ?>"><?= $forumTopic[$i]['title']; ?></a></span>
                            <div class="m-t-xs m-r-n">
								 <div class="hidden-sm hidden-md hidden-lg">
									<div class="h6 m-l-lg m-r-sm "><? echo $forumTopic[$i]['first_name'].' '.$forumTopic[$i]['last_name']; ?></div>
									<div class="h6 m-r-md m-l-lg"><?= format_datetime($forumTopic[$i]['creation_date']); ?></div>
								 </div>
								 <div class="hidden-xs">
									<? if(isset($operation['vis_forum_activites']) && $operation['vis_forum_activites']!='') {?>
									<span class="h6 m-l-lg m-r-sm"> <a href="<?= ('?/forums/topic-list/'.$forumTopic[$i]['forum_title'].'/'.$forumTopic[$i]['forum_id']); ?>" title="<?= $forumTopic[$i]['forum_title']; ?>" class="link"><?= $forumTopic[$i]['forum_title']; ?></a></span>
									<? } else { ?>
									<span class="h6 m-l-lg m-r-sm"><? echo $forumTopic[$i]['first_name'].' '.$forumTopic[$i]['last_name']; ?></span><? } ?>
									  <span class="h6 m-r-md"><?= format_datetime($forumTopic[$i]['creation_date']); ?></span>
							  	</div>						
                          </div>
                          </div>
						  <div class="hidden-xs pull-right">
						  <? if(isset($operation['vis_forum_activites']) && $operation['vis_forum_activites'] == 'followers'){ ?>
							 <span>
								<a id="vis_remove_follower" class="btn btn-link btn-sm link m-t-sm" href="javascript:void(0);" onclick=" delete_followers(<? echo $forumTopic[$i]['topic_id']; ?>,this.id);"><?=$vis_language['TXTUNFOLLOW'];?></a>
							 </span>
							 <?} else {?>
						     <span class="post-overview-count">
									<aside><span style="color: #333333;" class="h5"><? echo $comment_count[$i]; ?></span></aside>
									<? echo $vis_language['TXTCOMMENT']; ?>
							  </span>
							  	
							  <? } ?><span class="post-overview-count">
									<aside><span style="color: #333333;" class="h5"><? echo $forumTopic[$i]['likeCount']; ?></span></aside>
									<? echo $vis_language['TXTVOTE']; ?>
							  </span>
                        </div>
                        </div>
                     </li><? } ?>
                 </ul>
              
               <div class="row padder clr m-b m-t" id="paging_bottom" <? if($forumTopic==-1) echo 'style="display:none;"'; ?>>
	   <div class="col-sm-12 text-center">
		  <ul class="pagination-sm pagination" id="forum_pagination"></ul>
</div> </div></div> <? } else {?>
<div class="fullMiddle m-xl text-center h4"><?= $vis_language['TXTNOTHINGTODISPLAY']; ?></div>
<? } ?>
<script>
	 <? if($page_count>0) { ?>
       $('.pagination-sm').twbsPagination({
   		totalPages:<?php echo $page_count; ?>,
   		startPage:<?php echo $page+1; ?>,
   		visiblePages:3,
   		first:false,
   		last:false,
   		onPageClick: function (event, page) {
   		$.ajax({
   		url: 'index.php',
   		data: {'vis_module':"forums", 'vis_operation':"get_topic_list", 'vis_page':page-1, 'vis_forum_id':'<?= $forumDetails['forum_id'];?>' ,'vis_sorted_by':'<? echo $operation['vis_sorted_by'];?>'},
   		type: "POST",
   		success: function(data) {            
   			$("#main_div").html(data);
   			//alert($(this).value());
   		}
   		});
             }
         });
   <? }?>
 function topic_sort(vis_sort) {	 
   	$.ajax({
           url: 'index.php',
           data: {'vis_module':"forums", 'vis_operation':"get_topic_list", 'vis_forum_id':'<?= $forumDetails['forum_id']; ?>', 'vis_sorted_by':vis_sort, 'criteria':'<?= $criteria?>'},
           type: "POST",
           success: function(data) {$('#main_div').html(data);}
       });
   }
   function topic_list(activity) {
   $.ajax({
           url: 'index.php',
           data: {'vis_module':"forums", 'vis_operation':"get_topic_list", 'vis_forum_id':'<?= $forumDetails['forum_id']; ?>', 'vis_forum_activites':activity, 'criteria':'<?= $criteria?>'},
           type: "POST",
           success: function(data) {$('#main_div').html(data);}
       });
   }
   function delete_followers(topic_id,id)
      {		
   			$.ajax
   			({
   			   url: 'index.php',
   			   data: {'vis_module':"forums", 'vis_operation':"delete_followers" ,'vis_topic_id':topic_id},
   			   type: "POST",
   			   dataType: "json",
   			   success: function(data)
   			   {	
   					if(data.vis_submitted=='true')
   					{
   					   $(window).scrollTop(0);
   					   $("#vis_submit_msg_div").show(); $("#vis_submit_msg_div").html("<?= $vis_language['MSGSUCCOPRT'];?>");
   					   $("#"+id).hide();
   					   $.ajax({
					   url: 'index.php',
					   data: {'vis_module':"forums", 'vis_operation':"get_topic_list", 'vis_forum_id':'<?= $forumDetails['forum_id']; ?>', 'vis_forum_activites':'followers', 'criteria':'<?= $criteria?>'},
					   type: "POST",
					   success: function(data) {$('#main_div').html(data);}
				   });
   					   setTimeout(function(){$("#vis_submit_msg_div").hide();},1000);
   				    } 
   					else
   				    {
   					   $(window).scrollTop(0);
   					   $("#vis_submit_err_div").show(); $("#vis_submit_err_div").html(data.vis_msg);
   					   setTimeout(function(){$("#vis_submit_err_div").hide();},10000);
   				    }	
   			 }
   			   });
   	   }
</script>
