



<?php echo $finalposition.'~~~'?>


						<div class="moreresults<?php echo $comment[0]['Contentcomment']['content_id']; ?>"></div> 
						 <?php 
						 $ww_root=$this->webroot;
             
                     
                                $wallcommentLike = ClassRegistry::init('Contentcommentlike');
                                
                                $conut='';
                                $arr_comments=$comments;
                                
                              foreach ($comments as $comment):
                              
                              /*echo '<pre>';
                             	 print_r($comment);
                               echo '<pre>';*/
								$total_like2 = sizeof($comment['Contentcommentlike']);
								if(!empty($comment['Contentcommentlike'])):
									foreach ($comment['Contentcommentlike'] as $contentcommentlike):
										if($contentcommentlike['user_id']== $loggedUser['id']):
											$lun2 = 'Liked';
											$fun_n2 = 'unlike_by_wall_id2';
											break;
										else:
											$lun2 = 'Like';
											$fun_n2 = 'like_by_wall_id2';
										endif;
									endforeach;
								else:
									$lun2 = 'Like';
									$fun_n2 = 'like_by_wall_id2';
								endif;
								?>
                                
                            <div class="ccComment brd shdw mrb10 pd10 cbox">
					<?php 
					if($loggedUser['id'] == $comment['Contentcomment']['user_id'] || $blogdetails['Content']['user_id'] == $loggedUser['id']):
					echo '<span class="topright">'.$this->Form->postLink('<i class="fa fa-times"></i>', array('controller'=>'contentcomments','action' => 'delete', $comment['Contentcomment']['id'],$comment['Contentcomment']['content_id']), array('class'=>'','title'=>'Delete','escape'=>false), __('Are you sure you want to delete # %s?', $comment['Contentcomment']['id'])).'</span>';
					endif;
					?>
					
					<div class="row-fluid">
						<div class="span1">
						
						<?php 
						
						 if(!empty($comment['Profile']['link1'])){
						 
						 ?>
						<img class='ih150' src="<?php echo $comment['Profile']['link1'];?>">
						<?php }else {
							echo $this->Html->image('profile.jpg');
						}?>	
						
							
						</div>
						<div class="span11 pdr10 fnt80">
							<span class="profile-name"><?php echo $this->Html->link($comment['Profile']['fname'],array('controller'=>'profiles','action'=>'about',$comment['Profile']['id'])); ?>:</span>
							<?php echo $comment['Contentcomment']['comment'];?>
							
							<div class="divline"></div>
							<div class="tar">
								<span class="fl cash"><?php 
								
								$adte=$comment['Contentcomment']['created'];
								$localtime=timeAgo($comment['Contentcomment']['created']);
								if($localtime=='Hadi'){
									echo getTimeZoneConvert($adte,$timezone);
								}else{
									echo timeAgo($adte);
								}
								
								//echo timeAgo($comment['Contentcomment']['created']); 
								
								
								?></span>
								&nbsp;&nbsp;
								<span onclick="<?php echo $fun_n2?>('../../../../contentcommentlikes',<?php echo $comment['Contentcomment']['id']?>,<?php echo $total_like2?>)" id="<?php echo 'lkunl'.$comment['Contentcomment']['id'] ?>" style="cursor:pointer;">
									<?php echo $lun2.' ('.$total_like2.')' ?>
								</span>	
							</div>
						</div>
					</div>
				</div>
                                        
                                        <?php
                                endforeach;
                        
                        ?>
                                        
                       
                                        <?php 
                                        
                                        function timeAgo($time_ago)
                                        {
                                        	$time_ago = strtotime($time_ago);
                                        	$cur_time   = time();
                                        	$time_elapsed   = $cur_time - $time_ago;
                                        	$seconds    = $time_elapsed ;
                                        	$minutes    = round($time_elapsed / 60 );
                                        	$hours      = round($time_elapsed / 3600);
                                        	$days       = round($time_elapsed / 86400 );
                                        	 
                                        
                                        	// Seconds
                                        	if($seconds <= 60){
                                        
                                        		if($seconds<=10){
                                        			return "just now";
                                        		}
                                        		else{
                                        			return "$seconds seconds ago";
                                        		}
                                        	}
                                        	//Minutes
                                        	else if($minutes <=60){
                                        		if($minutes==1){
                                        			return "one minute ago";
                                        		}
                                        		else{
                                        			return "$minutes minutes ago";
                                        		}
                                        	}
                                        	//Hours
                                        	else if($hours <=24){
                                        		if($hours==1){
                                        			return "an hour ago";
                                        		}else{
                                        			return "$hours hrs ago";
                                        		}
                                        	}
                                        	//Days
                                        
                                        
                                        	else if($days >=1){
                                        		if($days==1){
                                        			return "Yesterday";
                                        		}else{
                                        			return 'Hadi';
                                        		}
                                        
                                        
                                        	}
                                        
                                        
                                        
                                        }
                                        
                                        
                                        ?>