<?
   global $vis_language;
   $paging_list='';
   $select_domain_id = explode(',',$domain_access);
   for($i=0;$i<$view_info['page_count'];$i++) $paging_list.='<option value="'.$i.'" '.(($articles_info['page']==$i)?'selected="selected"':'').'>'.($i+1).'</option>';
   ?>
<section id="breadcrumb" class="row m-b m-l-none m-r-none">
   <div class="col-sm-4">
      <h3 class="m-b-xs text-black"><? echo $operation['view_title']; ?></h3>
      <div>
         <ul class="breadcrumb bg-empty no-border m-b-xxs no-padder">
            <li><a class="link" href="#/home/quick_view/<? echo $vis_language['TXTHOME']; ?>"><? echo $vis_language['TXTHOME']; ?></a></li>
            <li class="active"><? echo $operation['view_title']; ?></li>
         </ul>
      </div>
   </div>
	<div class="col-sm-8 m-t-md pull-right">
 <div class="btn-group pull-right">
			<button class="btn btn-default btn-sm dropdown-toggle" data-toggle="dropdown"><i class="vh vh-action text-muted"></i> <b class="caret"></b></button>
     <ul class="dropdown-menu dropdown-menu-right text-left">
         <li><a class="link" href="#/selfhelp/view_categories/<? echo $vis_language['TXTCATEGORIES'];?>/<?= $select_domain_id[0];?>" onclick="$('#vis_workpanel_div').visExecution('load_module', '<? echo $vis_language['TXTCATEGORIES'].'/'.$domain; ?>', {'vis_module':'<?php echo $operation['vis_current_module']; ?>', 'vis_operation':'<?php echo $operation['vis_operation3']; ?>','vis_domain_id':'<? echo $domains[0]['domain_id'];?>'})"><? echo $vis_language['TXTCATEGORIES']; ?></a></li>
			<li><a class="link" href="#/selfhelp/view_articles/<? echo $vis_language['TXTARTICLES']; ?>" onclick="$('#vis_workpanel_div').visExecution('load_module', '<? echo $vis_language['TXTARTICLES']; ?>', {'vis_module':'<?php echo $operation['vis_current_module']; ?>', 'vis_operation':'<?php echo $operation['vis_operation2']; ?>'});"><? echo $vis_language['TXTARTICLES']; ?></a></li>
			<li><a class="link" href="#/selfhelp/view_comments/<? echo $vis_language['TXTCOMMENTS']; ?>" onclick="$('#vis_workpanel_div').visExecution('load_module', '<? echo $vis_language['TXTCOMMENTS']; ?>', {'vis_module':'<?php echo $operation['vis_current_module']; ?>', 'vis_operation':'<?php echo $operation['vis_operation4']; ?>'})"><? echo $vis_language['TXTCOMMENTS']; ?></a></li>
         </ul>
   </div>
   <div class="btn-group pull-right m-l">&nbsp;
         <a class="btn btn-rounded btn-primary btn-sm dropdown-toggle" href="#/selfhelp/new_article/<? echo $vis_language['TXTADDARTICLE'];?>" onclick="$('#vis_workpanel_div').visExecution('load_module', '<? echo $vis_language['TXTADDARTICLE'];?>', {'vis_module':'selfhelp', 'vis_operation':'new_article', 'cache':'true','vis_article':1})"><i style="font-size:10px;" class="vh vh-plus"></i>  <? echo $vis_language['TXTADDARTICLE']; ?></a>
      </div> 

		<div class="col-sm-6 input-group b-a b-2x rounded pull-right">
			<input class="form-control rounded input-sm no-border" type="text" placeholder="<?php echo $vis_language['MSGSERART'];?>" value="<?php echo (isset($operation['criteria']))?$operation['criteria']:'';?>" id="search_language_variables">
			<span class="input-group-btn rounded b-l b-3x">
			<button class="btn btn-sm btn-rounded bg-white b-white btn-icon" type="button" onclick="display_articles();">
			<i class="vh vh-search"></i>
			</button>
			</span>
		</div>
	</div>
