<?php
   global $vis_language;
   $paging_list='';
   for($i=0;$i<$view_info['page_count'];$i++) $paging_list.='<option value="'.$i.'" '.(($forumInfo['page']==$i)?'selected="selected"':'').'>'.($i+1).'</option>'; 
      ?>
<section id="vis_workpanel" class="vbox">
   <section class="scrollable" id="vis_workpanel_div" style="display: block;">
      <section class="row m-b m-l m-r" id="breadcrumb">
         <? include_once(VIS_PATH_TEMPLATE.'forum_header.php'); ?>
      </section>
      <section class="col-lg-12">
         <div style="display:none;" id="vis_filter_list" class="wrapper bg-white clr"></div>
      </section>
      <? if(!empty($forumTopic)){ ?>
      <div class="col-lg-12">
         <form method="POST" id="vis_topic_list_form" name="vis_topic_list_form">
		<input type="hidden" name="vis_action" value="<? echo $operation['vis_action']; ?>" />
            <section class="panel panel-default">
               <div id="view_action" class="row wrapper clr">
                  <header class="col-sm-12">
					  <div id="tkt_left_menu" class="col-sm-1  m-l-n-sm">
					
                        <div class="vis_mass_action ">
                           <div class="pull-left">
                              <button data-toggle="dropdown" class="btn bg-empty btn-sm dropdown-toggle action_btn">
                              <i class="vh vh-action"></i> <span class="caret"></span>
                              </button>
                              <ul class="dropdown-menu">
                                 <li><a onclick="$('#vis_global_msg_div').visExecution('submit_form',{'vis_module':'forums', 'vis_operation':'change_forum_activity_setting','vis_form':'vis_topic_list_form','vis_switch':'spam','vis_spam_status':1,'vis_forum_id':'<?php echo $forumDetails['forum_id'];?>'});" href="javascript:void(0);"><? echo $vis_language['TXTMARKSPAM']; ?></a></li>
                                 <li><a data-toggle="ajaxModal" id="del" onclick="delete_forum_activity();" href="javascript:void(0);"><? echo $vis_language['TXTDELETE']; ?></a></li>
                              </ul>
                           </div>
                        </div>
                        
                     </div>
                     <div id="pg_1" class="pull-right col-sm-5">
                     <div class="btn-group pull-right  m-r-n">
                           <div style="width:auto !important;" id="paging" class="tkt_right_menu">
                              <select name="pageing" class="form-control input-sm selectpicker pull-right paging v-middle" onchange="$(this).parents('#vis_workpanel_div').visExecution('load_area',{'vis_module':'forums', 'vis_operation':'get_topic_list','vis_forum_id':'<?php echo $forumDetails['forum_id'];?>', 'vis_page':this.value, 'vis_sorted_by':'<?= $sort;?>' , 'criteria':'<?= $criteria;?>'});">
                              <? echo $paging_list;?>
                              </select>
                              <div class="text-muted pull-right label_page"><? echo $vis_language['TXTPAGE']; ?>:</div>
                           </div>
                        </div>
                           <div class="btn-group pull-right">
                           <button data-toggle="dropdown" class="btn bg-empty btn-sm dropdown-toggle action_btn"><? echo $vis_language['TXTACTION']; ?> <b class="caret"></b></button>
                           <ul id="vis_ticket_labels_list" class="dropdown-menu dropdown-menu-right text-left">
							   <li><a href="javascript:void(0);" onclick="$('#vis_workpanel_div').visExecution('load_module','Add forum topic',{'vis_module':'forums','vis_operation':'add_forum_topic','vis_domain':'<? echo $forumDetails['domain_id'];?>','vis_category':'<? echo $forumDetails['forum_cat_id'];?>','vis_forum':'<? echo $forumDetails['forum_id'];?>'});" ><? echo $vis_language['TXTADDTOPIC']; ?></a></li>
                              <li><a data-toggle="ajaxModal" data-modal-arguments="vis_module=forums&vis_operation=forum_details&vis_forum_id=<?=$forumDetails['forum_id'];?>&cache=true" href="javascript:void(0);"><? echo $vis_language['TXTEDITFORUM']; ?></a></li>
                              <li><a data-modal-arguments="vis_module=forums&vis_operation=get_delete_forum&vis_static_area=vis_forum_delete_confirm&vis_forum_id=<? echo $forumDetails['forum_id']; ?>"  data-toggle="ajaxModal" href="javascript:void(0);"><? echo $vis_language['TXTDELETEFORUM']; ?></a></li>
                           </ul>
                          
                       
                           <div id="get_staff_up" class="pull-left">
                              <button  type="button" class="btn bg-empty btn-sm dropdown-toggle action_btn bg-white" data-toggle="dropdown"><span class="filter-option pull-left"><?=$vis_language['TXTSORTBY']; ?> <span class="caret"></span></span></button>
                             
							  <ul id="vis_ticket_labels_list" class="dropdown-menu inner selectpicker">

								 <li><a onclick="$(this).parents('#vis_workpanel_div').visExecution('load_area',{'vis_module':'forums', 'vis_operation':'get_topic_list','vis_forum_id':'<? echo $forumDetails['forum_id'];?>' ,'vis_sorted_by':'recent', 'criteria':'<?= $criteria?>'})" href="javascript:void(0);"><?php echo ($operation['vis_sorted_by']=='recent' || $operation['vis_sorted_by']=='')?'<i class="vh vh-check pull-right"></i>':''?><?=$vis_language['TXTRECENT']; ?></a></li>
								 <li><a  onclick="$(this).parents('#vis_workpanel_div').visExecution('load_area',{'vis_module':'forums', 'vis_operation':'get_topic_list','vis_forum_id':'<? echo $forumDetails['forum_id'];?>' ,'vis_sorted_by':'popularity', 'criteria':'<?= $criteria?>'})"  href="javascript:void(0);"><?php echo ($operation['vis_sorted_by']=='popularity')?'<i class="vh vh-check pull-right"></i>':''?><?=$vis_language['TXTPOPULARITY']; ?></a></li>
								  <li><a onclick="$(this).parents('#vis_workpanel_div').visExecution('load_area',{'vis_module':'forums', 'vis_operation':'get_topic_list','vis_forum_id':'<? echo $forumDetails['forum_id'];?>' ,'vis_sorted_by':'unanswer', 'criteria':'<?= $criteria?>'})" href="javascript:void(0);"><?php echo ($operation['vis_sorted_by']=='unanswer')?'<i class="vh vh-check pull-right"></i>':''?><?=$vis_language['TXTUNANSWERED']; ?></a></li>
								   <li><a onclick="$(this).parents('#vis_workpanel_div').visExecution('load_area',{'vis_module':'forums', 'vis_operation':'get_topic_list','vis_forum_id':'<? echo $forumDetails['forum_id'];?>' ,'vis_sorted_by':'lock', 'criteria':'<?= $criteria?>'})" href="javascript:void(0);"><?php echo ($operation['vis_sorted_by']=='lock')?'<i class="vh vh-check pull-right"></i>':''?><?=$vis_language['TXTLOCK']; ?></a></li>
							  </ul>
                           </div>
                        </div>
                        
                     </div>
                     <div class=" col-sm-6">
						   <div><strong>
                          <?php if($operation['vis_sorted_by']=='recent' || $operation['vis_sorted_by'] =='')echo $vis_language['TXTRECENT'].' ('.$forumInfo['total'].')' ;
                          else if($operation['vis_sorted_by']=='popularity')echo $vis_language['TXTPOPULARITY'].' ('.$forumInfo['total'].')' ;
                          else if($operation['vis_sorted_by']=='unanswer' )echo  $vis_language['TXTUNANSWERED'].' ('.$forumInfo['total'].')' ;
                          else if($operation['vis_sorted_by']=='lock')echo $vis_language['TXTLOCK'].' ('.$forumInfo['total'].')' ;?>
                        </strong></div>
                     </div>
                     <!--/ .pull-right -->
                     
                   
                  </header>
               </div>
               <div id="vis_ticket_list" class="table-responsive scroll-x">
                  <script> $("#view_action").show(); $("#vis_topic_list_form .panel-footer").show(); $("#vis_ticket_list").show(); </script>
                  <div role="grid" class="dataTables_wrapper" id="DataTables_Table_1_wrapper">
                     <table data-ride="datatables" class="table table-hover m-b-none dataTable" id="DataTables_Table_1">
                        <thead class="table_head">
                           <tr role="row">
                              <th width="42px" class="p-r-none sorting_disabled" role="columnheader" rowspan="1" colspan="1" aria-label="
                                 Read
                                 Unread
                                 ">
                                 <div class="btn-group list_chkbox_action">
                                    <label style="float: left;" class="checkbox m-n m-r-sm i-checks"><input type="checkbox"><i></i></label>
                                 </div>
                              </th>
                              <th class="sorting_disabled"  role="columnheader" rowspan="1" colspan="1" aria-label="" >
                                 <!-- <a href="javascript:void(0);"  class="m-l" data-toggle="ajaxModal" data-modal-arguments="vis_module=forums&vis_operation=forum_details&vis_forum_id=<?php echo $forumDetails['forum_id']; ?>&cache=true"><i class="vh vh-edit"></i> </a>-->
                              </th>
                              <th role="columnheader" width="80%" tabindex="0" aria-controls="DataTables_Table_1" rowspan="1" colspan="1" ><span class=" text-md hidden-nav-xs text-black"><?php echo $forumDetails['forum_title'];?></span></th>
                              <th class="sorting_disabled" role="columnheader" rowspan="1" colspan="1" aria-label="" width="15%"></th>
                            </tr>
                        </thead>
                         <tbody role="alert" aria-live="polite" aria-relevant="all">
                        <?  for($i=0; $i< count($forumTopic); $i++){ $flag=0;?>
                       
                           <tr class="vis_read_message even" id="<?php echo $i;?>">
                              <td id="checkbox_data" class="p-r-none list_chkbox_action  sorting_1"><label class="checkbox m-n i-checks"><input type="checkbox" value="<?=$forumTopic[$i]['topic_id'];?>" id="vis_ticket_mass_chk_<?= $i;?>" name="vis_ticket_mass_chk_<?= $i;?>" class="vis_list_checkbox vis_list_read" data-status="1" data-dept-id="1"><i></i></label></td>
                              <td align="center" class="p-l-none ">
                                 <a onmouseout="hide_user_details(this);" id="user_<?=$forumTopic[$i]['topic_id'];?>" onmouseout="hide_user_details(this);" id="user_<? echo $forumTopic[$i]['activity_id'];?>"  onmouseover="javascript:show_user_details('<? echo $forumTopic[$i]['is_client'];?>','<? echo $forumTopic[$i]['user_id'];?>',null ,null ,null ,null,'<? echo $forumTopic[$i]['topic_id'];?>');" href="javascript:void(0);">
<? if($forumTopic[$i]['image_path']=='' || $forumTopic[$i]['image_path']=='default.jpg'){?>
<div class="l-avatar m-t-sm">
<? if($forumTopic[$i]['first_name']!=''){
	$firstname=preg_split('//u', $forumTopic[$i]['first_name'], -1, PREG_SPLIT_NO_EMPTY);
$lastname=preg_split('//u', $forumTopic[$i]['last_name'], -1, PREG_SPLIT_NO_EMPTY);
	?>
<div class="sm"><? echo ucfirst($firstname[0]).ucfirst($lastname[0]);?></div>
    <? }else{ ?>
    <img class="sm" src="<?= VIS_PATH_PROFILE.'default.jpg';?>">
    <? }?>

</div>
<? }else{ ?>
<div class="l-avatar m-t-sm">
<img src="<? echo VIS_PATH_PROFILE; echo $forumTopic[$i]['image_path']; ?>" class="sm">
</div>
<? }?>
                                    <!--<div class="avatar thumb-sm m-t-sm"><img src="<? //echo VIS_PATH_PROFILE; echo ($forumTopic[$i]['image_path']=='')?'default.jpg':$forumTopic[$i]['image_path']; ?>" alt=""></div>-->
                                 </a>
                              </td>
                              <td  > <span > <a  href="#/forums/topic_details/<? echo $forumTopic[$i]['topic_url'].'/'.$forumTopic[$i]['topic_id'];?>" data-html="true" class="link" id="topicdetails_<?= $forumTopic[$i]['topic_id']?>" rel="popover" ><? echo  $forumTopic[$i]['title'];?></a> </span > 
                              <span class="text-ellipsis  m-t-n-sm">   <?= $forumTopic[$i]['domain_name'];?> <i class='vh vh-angle-right vh-sm'></i> <a href="#/forums/forum_list/<?= $forumTopic[$i]['category_name'].'/'.$forumTopic[$i]['forum_cat_id'];?>" class="link"><?= 
                              (strlen( $forumTopic[$i]['category_name'])>25)?substr( $forumTopic[$i]['category_name'],0,25)."...": $forumTopic[$i]['category_name'] ;?></a> <i class='vh vh-angle-right vh-sm'></i> <a href="#/forums/get_topic_list/<?= $forumTopic[$i]['domain_name'].' : '.$forumTopic[$i]['category_name'].' : '.$forumTopic[$i]['forum_title'];?>/<?= $forumTopic[$i]['forum_id'];?>" class="link"><?= (strlen($forumTopic[$i]['forum_title'])>25)?substr($forumTopic[$i]['forum_title'],0,25)."...":$forumTopic[$i]['forum_title'];?></a>   </span>
                             <span class="text-ellipsis  m-t-n-sm">   
                                 <?php if($forumTopic[$i]['is_client'] == 1) {?>
                                <a href="#/client/client_details/Clients/<?= $forumTopic[$i]['user_id'];?>" class="link"><?php echo trim($forumTopic[$i]['first_name'].' '.$forumTopic[$i]['last_name']);?></a><?php }
                                    else if($forumTopic[$i]['is_client'] == 0){?>
                                  <a href="#/home/profile_view/Profile/<?= $forumTopic[$i]['user_id'];?>" class="link"><?php  echo trim($forumTopic[$i]['first_name'].' '.$forumTopic[$i]['last_name']);?></a><? } ?><span class="text-muted m-l-xs"><?php echo format_datetime($forumTopic[$i]['creation_date']); ?> </span></span>
                                 
                              </td>
                              <td onclick="$(this).parent().removeClass('vis_unread_message')" ><span id="vis_activities<?=$i;?>" style="display: none;"> <i size="18" class="vh vh-thumbs-up fsize-18 " title="Vote"></i>
                                 <? echo'('.$forumTopic[$i]['likeCount'].') ';?> 
                              <i size="18" class="vh vh-commentor vh-lg fsize-18 " title="Comments"></i>
                                 <? echo '('.$forumTopic[$i]['commentCount'].') ';?>
                                  <i size="18" class="vh vh-user vh-lg fsize-18 " title="Followers"></i>
                                  <? echo '('.$forumTopic[$i]['followersCount'].') ';?>
                                  </span>
                                 
                              </td>
                           </tr>
                     
                        <?php } ?>   </tbody>
                     </table>
                  </div>
                  <script>
                     $(".selectpicker").selectpicker();
                  </script>
                  <input type="hidden" value="" name="vis_domain_id" id="vis_domain_id">
               </div>
               	<footer class="wrapper panel-footer bg-white">
			  <div class="row">
				  <div class="col-sm-9 tkt_left_menu">
				<div class="vis_mass_action_footer">
			    <button data-toggle="dropdown" class="btn bg-empty btn-sm dropdown-toggle action_btn">
                              <i class="vh vh-action"></i> <span class="caret"></span>
                              </button>
                              <ul class="dropdown-menu">
                                 <li><a onclick="$('#vis_global_msg_div').visExecution('submit_form',{'vis_module':'forums', 'vis_operation':'change_forum_activity_setting','vis_form':'vis_topic_list_form','vis_switch':'spam','vis_spam_status':1,'vis_forum_id':'<?php echo $forumDetails['forum_id'];?>'});" href="javascript:void(0);"><? echo $vis_language['TXTMARKSPAM']; ?></a></li>
                                 <li><a data-toggle="ajaxModal" id="del1" onclick="delete_forum_activity();" href="javascript:void(0);"><? echo $vis_language['TXTDELETE']; ?></a></li>
                              </ul>
					</div>

			  </div>
			  <div class="col-sm-3 text-right text-center-xs tkt_right_menu" id="paging">
				<div class="pull-right" id="pg_2">
					   <select name="pageing" class="form-control input-sm selectpicker pull-right paging v-middle" onchange="$(this).parents('#vis_workpanel_div').visExecution('load_area',{'vis_module':'forums', 'vis_operation':'get_topic_list','vis_forum_id':'<?php echo $forumDetails['forum_id'];?>', 'vis_page':this.value, 'vis_sorted_by':'<?= $sort;?>', 'criteria':'<?= $criteria;?>'});">
                                 <? echo $paging_list;?>
                                 </select>
                       <div class="text-muted pull-right label_page"><? echo $vis_language['TXTPAGE']; ?>:</div>
				  </div>
				</div>
		  </div>
		</footer>
           
            </section>
         </form>
      </div>
      <section style="display:none;" id="vis_no_record_search" class="fullFrame m-n"></section>
      <?php }
         else
         {
         	include(VIS_PATH_TEMPLATE.'no_record_yet.php');
         } ?>
      <script></script>
      <script src="../scripts/dropdown_dropup.js"></script>
   </section>
