<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><?php echo $title;?></title>
<?php $this->load->view('common/meta_tags'); ?>
<?php $this->load->view('common/before_head_close'); ?>
</head>
<body>
<?php $this->load->view('common/after_body_open'); ?>
<!--Site Wraper Start-->
<div class="siteWraper">
  <?php $this->load->view('common/header'); ?>
  <?php if($this->session->userdata('is_user_login')):?>
  	<?php $this->load->view('common/logged_in_bar'); ?>        
  <?php endif;?>  
    <!--Recent Profiles Start-->
	<div class="inner">
        <!--Recent Profiles Start-->
        <div class="leftCol left">
           	<div class="profileWrap">
            	<h1>Search Result</h1> <!--<span class="onlinelast">564 Profiles Found</span>-->
				<div class="searchResult">
                <?php if($all_members_result): ?>
            	<ul class="recomendList">
                	<?php 
						$this->load->model('friend_model');
						foreach($all_members_result as $val):
						if($val->photo)
	  						$image_thumb = base_url().'glancePublic/uploads/member_images/thumb_'.$val->photo;
	  					else
	  						$image_thumb = base_url().'glancePublic/images/no-image.jpg';
						
						if($this->session->userdata('username')) {
							if($this->session->userdata('username') == $val->username) {
								continue;
							}
						}
							
					?>
                    	<li>
                    	<div class="imgbox"><a target="_blank" href="<?php echo base_url(); ?>profile/<?php echo $val->username; ?>"><img src="<?php echo $image_thumb;?>" alt="<?php echo $val->name;?>" /></a></div>
                        <div class="infoProfile">
                        	<h2><a target="_blank" href="<?php echo base_url(); ?>profile/<?php echo $val->username; ?>" title="<?php echo $val->name;?>"><?php echo $val->name;?></a></h2>
                            <p><b>Gender:</b> <?php echo $val->gender;?></p>
                            <p><b>Age:</b> <?php echo count_years($val->dob,date("Y-m-d"));?> yrs</p>
                            <p><?php echo $val->city;?>, <?php echo $val->country;?></p>
                            <?php 
								if($this->session->userdata('username')) {
									
									$isFriend = $this->friend_model->isfriends($this->session->userdata('member_id'),$val->id);
									if(!$isFriend) {
							?>
                            <a href="<?php echo base_url(); ?>friends/send_friend_request/<?php echo my_encrypt($val->id); ?>" class="chatbtn" title="Send Friend Request">Add Friend</a> 
                            <?php } ?>
                            <a href="javascript:;" onclick="setRecieverSession('<?php echo $val->username;?>')" class="chatbtn" title="Send Message"> Message</a>
                            <?php 
								} 
							?>
                          <div class="clear"></div>
                        </div>
                        <div class="clear"></div>
                    </li>
					<?php endforeach;?>
                </ul>
                <?php endif;?>
            </div>
            	
           	  <div class="clear"></div>
            
            </div>
        	
        </div>
        
        <!--Right Col Start-->
       <?php $this->load->view('common/profile_right_side');?>
    <div class="clear"></div>
    </div>
    <!--Recent Profiles Endt-->
  <?php $this->load->view('common/footer'); ?>
</div>
<!--/Site Wraper End-->
<?php $this->load->view('common/after_body_open'); ?>
</body>
</html>
