

	<?php 

	foreach ($friends as $friend):
	/*echo '<pre>';
	print_r($friend);
	echo '</pre>';*/
	//pr($friend);
	
	//echo $friend['Courserole']['role'];
	?>
		<li>
			<div class="brd pd5 shdw">
			<div class="row-fluid">
				<div style="height: 72px;width: 72px;overflow: hidden;float: left;">
				
				<?php
				
				$rand=rand(1000,9999);
				 if (!empty($friend['Profile']['link1'])){?>
					<img  src="<?php echo $friend['Profile']['link1'];?>" class="img-responsive icimage2">
					<?php }else {
						echo $this->Html->image('noimagefound.jpg');
					}?>	
											
					
				</div>
				<?php $sname=$friend['Profile']['fname'] . " " . $friend['Profile']['lname'];?>
				<div style="width: 193px;float: left;padding: 0 5px;" class="bold"><?php  echo $this->Html->link($friend['Profile']['fname'].' '. $friend['Profile']['mname'] . ' '. $friend['Profile']['lname'],array('controller'=>'profiles','action'=>'about',base64_encode($friend['Profile']['id']),$rand.$friend['Profile']['id'],base64_encode($sname)))?>
                                <?php 
                                
                                    if($friend['Courserole']['role'] == 2){?>
                                    <p style="font-size: 12px">(Teacher)</p>
                                   <?php }
                                ?>
                                </div>
				
				
				<div style="width: 110px;float: left;">
					
					
					<div>
					
									
					
				
				<?php if($friend['Profile']['id']==$loggedUser['Profile']['id']){?>
												
					<div><?php echo $this->Html->link('View Profile',array('controller'=>'profiles','action'=>'about',base64_encode($friend['Profile']['id']),$rand.$friend['Profile']['id'],base64_encode($sname)),array('style'=>'margin-bottom:5px;'));?></div>
					
				<?php }else{
			    		$pid=$friend['Profile']['id'];
			    	
			    	?>
		    		<?php if($friend['Profile']['id']==$loggedUser['Profile']['id']){?>	
						<div><?php echo $this->Form->postLink(__('Remove'), array('action' => 'delete', $friend['Courserole']['id']),array('confirm' => __('Are you sure you want to remove this student?')));?></div>
					<?php }else{?>
						<div><?php echo $this->Html->link('View Profile',array('controller'=>'profiles','action'=>'about',base64_encode($friend['Profile']['id']),$rand.$friend['Profile']['id'],base64_encode($sname)));?></div>
						<div style="margin-top:5px;margin-bottom:5px;"><?php echo $this->Html->link('Send Message','javascript:void(0);',array('onclick' => "mShowHidemailbox('mCompose','$sname','$pid');"));?></div>
						
						
					<?php }?>
					
					
					<?php 
					
						if($friend['Courserole']['role']==1){
							
							if($ses_datainfo[0]['Courserole']['role'] == array_search('Teacher',$course_user_role)){
							?>
						
							<div><?php echo $this->Form->postLink(__('Remove'), array('action' => 'delete', $friend['Courserole']['id']),array('confirm' => __('Are you sure you want to remove this student?')));?></div>
					<?php
							}
						 }
					 ?>
					 
					
					
				<?php  }?> 	
						
				
					
					</div>
				</div>
			</div>
			</div>
		</li>
	<?php endforeach;?>
	
	
	
	<script type="text/javascript">

$(document).ready(function() {
	 $('#txtProfSrc ').blur(function () {
		 timeout = setTimeout(function() {
			$("#profilelist").hide();
		}, 500);
    });
	$("#txtProfSrc").click(function(event) {
		$("#profilelist").show();
	});
});

function getInivisualProfile(id){
	location.href="<?php echo $this->webroot . 'profiles/about/'?>"+id;

}

function mShowHidemailbox(contentid,sname,pid){
   
	$(".mailPage>div").hide();
	$("#"+contentid).show();
	$("#MailboxTo").val(sname);
	$("#MailboxReceiver").val(pid);
}



</script>
	
	