</section>
<div class="wrapper">
   <!-- number -->
   <div class="bg-white b-a">
      <section class="panel-default">
         <header class="panel-heading sub_header"><? echo $vis_language['TXTSUMMARY']; ?></header>
      </section>
      <div class="panel-body">
        <!-- <form name="vis_<?php echo $operation['vis_operation']; ?>_form" id="vis_<?php echo $operation['vis_operation']; ?>_form" class="form-horizontal" method="POST">
            <div class="form-group">
               <label class="col-sm-2 control-label"><? echo $vis_language['TXTDOMAIN']; ?></label>
               <div class="col-sm-8">
                  <select name="vis_domain" id="vis_domain" class="form-control input-sm selectpicker"  <? if(count($domains)>10) echo 'data-live-search="true"';?> onchange="$('#vis_workpanel_div').visExecution('load_module', '<? echo $vis_language['TXTSUMMARY']; ?>/'+$(this).val(), {'vis_module':'selfhelp', 'vis_operation':'<?php echo $operation['vis_current_operation']; ?>','vis_domain_id':$(this).val()});" >
                  <? for($i=0;$i<count($domains);$i++) echo '<option value="'.$domains[$i]['domain_id'].'" '.(($domain==$domains[$i]['domain_id'])?'selected="selected"':'').'>'.$domains[$i]['domain_name'].'</option>'; ?>
                  </select>
               </div>
            </div>
         </form>-->
         <div class="rnd text-center">
            <ul class="lg">
               <li>
						<h4><a href="javascript:void(0);" onclick="$('#vis_workpanel_div').visExecution('load_module', '<? echo $vis_language['TXTARTICLES'].'/'.$domain;; ?>', {'vis_module':'<?php echo $operation['vis_current_module']; ?>', 'vis_operation':'<?php echo $operation['vis_operation2']; ?>','vis_form':'vis_<?php echo $operation['vis_operation']; ?>_form'});"><? echo $articles_info['total']; ?></a></h4>
					<p><? echo $vis_language['TXTTOTARTICLES']; ?></p>
               </li>
               <li>
					<h4><a href="javascript:void(0);" onclick="$('#vis_workpanel_div').visExecution('load_module', '<? echo $vis_language['TXTCATEGORIES'].'/'.$select_domain_id[0]; ?>', {'vis_module':'<?php echo $operation['vis_current_module']; ?>', 'vis_operation':'<?php echo $operation['vis_operation3']; ?>','vis_form':'vis_<?php echo $operation['vis_operation']; ?>_form' })"><? echo $categories_info['total'] ?></a></h4>
					<p><? echo $vis_language['TXTTOTCATEGORY']; ?></p>
               </li>
               <li>
					<h4><a href="javascript:void(0);" onclick="$('#vis_workpanel_div').visExecution('load_module', '<? echo $vis_language['TXTCOMMENTS'].'/'.$domain; ?>', {'vis_module':'<?php echo $operation['vis_current_module']; ?>', 'vis_operation':'<?php echo $operation['vis_operation4']; ?>','vis_form':'vis_<?php echo $operation['vis_operation']; ?>_form'})"><? echo $comments_info['total']; ?></a></h4>
					<p> <? echo $vis_language['TXTCOMMENTS']; ?></p>
               </li>
               <li>
					<h4><a href="javascript:void(0);" onclick="$('#vis_workpanel_div').visExecution('load_module', '<? echo $vis_language['TXTARTICLES']; ?>', {'vis_module':'<?php echo $operation['vis_current_module']; ?>', 'vis_operation':'<?php echo $operation['vis_operation2']; ?>','vis_form':'vis_<?php echo $operation['vis_operation']; ?>_form','vis_featured_article':1});"><? echo $featured_articles_info['total']; ?></a></h4>
					<p> <? echo $vis_language['TXTFEATUREDARTICLES']; ?></p>
               </li>
            </ul>
         </div>
         <div class="row">
            <div class="col-md-12">
				<?if($recent_articles!=-1){?>
               <div class="panel-body">
				  <div class="setting-list">
                     <h4><? echo $vis_language['TXTRECENTARTICLES']; ?></h4>
                  </div>
                  <ul class="list-group list-group-alt list-group-lg m-b-n no-borders">
                     <? if($recent_articles!=-1) for($i=0;$i<count($recent_articles);$i++) {  ?>
                     <li class="list-group-item">
                     
                     <? if($recent_articles[$i]['author_image']!='' && $recent_articles[$i]['author_image']!='default.jpg'){ ?>
                     <div class="l-avatar pull-left m-r">
																					<img src="<? echo VIS_PATH_PROFILE.$recent_articles[$i]['author_image']; ?>"  class="img-circle sm"/>
		    															</div>
     														 <? }else{?>
                 			<div class="l-avatar pull-left m-r">
                    <? if($recent_articles[$i]['first_name']!='' || $recent_articles[$i]['author']!=''){
																						$authorname=(trim($recent_articles[$i]['author_name'])!='')?$recent_articles[$i]['author_name']:$recent_articles[$i]['author'];
$namearr=explode(' ',$authorname);
$fullname='';
if($recent_articles[$i]['first_name']!=''){
$lastname=preg_split('//u', $recent_articles[$i]['last_name'], -1, PREG_SPLIT_NO_EMPTY); 
$firstname=preg_split('//u', $recent_articles[$i]['first_name'], -1, PREG_SPLIT_NO_EMPTY);
$fullname=ucfirst($firstname[0]).ucfirst($lastname[0]);
}else{
	$firstname=preg_split('//u', $namearr[0], -1, PREG_SPLIT_NO_EMPTY);
	$fullname=ucfirst($firstname[0]);
}
																					?>
    <div class="sm"><?=$fullname;?></div>
    <? }else{ ?>
    <img class="img-circle sm" src="<?= VIS_PATH_PROFILE.'default.jpg';?>">
    <? }?>
																							
		    														</div>    
      														<? }?>
                     
                       <!-- <span class="pull-left thumb-sm m-r">
                        <img src="<? //echo VIS_PATH_PROFILE.(($recent_articles[$i]['author_image']==null)?'default.jpg':$recent_articles[$i]['author_image']); ?>"  class="img-circle"/>
                        </span>-->
                        <div class="clear">
                           <div class="m-r-n">
								 <div class="pull-right col-lg-3">
                                 <span class="pull-right">
       <span title="Like"><i class="vh vh-thumbs-up fsize-18"></i> (<? echo $recent_articles[$i]['art_likes']; ?>)&nbsp;&nbsp;</span>
       <span title="Unlike"><i class="vh vh-thumbs-up fsize-18 vh-rotate-180"></i> (<? echo abs($recent_articles[$i]['art_likes'] - $recent_articles[$i]['like_count']); ?>)</span>
       </span>
                             	 </div>
                               <a class="text-md clear" href="#/selfhelp/view_article/<? echo addslashes(str_replace(array('"', "'", '/', '\\'), '', $recent_articles[$i]['article_url'])).'/'.$recent_articles[$i]['article_id'];?>"><? echo $recent_articles[$i]['article_title']; ?></a>
                              <span class="m-r-md"><? echo $vis_language['TXTPOSTEDBY']; ?>: <a class="link" href="#/home/profile_view/<? echo $vis_language['TXTPROFILE'];?><?= ($recent_articles[$i]['author_id'] != VIS_STAFF_ID) ? '/'.$recent_articles[$i]['author_id'] : '';?>"><? echo (trim($recent_articles[$i]['author_name'])!='')?$recent_articles[$i]['author_name']:$recent_articles[$i]['author']; ?></a></span>
                              <span class="m-r-md"><? echo $vis_language['TXTPOSTON']; ?>: <span class="text-muted"><? echo format_date($recent_articles[$i]['entry_date']); ?></span></span>
                           </div>
                        </div>
                     </li>
                     <? } ?>
                  </ul>
               </div>
            </div><? } ?>
            <!-- col-md-12 -->
            <div class="col-md-12">
				<?if($featured_articles!=-1){?>
               <div class="panel-body">
 				  <div class="setting-list">
                     <h4><? echo $vis_language['TXTFEATUREDARTICLES']; ?></h4>
                  </div>
                  <ul class="list-group list-group-alt list-group-lg m-b-n no-borders">
                     <? if($featured_articles!=-1) for($i=0;$i<count($featured_articles);$i++) {     ?>
                     <li class="list-group-item">
                     <? if($recent_articles[$i]['author_image']!='' && $recent_articles[$i]['author_image']!='default.jpg'){ ?>
                     <div class="l-avatar pull-left m-r">
																					<img src="<? echo VIS_PATH_PROFILE.$recent_articles[$i]['author_image']; ?>"  class="img-circle sm"/>
		    															</div>
     														 <? }else{?>
                 			<div class="l-avatar pull-left m-r">
                    <? if($featured_articles[$i]['author_name']!='' || $featured_articles[$i]['author']!=''){
																					$authorname=(trim($featured_articles[$i]['author_name'])!='')?$featured_articles[$i]['author_name']:$featured_articles[$i]['author'];
$namearr=explode(' ',$authorname);
$fullname='';
if($featured_articles[$i]['first_name']!=''){ 
$lastname=preg_split('//u', $featured_articles[$i]['last_name'], -1, PREG_SPLIT_NO_EMPTY); 
$firstname=preg_split('//u', $featured_articles[$i]['first_name'], -1, PREG_SPLIT_NO_EMPTY);
$fullname=ucfirst($firstname[0]).ucfirst($lastname[0]);
}else{
	$firstname=preg_split('//u', $namearr[0], -1, PREG_SPLIT_NO_EMPTY);
	$fullname=ucfirst($firstname[0]);
}
																					?>
    <div class="sm"><?=$fullname;?></div>
    <? }else{ ?>
    <img class="img-circle sm" src="<?= VIS_PATH_PROFILE.'default.jpg';?>">
    <? }?>
																							
		    														</div>    
      														<? }?>
                       <!-- <span class="pull-left thumb-sm m-r">
                        <img src="<? //echo VIS_PATH_PROFILE.(($featured_articles[$i]['author_image']==null)?'default.jpg':$featured_articles[$i]['author_image']); ?>" class="img-circle"/>
                        </span>-->
                        <div class="clear">
                           <div class="m-r-n">
							<div class="pull-right col-lg-3">
                                 <span class="pull-right">
       <span title="Like"><i class="vh vh-thumbs-up fsize-18"></i> (<? echo $featured_articles[$i]['art_likes']; ?>)&nbsp;&nbsp;</span>
       <span title="Unlike"><i class="vh vh-thumbs-up fsize-18 vh-rotate-180"></i> (<? echo abs($featured_articles[$i]['art_likes'] - $featured_articles[$i]['like_count']); ?>)</span>
       </span>
                             </div>
                               <a class="text-md clear" href="#/selfhelp/view_article/<? echo $featured_articles[$i]['article_title'].'/'.$featured_articles[$i]['article_id'];?>"><? echo $featured_articles[$i]['article_title']; ?></a>
                              <span class="m-r-md"><? echo $vis_language['TXTPOSTEDBY']; ?>: <a class="link" href="#/home/profile_view/Profile<?= ($featured_articles[$i]['author_id'] != VIS_STAFF_ID) ? '/'.$recent_articles[$i]['author_id'] : '';?>"><? echo (trim($featured_articles[$i]['author_name'])!='')?$featured_articles[$i]['author_name']:$featured_articles[$i]['author']; ?></a></span>
                              <span class="m-r-md"><? echo $vis_language['TXTPOSTON']; ?>: <span class="text-muted"><? echo format_date($featured_articles[$i]['entry_date']); ?></span></span>
                           </div>
                        </div>
                     </li>
					 <? } ?>
                  </ul>
               </div><? } ?>
            </div>
            <!-- col-md-12 -->
         </div>
         <!-- /.col-md-12 -->
      </div>
   </div>
   <!-- /number -->
</div>
<script type="text/javascript">
   $(".selectpicker").selectpicker();
   $(document).ready(function() {
   $('[data-ride="datatables"]').dataTable({
   	 "bPaginate" : false,
          "paginate": false,
   		"sDom": 't', "bAutoWidth": false,
   		"aoColumns": [
   			{ "bSortable": false },
   		  	null,
   		  	null,
   		  	null,
   		  	null
   		]
   	});
   });
    
    function display_articles()
    {
		var article = $('#search_language_variables').val();
		if(article.length < 3)
			$("#vis_global_msg_div").visInterface("load_global_message", "<? echo $vis_language['TXTGLOBALSEARCHERROR'];?>");
		else if(article!="")
		$('#vis_workpanel_div').visExecution('load_module', '<? echo $vis_language['TXTARTICLES']; ?>', {'vis_module':'selfhelp', 'vis_operation':'view_articles', 'vis_action':'no_load','criteria':article});
		else
		$("#vis_global_msg_div").visInterface("load_global_message", "<? echo $vis_language['MSGSERARTBOX'];?>");
	}
</script>
