<div class="row">
   <div class="col-md-12">
      <section class="container m-t-md">
         <?  $article_count = 0;
            if($selfhelp!=-1 && VIS_MODULE_ACCESS_SELFHELP==1) { 
            for($i=0;$i<count($selfhelp);$i++) { if($selfhelp[$i]['is_enabled']==1) $article_count++; }?>
         <? if($article_count > 0) { ?>
         <div class="panel-heading b-b">
            <h4 class="panel-title1"><? echo $vis_language['TXTSELFHELP']; ?> (<? echo ($selfhelp==-1)?0:$article_count; ?>)</h4>
         </div>
         <div class="panel-body">
            <ul class="list-group  m-b-n no-borders">
               <? if($selfhelp!=-1) for($i=0;$i<count($selfhelp);$i++) {
                  if($selfhelp[$i]['is_enabled']==1) { ?>
               <li class="list-group-item">
               <? if($selfhelp[$i]['author_image']=='' || $selfhelp[$i]['author_image']=='default.jpg'){?>
<div class="l-avatar pull-left m-r">
 <? if($selfhelp[$i]['author']!='' || $selfhelp[$i]['author_name']!=''){
		$authorname=(trim($selfhelp[$i]['author_name'])!='')?$selfhelp[$i]['author_name']:$selfhelp[$i]['author'];
											$namearr=explode(' ',$authorname);
											$fullname='';
											if($selfhelp[$i]['first_name']!=''){ 
											$lastname=preg_split('//u', $selfhelp[$i]['last_name'], -1, PREG_SPLIT_NO_EMPTY); 
											$firstname=preg_split('//u', $selfhelp[$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"><? echo $fullname;?></div>
    <? }else{ ?>
    <img class="sm" src="<?= VIS_PATH_PROFILE.'default.jpg';?>">
    <? }?>

</div>
<? }else{ ?>
<div class="l-avatar pull-left m-r">
<img src="<?= VIS_PATH_PROFILE.$selfhelp[$i]['author_image']; ?>" class="sm">
</div>
<? }?>
                  <!--<span class="pull-left thumb-sm m-r"><img class="img-circle" src="<? //= VIS_PATH_PROFILE.$selfhelp[$i]['author_image']; ?>"></span>-->
                  <div class="clear">
                  <div class="btn-group pull-right">
	   <div>
    <span class="m-l-xs pull-right" >
      <span title="Like"><i class="vh vh-thumbs-up fsize-18" ></i> (<? echo $selfhelp[$i]['art_likes']; ?>)&nbsp;&nbsp;</span>
      <span title="Unlike"><i class="vh vh-thumbs-up fsize-18 vh-rotate-180" ></i> (<? echo abs($selfhelp[$i]['art_likes'] - $selfhelp[$i]['like_count']); ?>)</span>
       </span>
			      
        </div>
	   </div>
                     <!--<span class="vh-yellow m-l-md pull-right">
                     <? //for($cn=0;$cn<$selfhelp[$i]['rating'];$cn++){ ?><i class="vh vh-lg vh-star"></i><? //}
                        //for($cn=$selfhelp[$i]['rating'];$cn<5;$cn++){ ?><i class="vh vh-lg vh-star-empty"></i><? //} ?>
                     </span>-->
                     <? if(trim($selfhelp[$i]['article_url'])!=''): ?>
                     <? $artUrl = trim(str_replace(' ','-',preg_replace('/\s+/', ' ', strtolower(preg_replace('/[^A-Za-z0-9\-]/', ' ', $selfhelp[$i]['article_url'])))),"-")
                        ?>
                     <? else: ?>
                     <? $artUrl = trim(str_replace(' ','-',preg_replace('/\s+/', ' ', strtolower(preg_replace('/[^A-Za-z0-9\-]/', ' ', $selfhelp[$i]['article_title'])))),"-") ?>
                     <? endif;
                        //
						$database=new class_database();
						include_once(VIS_PATH_CLASS.VIS_CLASS_PREFIX.'selfhelp.php');
						$object=new class_selfhelp($database);
       
						$filter=' article_url='.'"'.$artUrl.'"'.' and language='.VIS_LANGUAGE;
						list($art_info, $art)=$object->get_article($filter, VIS_STAFF_ID, VIS_LOCATION_AREA);  
						if(count($art)>=2):
						
							$lnk='?/selfhelp/view-article/'.$artUrl.'/'.$selfhelp[$i]['article_id'];	
						else:
						
							$lnk='?/selfhelp/view-article/'.$artUrl;
						endif;
						//
                     ?>
                     <div class=" text-ellipsis l-h-1x"><a class="link" href="<?= $lnk;?>"><?= $selfhelp[$i]['article_title']; ?></a></div>
                     <div class="m-t-xs m-r-n">
                        <span class="m-r-md fsize12"><? echo $vis_language['TXTPOSTEDBY']; ?>: <?= (trim($selfhelp[$i]['author_name'])!='')?$selfhelp[$i]['author_name']:$selfhelp[$i]['author']; ?></span>
                        <span class="m-r-md fsize12"><? echo $vis_language['TXTPOSTON']; ?>: <?= format_datetime($selfhelp[$i]['entry_date']); ?></span>
                     </div>
                  </div>
               </li>
               <? } }?>
            </ul>
         </div>
         <? } ?>			  
         <? } ?>
         <?  $topic_count = 0;
            if($forumTopic!=-1) { for($i=0;$i<count($forumTopic);$i++) {$topic_count++; } ?>
         <? if($topic_count > 0) { ?>	
         <div class="panel-heading b-b">
            <h4 class="panel-title1"><? echo $vis_language['TXTFORUMS']; ?> (<? echo ($forumTopic==-1)?0:$topic_count; ?>)</h4>
         </div>
         <div class="panel-body">
            <ul class="list-group  m-b-n no-borders">
               <? if($forumTopic!=-1) for($i=0;$i<count($forumTopic);$i++) {
                  ?>
               <li class="list-group-item">
              
<? if($forumTopic[$i]['image_path']=='' || $forumTopic[$i]['image_path']=='default.jpg'){?>
<div class="l-avatar pull-left m-r">
<? 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 pull-left m-r">
<img src="<? echo VIS_PATH_PROFILE; echo $forumTopic['image_path']; ?>" class="sm img-circle">
</div>
<? }?>

                 <!-- <span class="pull-left thumb-sm m-r"><img  class="img-circle" src="<? //echo VIS_PATH_PROFILE; echo ($forumTopic['image_path']=='')?'default.jpg':$forumTopic['image_path']; ?>" alt=""></span>-->
                  <div class="clear">
                     <? if(trim($forumTopic[$i]['title'])!=''): ?>							
                     <? $artUrl = trim(str_replace(' ','-',preg_replace('/\s+/', ' ', strtolower(preg_replace('/[^A-Za-z0-9\-]/', ' ', $forumTopic[$i]['title'])))),"-") ?>
                     <? endif;?>
                     <span class="pull-left">
								<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/<?= $artUrl."/".$forumTopic[$i]['topic_id']; ?>"><?= $forumTopic[$i]['title']; ?></a></span>
                       <span class="post-overview-count">
									<aside><span style="color: #333333;" class="h5"><? echo $forumTopic[$i]['commentCount']; ?></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 class="m-t-xs m-r-n">
                        <span class="m-r-md fsize12"><? echo $vis_language['TXTPOSTEDBY']; ?>: <?= $forumTopic[$i]['first_name'].' '.$forumTopic[$i]['last_name']; ?></span>
                        <span class="m-r-md fsize12"><? echo $vis_language['TXTPOSTON']; ?>: <?= format_datetime($forumTopic[$i]['creation_date']); ?></span>
                     </div>
                  </div>
               </li>
               <? }?>
            </ul>
         </div>
         <? } }?>
          <?  $ticket_count = 0;
            if($ticket_details!=-1) { for($i=0;$i<count($ticket_details);$i++) {$ticket_count++; } ?>
         <? if($ticket_count > 0) { ?>		
         <div class="panel-heading b-b">
            <h4 class="panel-title1"><?= $vis_language['TXTTICKETS']; ?> (<? echo ($ticket_details==-1)?0:count($ticket_details); ?>)</h4>
         </div>
         <div class="panel-body">
            <ul class="list-group  m-b-n no-borders">
               <? for($i=0;$i<count($ticket_details);$i++){ ?>
               <li class="list-group-item">
                  <? if($ticket_details[$i]['channel_id']<=16 && strstr($ticket_details[$i]['icon_path'], "vh vh-"))
                              {
                                  echo '<span class="pull-left thumb-sm m-r"><i class="'.$ticket_details[$i]['icon_path'].' vh-2x'.'"></i></span>';
                              }
                              else
                              {
                                echo '<span class="pull-left thumb-sm m-r"><img src="'.VIS_PATH_PROFILE.$ticket_details[$i]['icon_path'].'" class="thumb-xs"></span>';
                              }
                   ?>
                  <div class="clear">
                  
                     <span class="vh-yellow m-l-md pull-right">
                           <? for($cn=0;$cn<$ticket_details[$i]['rating'];$cn++){ ?><i class="vh vh-lg vh-star"></i><? }
                              for($cn=$ticket_details[$i]['rating'];$cn<5;$cn++){ ?><i class="vh vh-lg vh-star-empty"></i><? } ?>
                     </span>
                     
                     <div class=" text-ellipsis l-h-1x"><a class="link" href="index.php?/ticket/ticket-details/<? echo $ticket_details[$i]['ticket_hash'].'/'.$ticket_details[$i]['ticket_id']; ?>"><? echo ' <span style="color:gray;" class="font-bold">'.$ticket_details[$i]['ticket_hash'].'</span> - '.$ticket_details[$i]['subject']; ?></a></div>
                     <div class="m-t-xs m-r-n">
                        <ul class="navSeprator no-padder">
                              <li><? echo $vis_language['TXTCREATIONDATE']; ?>: <? echo format_datetime($ticket_details[$i]['receive_date']); ?></li>
                              <li><? echo $vis_language['TXTMODIFIEDON']; ?>: <? echo format_datetime($ticket_details[$i]['modify_date']); ?></li>
                           </ul>
                     </div>
                  </div>
               </li>
               <? } ?>
            </ul>
         </div>
         <?} } if(($ticket_details==-1 && $selfhelp==-1 && $forumTopic==-1) || ($article_count == 0 && $topic_count == 0  && $ticket_count == 0)) echo '<section class="wrapper fullFrame">
            <div class="fullMiddle m-xl text-center h4">'.$vis_language['TXTNOMATCHFOUND'].'</div>
                         </section>';  ?>
      </section>
   </div>
</div>

