<?php
/**
 * Open Source Social Network
 *
 * @package   (softlab24.com).ossn
 * @author    OSSN Core Team <info@softlab24.com>
 * @copyright 2014-2016 SOFTLAB24 LIMITED
 * @license   General Public Licence http://www.opensource-socialnetwork.org/licence
 * @link      https://www.opensource-socialnetwork.org/
 */
if(!empty($params['page']->cover_top)){
	$cover_top = "top:{$params['page']->cover_top};";
}
if(!empty($params['page']->cover_left)){
	$cover_left = "left:{$params['page']->cover_left};";
}
$like = new \Ossn\Component\BusinessPage\Likes;
$total_likes = $like->CountLikes($params['page']->guid);
if(empty($total_likes)){
	$total_likes = 0;	
}
$cats = business_page_categories();
?>


<div class="business-page-cover-controls">
							    

                      
						</div>


<div class="container business-page">
	
		
	

	<div class="row">
	    
	    <div  class="col-md-11">
	        
            
			
	    
	    
	    
<div class="col-md-11">
    
            
					<div id="container" class="business-page-cover">	    
	    
    	                             <div class="dropdown2">
  <?php
if(ossn_isLoggedin()){
if($params['page']->owner_guid == ossn_loggedin_user()->guid || ossn_loggedin_user()->canModerate()){     
?>   
  <button class="dropbtn2"></button>
   
  <div class="dropdown2-content">
    <a href="javascript:void(0);" onclick="Ossn.Clk('.coverfile');" id="change-bpcover-btn">Upload Cover</a>
    <a href="javascript:void(0);" id="reposition-cover-page">Reposition Cover</a>
    <a href="javascript:void(0);" id="save-position-cover-page">Save</a>
    <a href="javascript:void(0);" id="bpage-upload-photo-btn">Upload Photo</a>
    <a href="<?php echo ossn_site_url("feed/action/post/share/{$params['page']->guid}");?>">Share Page</a>
    <a href="<?php echo ossn_site_url("page/edit/{$params['page']->guid}");?>">Edit Page</a>
    <a href="<?php echo ossn_site_url("action/bpage/delete?guid={$params['page']->guid}", true);?>">Delete Page</a>
  
  
  <?php
				
							echo ossn_view_form('bpage/photo', array(
									'action' => ossn_site_url('action/bpage/photo/add'),
									'params' => $params,
									'id' => 'upload-photo-page',
						 	 ));
				?>
  
  
  </div>
</div>



<?php }
}?> 



</div>




        </div>
        
        
          
        <div  class="col-md-11">
             
           <div class="user-activity">    
                   
        <div class="top-container3">
            			<div id="container" class="business-page-cover">
					    <meta name="viewport" content="width=device-width, initial-scale=1.0">
             <img class="logo-page" src="<?php echo $params['page']->photoURL();?>" />
            
             </div>
               <div class="business-page top-container">
      <div id="container" class="business-page-cover">
        
          
				
					  
	  
                        <?php
						echo ossn_view_form('bpage/cover', array(
								'action' => ossn_site_url('action/bpage/cover/add'),
								'params' => $params,
								'id' => 'upload-cover-page',
					 	 ))
						?>
						<img id="draggable" class="business-page-cover-img" src="<?php echo $params['page']->coverURL();?>" data-guid="<?php echo $params['page']->guid;?>" style='<?php echo $cover_top; ?><?php echo $cover_left; ?>' />
					</div>
					
					<div class="user-fullname"><?php echo $params['page']->title;?></div>
                    <div class="user-fullname business-page-role"><?php echo $cats[$params['page']->category];?></div>
                    <div class="user-fullname business-page-info">
                    	<?php if(!empty($params['page']->phone)){ ?>
                    	<li><i class="fa fa-phone-square"></i><?php echo $params['page']->phone;?></li>
                        <?php } ?>
                    	<?php if(!empty($params['page']->address)){ ?>
                    	<li><i class="fa fa-location-arrow"></i><?php echo $params['page']->address;?></li>
                         <?php } ?>
                    	<?php if(!empty($params['page']->website)){ 
							   $urlw = false;
							   if(filter_var($params['page']->website, FILTER_VALIDATE_URL)){
								   	$urlw = $params['page']->website;
							   } elseif(strpos($params['page']->website, ".") !== false){
								   	$urlp = parse_url($params['page']->website);
									$count = count($urlp);
									if(isset($urlp['path']) && !empty($urlp['path']) && $count === 1){
										$urlw = "http://{$urlp['path']}/";
									}
							   }	
							   if(!empty($urlw)){
						?>                       
                    	<li><i class="fa fa-link"></i><a style="color:#fff;text-decoration:none;" href="<?php echo $urlw;?>" target="_blank"><?php echo $urlw;?></a></li>
                        <?php
							   }
						} ?>
                    </div>
                    	
                   
                   	</div>
                   	<div class="top-container4">
                    <div id="business-page-hr-menu" class="business-page-hr-menu">
                          
							<div class="row business-page-metadata">
							             	  
                            	<div class="col-md-9">
                                
                                	
                                		
                                		<div class="business-page-desc">
                                		            <div class="post-contents">
                                		    <p class="addReadMore showlesscontent">
                            			<?php echo $params['page']->description;?>
                            			</p>
                            		
                            	
                            			 </div>
                           			 </div>	    
                                		       
                                		            	
                                		   
                                </div>
                                <div class="col-md-3 page-likes">
                                		    <?php
							if(ossn_isLoggedin()){
									if($params['page']->owner_guid == ossn_loggedin_user()->guid || ossn_loggedin_user()->canModerate()){     
							?>
						
                            <?php } ?>
                            <?php if(!$like->isLiked($params['page']->guid, ossn_loggedin_user()->guid)){ ?>
                        	<a href="javascript:void(0);" class="page-likes like-page" data-guid="<?php echo $params['page']->guid;?>">
								<i class="fa fa-thumbs-up"></i><?php echo $total_likes;?>
                            </a>             
                            <?php } else { ?>
                        	<a href="javascript:void(0);" class="page-likes  unlike-page " data-guid="<?php echo $params['page']->guid;?>">
								<i class="fa fa-thumbs-up"></i><?php echo $total_likes;?>
                            </a>                            
                            <?php }
							}?> 
                                </div>
                            </div>
                    </div>
	</div>
			
				</div>
            
                <?php echo ossn_plugin_view('bpage/view/bottom', $params); ?>
        </div>
    
 </div>
     

