<? global $vis_language; ?>
<section class="panel bg-white">
	<? if(!empty($notifications)){ ?>
		<div class="panel-heading b-light bg-light"> <strong><?= $vis_language['TXTSTAFFNOTIFICATION'];?></strong></div>
		<div class="list-group<? if(count($notifications) > 6) echo ' search_result_list'?>">
	<?	for($i=0; $i<count($notifications); $i++){
			if($notifications[$i]['module_id'] == 3){ //Client
				$image = is_file(VIS_PATH_PROFILE.$notifications[$i]['image_path']) ? (VIS_PATH_PROFILE.$notifications[$i]['image_path']) : (VIS_PATH_PROFILE.'default.jpg');
				?>
				<a href="#/client/client_details/<?= $notifications[$i]['first_name'].' '.$notifications[$i]['last_name'] ?>/<?= ($notifications[$i]['parent_id']==0)?$notifications[$i]['client_id']:$notifications[$i]['parent_id']; ?>" class="media list-group-item" id="client"  data-client-id="<?= ($notifications[$i]['parent_id']==0)?$notifications[$i]['client_id']:$notifications[$i]['parent_id']; ?>">
    <? if(is_file(VIS_PATH_PROFILE.$notifications[$i]['image_path']) && $notifications[$i]['image_path']!='default.jpg'){?>
<div class="l-avatar pull-left">
<img src="<?=VIS_PATH_PROFILE.$notifications[$i]['image_path']?>" class="sm">
</div>
<? }else{ ?>
<div class="l-avatar pull-left">
<? if($notifications[$i]['first_name']!=''){
	$firstname=preg_split('//u', $notifications[$i]['first_name'], -1, PREG_SPLIT_NO_EMPTY);
$lastname=preg_split('//u', $notifications[$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>
<? }?>
				<!--<span class="pull-left thumb-sm"> <img src="<?= $image?>" alt="..." class="img-circle"> </span>-->
				<span class="media-body block m-b-none"><? echo (($notifications[$i]['operation_id'] == 10) ? $vis_language['TXTNEWCLIENT'] : '').' : '.stripslashes($notifications[$i]['first_name'].' '.$notifications[$i]['last_name'].' - '.$notifications[$i]['email']) ?></span>
			</a>
			<? }
			if($notifications[$i]['module_id'] == 2){ // ticket ?>
				<a style="display: block;" href="#/ticket/ticket_details/<?= addslashes($notifications[$i]['ticket_hash']).'/'.$notifications[$i]['ticket_id']?>" class="media list-group-item" data-ticket-id="<?= $notifications[$i]['ticket_id']?>" id="ticket">
					<span class="pull-left thumb-sm text-center">
						    <? if($notifications[$i]['channel_id']<=23 && strstr($notifications[$i]['icon_path'], "vh vh-"))
								{
									echo '<span class="pull-left thumb-sm m-r"><i class="'.$notifications[$i]['icon_path'].' vh-2x'.'"></i></span>';
								}
								else
								{
								  
									if(file_exists(VIS_PATH_PROFILE.$notifications[$i]['icon_path']))
										echo '<span class="pull-left thumb-sm m-r"><img src="'.VIS_PATH_PROFILE.$notifications[$i]['icon_path'].'" class="thumb-xs"></span>';
									else
										echo '<span class="pull-left thumb-sm m-r"><i class="vh vh-channel vh-2x"></i></span>';
								}
							?>
					</span>
					<span class="media-body block m-b-none"><? echo (($notifications[$i]['operation_id'] == 1 || $notifications[$i]['operation_id'] == 2) ? $vis_language['TXTNEWTICKET'] : (($notifications[$i]['operation_id'] == 3)?$vis_language['TXTNEWSTAFFREPLY']:$vis_language['TXTCLIENTREPLY'])).' : '.addslashes($notifications[$i]['ticket_hash']).' - '.($notifications[$i]['subject']); ?></span>
				</a>
			<? }
			if(VIS_MODULE_ACCESS_SELFHELP==1){
			if($notifications[$i]['module_id'] == 4){ // selfhelp
				$image = is_file(VIS_PATH_PROFILE.$notifications[$i]['image_name'])?(VIS_PATH_PROFILE.$notifications[$i]['image_name']):(VIS_PATH_PROFILE.'default.jpg'); ?>
				<a href="#/selfhelp/view_selfhelp/<? echo $vis_language['TXTSELFHELP']; ?>/" class="media list-group-item">
				<span class="pull-left thumb-sm"><i class="vh vh-2x vh-self-help vh-red"></i> </span>
				<span class="media-body block m-b-none"><? echo (($notifications[$i]['operation_id'] == 7 || $notifications[$i]['operation_id'] == 2) ? $vis_language['TXTNEWARTICLE'] : $vis_language['TXTNEWCOMMENT']).' : '.substr(strip_tags($notifications[$i]['content']), 0, 40).(($notifications[$i]['is_client'] == 1)?(' - '.$notifications[$i]['first_name'].' '.$notifications[$i]['last_name'] ):''); ?></span>
			</a>
			<? } }
			if(VIS_MODULE_ACCESS_BLABBER==1){
			if($notifications[$i]['module_id'] == 6){ // blab
				$image = is_file(VIS_PATH_PROFILE.$notifications[$i]['image_name']) ? (VIS_PATH_PROFILE.$notifications[$i]['image_name']) : (VIS_PATH_PROFILE.'default.jpg');
				?>
				<a href="#/blabber/view_blabs/Blabs/<?= $notifications[$i]['blab_id']?>" class="media list-group-item">
					<span class="pull-left thumb-sm"><i class="vh vh-2x vh-blab vh-blue"></i> </span>
					<span class="media-body block m-b-none"><? echo (($notifications[$i]['operation_id'] == 5 ) ? $vis_language['TXTNEWBLAB'] : $vis_language['TXTNEWCOMMENT']).' : '.substr(strip_tags($notifications[$i]['content']), 0, 40).' - '.$notifications[$i]['first_name'].' '.$notifications[$i]['last_name']; ?></span>
				</a>
			<? } }
			if(VIS_MODULE_ACCESS_TASK==1){
			if($notifications[$i]['module_id'] == 1){ // task assigned
				if($notifications[$i]['operation_id'] == 11){
				?>
				<a href="#/home/view_update_tasks/1/<?= $notifications[$i]['task_id'];?>" class="media list-group-item">
					<span class="pull-left thumb-sm"><i class="vh vh-2x vh-checkbox vh-info"></i> </span>
					<span class="media-body block m-b-none"><? echo $vis_language["TXTTASKASSIGNED"]." : ".$notifications[$i]['task_title']; ?></span>
				</a>
			<? } else if($notifications[$i]['operation_id'] == 12){ // task comment?>
				<a href="#/home/view_update_tasks/1/<?= $notifications[$i]['task_id'];?>" class="media list-group-item">
					<span class="pull-left thumb-sm"><i class="vh vh-2x vh-checkbox vh-info"></i> </span>
					<span class="media-body block m-b-none"><? echo $vis_language["TXTTASKCOMMENT"]." : ".$notifications[$i]['content']; ?></span>
				</a>
			<? }}
			}
			if(VIS_MODULE_ACCESS_BILLING==1){
			if($notifications[$i]['module_id'] == 5){ // order
				if($notifications[$i]['operation_id'] == 13){	?>
				<!--<a data-modal-arguments="vis_module=billing&vis_operation=get_update_order&vis_order_id=<?= $notifications[$i]['order_id'];?>&vis_static_area=vis_order_list_form&vis_page=" data-toggle="ajaxModal"  href="javascript:void(0);" class="media list-group-item"> -->
				<a href="#/billing/get_orders/<? echo $vis_language['TXTORDERS']; ?>" class="media list-group-item">
					<span class="pull-left thumb-sm"><i class="vh vh-2x vh-billing vh-green"></i> </span>
					<span class="media-body block m-b-none"><? echo $vis_language["TXTNEWORDER"]." : (".$notifications[$i]['order_hash'].")"; ?></span>
				</a>
			<? }}
			}
			if(VIS_MODULE_ACCESS_FORUMS==1){
			if($notifications[$i]['operation_id'] == 15 && $notifications[$i]['title']!=''){ // add forum topic ?>
				<a href="#/forums/topic_details/<?= $notifications[$i]['title'];?>/<?= $notifications[$i]['topic_id'];?>" class="media list-group-item">
				<span class="pull-left thumb-sm"><i class="vh vh-2x vh-staff-group vh-green"></i> </span>
				<span class="media-body block m-b-none"><? echo $vis_language['TXTNEWTOPIC'].' : '.substr(strip_tags($notifications[$i]['title']), 0, 40); ?></span>
			</a>
			<? }
			if($notifications[$i]['operation_id'] == 16 && $notifications[$i]['content']!=''){ // add forum topic comment ?>
				<a href="#/forums/topic_details/<?= $notifications[$i]['title'];?>/<?= $notifications[$i]['topic_id'];?>" class="media list-group-item">
				<span class="pull-left thumb-sm"><i class="vh vh-2x vh-staff-group vh-green"></i> </span>
				<span class="media-body block m-b-none"><? echo $vis_language['TXTNEWTOPICCOMMENT'].' : '.substr(strip_tags($notifications[$i]['content']), 0, 40); ?></span>
			</a>
			<? } 
			 }
		}//for
  ?>
		</div>
<?	}//if
else { ?>
<div class="panel-heading b-light bg-light"> <strong><?= $vis_language['TXTNOTHINGTODISPLAY']?></strong></div>
<? } ?>
</section>
<script>$("#vis_notify_count").html("");</script>
