<div class="col-md-12 m-b-n-xs">
<div class="pull-left">
   <h3 class="m-b-none m-l-xs m-t-md text-black"><?  echo $vis_language['TXTFORUMS'];?></h3>
   <ul class="breadcrumb bg-empty no-border m-l-n-xs m-b-xxs">
	   <li><a class="link" href="#/home/quick_view/<? echo $vis_language['TXTHOME']; ?>"><? echo $vis_language['TXTHOME'];?></a></li>
	   <li><a class="link" href="#/forums/view_forum/<? echo $vis_language['TXTFORUMS']; ?>"><? echo $vis_language['TXTFORUM'];?></a></li>
       <?php  if($operation['vis_operation'] == 'view_forum'){?>
       <li class="active"><? echo $vis_language['TXTALLACTIVITY'];?></li> 
       <?php } if($operation['vis_operation'] == 'forum_filter') { if($filter_id==1){?>  
	   <li class="active"><? echo $vis_language['TXTALLACTIVITY'];?></li> 
	   <? } else if($filter_id==2){?>
	   <li class="active"><? echo $vis_language['TXTYOURTOPICACTIVITY'];?></li> <? } else if($filter_id==3){?><li class="active"><? echo $vis_language['TXTWAITINGFORAPPROVAL'];?></li> 
			<? } else if($filter_id==4){?><li class="active"><? echo $vis_language['TXTSPAM'];?></li> 
	 <?php } } if($operation['vis_operation'] == 'get_all_categories') {?> <li class="active"><? echo $vis_language['TXTALLCATEGORY'];?></li>
      <?php } if($operation['vis_operation'] == 'topic_details') {
      ?><li ><a class="link" href='#/forums/get_topic_list/<? echo $forumTopic['domain_name'].' : '.htmlspecialchars($forumTopic['category_name']).' : '.htmlspecialchars($forumTopic['forum_title']).'/'. $forumTopic['forum_id']; ?>'><?= (strlen($forumTopic['forum_title'])>25)?substr($forumTopic['forum_title'],0,25)."...":$forumTopic['forum_title']; ?></a></li>
        <li class="active"><?=(strlen($forumTopic['title'])>25)?substr($forumTopic['title'],0,25)."...":$forumTopic['title'];?></li>
      <?php } if($operation['vis_operation'] == 'get_topic_list') {$title=(isset($operation['criteria']) && $operation['criteria']!='')?$vis_language['TXTSEARCHRESULT']:htmlspecialchars($forumDetails['forum_title']);
	   ?><li class="active"> <? echo (strlen($title)>25)?substr($title,0,25)."...":$title; ?></li>
	   <?php } if($operation['vis_operation'] == 'edit_topic') { 
	   ?> <li ><a class="link" href='#/forums/get_topic_list/<? echo $topic['domain_name'].' : '.htmlspecialchars($topic['category_name']).' : '.htmlspecialchars($topic['forum_title']).'/'. $topic['forum_id']; ?>'><?= $forum_details[0]['forum_title'];?></a></li>
	    <li ><a class="link" href="#/forums/topic_details/<? echo $topic['title']; ?>/<?= $topic['topic_id'];?>">
	    <? echo (strlen($topic['title'])>25)?substr($topic['title'],0,25)."...":$topic['title']; ?></a></li>
	   <li class="active"><? echo $vis_language['TXTUPDATETOPIC'];?></li>
	   <?php } if($operation['vis_operation'] == 'add_forum_topic') {
	   ?> <li class="active"><? echo $vis_language['TXTADDTOPIC'];?></li><? } ?>
	   <?php if($operation['vis_operation'] == 'forum_list'){?>
		    <li><a class="link" href="#/forums/get_all_categories/All category"><? echo $vis_language['TXTALLCATEGORY'];?></a></li>
		   
	        <li clas="active"><? echo (strlen($forumData[0]['category_name'])>25)?substr($forumData[0]['category_name'],0,25)."...":$forumData[0]['category_name']; ?></li>
	   <?php }?>
   </ul>
</div>
<div class="m-t-md col-xs-6 pull-right">
   <div class="btn-group  pull-right m-l">
      <button data-toggle="dropdown" class="btn btn-default btn-sm dropdown-toggle"><? echo $vis_language['TXTADD'];?> <b class="caret"></b></button>
      <ul id="vis_ticket_labels_list" class="dropdown-menu dropdown-menu-right text-left">
         <li><a data-modal-arguments="vis_module=forums&vis_operation=add_forum_category_form&cache=true" data-toggle="ajaxModal" href="javascript:void(0);"><i class="vh  text-muted"></i> <? echo $vis_language['TXTFORUMCATEGORY'];?></a></li>
         <li><a id="vis_forum" href="javascript:void(0);" onclick="check_is_exist('forum',1);" ><i class="vh  text-muted"></i> <? echo $vis_language['TXTFORUM'];?></a></li>
         <li><a id="vis_topic" href="javascript:void(0);" onclick="check_is_exist('topic',1);" ><i class="vh  text-muted"></i> <? echo $vis_language['TXTTOPIC'];?></a></li>
      </ul>
   </div>
   <div class="input-group b-a b-2x rounded">
      <input class="form-control rounded input-sm no-border" type="text" placeholder="<?php echo $vis_language['TXTSEARCHTOPICS']."..."; ?>"  value="<?=htmlentities($criteria);?>" id="search_topic">
      <span class="input-group-btn rounded b-l b-3x">
      <button class="btn btn-sm btn-rounded bg-white b-white btn-icon" type="submit" onclick="display_forum_topic();">
      <i class="vh vh-search"></i>
      </button>
      </span>
   </div>
</div>
<script>
	  
	function display_forum_topic()
		{
	if($('#search_topic').val())
	{
	var topic = $('#search_topic').val();
	if(topic.length < 3)
	$("#vis_global_msg_div").visInterface("load_global_message", "<? echo $vis_language['TXTGLOBALSEARCHERROR'];?>");
	else
	$('#vis_blabber_container').visExecution('load_module',topic, {'vis_module':'forums', 'vis_operation':'get_topic_list', 'vis_action':'no_load','criteria':topic});
	}
	}
	
   check_is_exist('forum',0);
   check_is_exist('topic',0);
	
   function check_is_exist(name,chk)
   {
    $.ajax
   ({
   url: 'index.php',
   data: {'vis_module':"forums", 'vis_operation':"check_is_exist", 'vis_switch':name},
   type: "POST",
   dataType: "json",
   success: function(data)
   {
	   if(name=='forum')
	   {
		   if(data.cnt>0)
		   {
			    $('#vis_forum').attr('data-toggle','ajaxModal');
				$('#vis_forum').attr('data-modal-arguments','vis_module=forums&vis_operation=add_forum_form&cache=true');
		   }
		   else if(chk==1 && data.cnt==0)
		   {
			    $("#vis_global_msg_div").visInterface("load_global_message", "<? echo $vis_language['MSGREQADDFORUMCAT'];?>");
				return false;
		   }
	   }
	   else if(name=='topic')
	   {
		   if(data.cnt>0)
		   {
			    $('#vis_topic').attr('onclick',"$('#vis_workpanel_div').visExecution('load_module','Add forum topic',{'vis_module':'forums','vis_operation':'add_forum_topic'})");
		   }
		   else if(chk==1 && data.cnt==0)
		   {
			    $("#vis_global_msg_div").visInterface("load_global_message", "<? echo $vis_language['MSGREQADDFORUM'];?>");
				return false;
		   }
	   }
   }
   });
   }
</script>
