<? global $vis_language; ?>
<section class="chat-list">
<?
if($blabs!=-1) 
{ 
	for($i=0;$i<count($blab_list);$i++)
	{
?>
	  <article class="chat-item chat-item-b left">
   <a href="#" >
   <? if($blab_list[$i]['info']['image_name']==NULL || $blab_list[$i]['info']['image_name']==""  || $blab_list[$i]['info']['image_name']=="default.jpg"){?>
<div class="l-avatar pull-left m-t-lg">
<? if($blab_list[$i]['info']['first_name']!=''){
	$firstname=preg_split('//u', $blab_list[$i]['info']['first_name'], -1, PREG_SPLIT_NO_EMPTY);
$lastname=preg_split('//u', $blab_list[$i]['info']['last_name'], -1, PREG_SPLIT_NO_EMPTY);
	?>
<div class="sm"><? echo ucfirst($firstname[0]).ucfirst($lastname[0]);?></div>
    <? }else{ ?>
    <img class="sm" width="50" height="50" src="<?= VIS_PATH_PROFILE.'default.jpg';?>">
    <? }?>

</div>
<? }else{ ?>
<div class="l-avatar pull-left m-t-lg">
<img src="<? echo VIS_PATH_PROFILE.$blab_list[$i]['info']['image_name']; ?>" class="sm" width="50" height="50">
</div>
<? }?>
</a>
		<!--<a href="#" class="pull-left m-t-lg thumb-sm avatar">
			<img src="<? //echo VIS_PATH_PROFILE.(($blab_list[$i]['info']['image_name']==NULL || $blab_list[$i]['info']['image_name']=="")?'default.jpg':$blab_list[$i]['info']['image_name']); ?>" width="50" height="50" />			
		</a>-->
		<span class="font-bold text-default m-l"><? echo $blab_list[$i]['info']['first_name'].' '.$blab_list[$i]['info']['last_name'] ?></span>
		<small class="text-muted m-l-sm"><?echo format_datetime($blab_list[$i]['info']['entry_date']); ?></small>
		<section class="chat-body m-t-xs">
		  <div class="panel b-light m-b-none">
			<div class="panel-body">
			  <span class="arrow left"></span>
			  <p class="m-b-none"><? echo $blab_list[$i]['info']['content']; ?></p>
			  <? 
				if($blab_list[$i]['attachment']!=-1) {?>		
				<? 
				$img = $attach = "";
				for($j=0;$j<count($blab_list[$i]['attachment']);$j++){
					$blab_attach=$blab_list[$i]['attachment'][$j];	
					if(strpos($blab_attach['file_type'],'image')!== false)
					{ 
						$img.='<span class="thumb-lg m-r-xs m-t-xs"><span class="thumbnail">
									<img src="'.VIS_PATH_FILES.$blab_attach['content'].'" class="bg-white img-responsive" />
							   </span></span>';
					 }
					else
					{
						$attach.='<span class="m-r-xs m-t-xs"><div class="btn-group wrapper-xxs"><a href="?vis_module=export&vis_operation=get_attachment&vis_attachment='.$blab_attach['attachment_id'].'&'.VIS_STAFF_COOKIE.'='.$_COOKIE[VIS_STAFF_COOKIE].'"><label class="btn btn-xs alert-success">'.$blab_attach['file_name'].'</label></a></div>
						</span>';
					}			
				}
					if(($attach!="" && $img!="") || $attach!='')
					{
						echo $img.'<div class="line b-b line-lg pull-in"></div></br>'.$attach;
					}
					else
					{
						echo $img.$attach;
					}
				}  ?> 
			</div>
		  </div>
		</section>
	  </article>
	  <? for($j=0;$j<count($blab_list[$i]['comment']);$j++) 
	  {
			if($blab_list[$i]['comment']!=-1){ ?>
			<? $blab_comment=$blab_list[$i]['comment'][$j]; ?>
				<article class="chat-item left">
     <a href="#" >
   <? if($blab_comment['image_name']==NULL || $blab_comment['image_name']=="" || $blab_comment['image_name']=="default.jpg"){?>
<div class="l-avatar pull-left m-t-lg">
<? if($blab_comment['first_name']!=''){
	$firstname=preg_split('//u', $blab_comment['first_name'], -1, PREG_SPLIT_NO_EMPTY);
$lastname=preg_split('//u', $blab_comment['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';?>" width="36" height="36">
    <? }?>

</div>
<? }else{ ?>
<div class="l-avatar pull-left m-t-lg">
<img src="<? echo VIS_PATH_PROFILE.$blab_comment['image_name']; ?>" class="sm" width="36" height="36">
</div>
<? }?>
</a>

				<!--<a href="#" class="pull-left m-t-lg thumb-sm avatar">
					<img src="<? //echo VIS_PATH_PROFILE.(($blab_comment['image_name']==NULL || $blab_comment['image_name']=="")?'default.jpg':$blab_comment['image_name']); ?>" width="36" height="36" />
				</a>-->
				<span class="font-bold text-default m-l"><? echo $blab_comment['first_name'].' '.$blab_comment['last_name'] ; ?></span>
				<small class="text-muted m-l-sm"><? echo format_datetime($blab_comment['entry_date']); ?>
				</small>
				<section class="chat-body m-t-xs">
				  <div class="panel bg-light dk text-sm m-b-none">
					<div class="panel-body">
					  <span class="arrow left"></span>
					  <p class="m-b-none"><? echo $blab_comment['content']; ?></p>
					</div>
				  </div>
				</section>
			  </article>
			<? }?>
	  <? } ?>	
 <? }} else { include(VIS_PATH_TEMPLATE.'no_record_yet.php');  } ?>
</section>
