<?php
if($updatesarray_notification) {
   // For each array notification and user details
   foreach($updatesarray_notification as $data_noti) {
	 $kks=''; // This is for css class 
     $n_msg_id=$data_noti['msg_id']; 
	 $n_orimessage=$data_noti['message'];
	 $n_message=htmlcode($n_orimessage);
	 $n_message=nameFilter($n_message,45);
	 $n_time=$data_noti['created'];
	 $n_mtime=date("c", $n_time);
	 $n_msg_group_id=$data_noti['group_id_fk'];
	 $n_msg_suid=$data_noti['uid_fk'];
	 $n_session_data_suid=$Mat->User_Details($n_msg_suid);
	 $n_msg_suid_username=$n_session_data_suid['username'];
	 $n_msg_owneruid=$data_noti['ouid_fk'];
	 $n_session_data_owneruid=$Mat->User_Details($n_msg_owneruid);
	 $n_msg_owneruid_username=$n_session_data_owneruid['username'];
	 $n_type=$data_noti['type'];
	 $n_face=$Mat->User_Profilepic($n_msg_suid,$base_url);
	   /*if($n_msg_group_id>0) {
		   $BlogDetails=$Mat->Blog_Details($n_msg_group_id);
		   $n_msg_group_name=$BlogDetails['blog_name'];
		   $n_msg_group_name=nameFilter($n_msg_group_name,25);
		 }*/
		 // Notification stype started here
		 // There are 5 different notification types
		 if($n_type=='5') {
			 // If follower updated the status
			$n_type='<b>'.$n_msg_group_name.'</b> updated status';
			// Status div class for notifications
			$kks='ShowStatus';
		  } else if($n_type=='4') {
			  $n_type='is following your Group. <b>'.$n_msg_group_name.'</b>';
		  } else if($n_type=='3') {
			  // If any user following you then you can see this message with his name
		     $n_type='following you.';
		  } else if($n_type=='2') {
			  // If your follower or other user commented your status 
			  // Then you can see this notification with status div class
			  $n_type='commented';
			  $kks='ShowStatus';
          } else if($n_type=='1') {
			  // If your follower or other user likes your status
			  // Then you can see this notification with status div class
			  $n_type='liked';
		      $kks='ShowStatus';
		  } else{
		      $n_type='shared';
		      $kks='ShowStatus';
	      }
          if($uid!=$n_msg_owneruid)
{
$second_user=  "<b>".$Mat->UserFullName($n_msg_owneruid_username)."</b>'s";
}
else
{
$second_user= "<b>Your</b>";
} if($n_msg_id) {
	           $notification_url=$n_msg_id;
		  }else if($n_msg_group_id) {
	              $notification_url=$base_url.'groups/'.$n_msg_group_id;
		  } else {
		      $notification_url=$base_url.$n_msg_suid_username;
		  }
?>
<a href="<?php echo $notification_url;?>" class="noti_a <?php echo $kks;?>" data-id="<?php echo $notification_url;?>">
<div class="noti_smbody" id="<?php echo $n_time; ?>">
<div class="noti_smimg">
<img src="<?php echo $n_face;?>" class='noti_face' alt='<?php echo htmlspecialchars($Mat->UserFullName($n_msg_suid_username)); ?>'  original-title='<?php echo htmlspecialchars($Mat->UserFullName($n_msg_suid_username)); ?>' />
</div>
<div class="noti_smtext">
  <div class="noti_smtext_in">
    <div class="noti_username"><?php echo $Mat->UserFullName($n_msg_suid_username); ?></div>
    <div class="notif_smat">
<?php 
 if($n_msg_owneruid_username) {
     echo $second_user; 
  }
?>  
<?php echo $n_type; ?>
</div>
  </div>
  <div class="notification_message_and_time">
<?php 
if($n_message) {
    echo htmlspecialchars($n_message); 
 }
?> 
<span class="timeago ntime" title='<?php echo $n_mtime; ?>'></span></div>
</div>
</div>
</a>
<?php
}
} else {
   echo '<h4 id="noupdates">No more notifications</h4>';
}
?>