</section>
<script type="text/javascript">
   $("tr").hover(
     function () {
     var id=this.id;
     	$("#vis_activities"+id).css("display","block");
     	
     });
     $("tr").mouseleave(
     function () {
     var id=this.id;
     	$("#vis_activities"+id).css("display","none");
     
   });
   function delete_forum_activity()
    {
		var selected = [];
		var selected1 = [];
		var vis_action = "";
		$('#checkbox_data input:checked').each(function() {
		selected.push($(this).attr('name'));
		selected1.push($(this).attr('value'));
		vis_action +=$(this).attr('name')+"="+$(this).attr('value')+",";
		});
		vis_action= vis_action.substring(0, vis_action.length-1);
		$('#del').attr('data-toggle','ajaxModal');
		$('#del').attr('data-modal-arguments','vis_module=forums&vis_operation=get_delete_forum_activity&vis_action='+vis_action+'&vis_switch=delete&vis_static_area=vis_activity_delete_area&vis_topic_list=1&vis_forum_id=<?php echo $forumDetails['forum_id']; ?>');
		$('#del1').attr('data-toggle','ajaxModal');
		$('#del1').attr('data-modal-arguments','vis_module=forums&vis_operation=get_delete_forum_activity&vis_action='+vis_action+'&vis_switch=delete&vis_static_area=vis_activity_delete_area&vis_topic_list=1&vis_forum_id=<?php echo $forumDetails['forum_id']; ?>');
	 }
</script>

