page-video.php 5.37 KB
<?php
/*
* Template Name:  Default Video
*/
?>
<?php get_header(); ?>
<div id="page-content">

    <?php if (has_post_thumbnail($post->ID)): ?>
        <?php $image = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'full-post-thumbnail');
        $img_id = get_post_thumbnail_id($post->ID);
        $alt_text = get_post_meta($img_id, '_wp_attachment_image_alt', true);

        $videoEnableValue = get_field('enable_video', $post->ID, true);
        $enableVideo = !empty($videoEnableValue);
		?>

		<div id="content-image" style='z-index:0;'>
		<?php	if($enableVideo) : ?>
				<?php
					$videoType = get_field('video_type', $post->ID, true);
					$videoId = get_field('video_id', $post->ID, true);
				?>
				<div id="content-image">
					<a href="#" class="video-play-button page-video-button link-lightbox" data-videoid="<?php echo $videoId; ?>" data-videosite="<?php echo $videoType; ?>">
						<span class="play-arrow">Play button</span>
					</a>
					<img src="<?php echo $image[0]; ?>" width="1024" height="575" alt="<?php echo $alt_text; ?>" />
				</div>
			<?php else : ?>
				<div id="content-image">
					<img src="<?php echo $image[0]; ?>" width="1024" height="575" alt="<?php echo $alt_text; ?>" />
				</div>
			<?php endif; ?>

			<div id="transparency-content">
				<?php the_field('transparency_content'); ?>
			</div>
		</div>
		<div id='has-image'>
			<div class="breadcrumbs">
				<?php if (function_exists('bcn_display')) {
					bcn_display();
				} ?>
			</div>
			<?php get_template_part('loop', 'page'); ?>
			<div class="siblings mobile-show">
				<?php
				if($post->post_parent) {
					$children = wp_list_pages("title_li=&sort_column=menu_order&child_of=".$post->post_parent."&echo=0");
					$titlenamer = get_the_title($post->post_parent);
				}
				else {
					$children = wp_list_pages("title_li=&sort_column=menu_order&child_of=".$post->ID."&echo=0");
					$titlenamer = get_the_title($post->ID);
				}
				if ($children) { ?>
				<ul>
					<li class="<?php echo $post->post_parent ? '' : 'current_page_item'; ?>"><a href="<?php echo get_permalink($post->post_parent); ?>"><?php echo $titlenamer; ?></a></li>
					<?php echo $children; ?>
				</ul>
				<?php } ?>
			</div>
		</div>
<?php else : ?>
	<?php if(is_page('broker-private-page')){?>
	
	<?php global $userAccessManager;
		  global $wpdb;
	if (isset($userAccessManager)) {
		$iUserId = $user_ID;
		$is_no_bar=false;
		
		$aUserGroupsForUser = $wpdb->get_results( $wpdb->prepare( "
				SELECT wp_uam_accessgroup_to_object.object_id, wp_uam_accessgroup_to_object.object_type, wp_uam_accessgroup_to_object.group_id 
				FROM wp_uam_accessgroup_to_object INNER JOIN wp_uam_accessgroups ON wp_uam_accessgroup_to_object.group_id=wp_uam_accessgroups.ID
				WHERE wp_uam_accessgroups.groupname = '%s' AND wp_uam_accessgroup_to_object.object_id = %d
				ORDER BY wp_uam_accessgroup_to_object.object_id DESC
			",'rating.thecommonwell.ca/auth/authenticate', $iUserId ) );
      
		//error_log(print_r($aUserGroupsForUser,true));
		
	
		
		foreach ($aUserGroupsForUser as $oGroup) {
		//	  error_log($oGroup);
			if ($oGroup->group_id =="3"){
				$is_no_bar=true;
			}
		}
		
	}//end of  $userAccessManager 
	if(current_user_can('administrator')){$is_no_bar=true;} 
	if($is_no_bar == true){
	
	?>
	  <div class="promer-banner">
		  <div class="promer-text">GIVE “WAVE” A TRY</div>
		  <div class="promer-button"><a href="http://rating.thecommonwell.ca" class="rating-engine-link-button" target="_blank">COMMERCIAL RATING TOOL</a></div>
	  </div>
	<div id="no-image" class="promer-no-image">  
	<?php } else{?>  <div id="no-image"> <?php }
	
			}else{?>
	<!-- If there is no image for content page -->
	<div id="no-image">
	<?php }//end of broker-private-page?>
		<div class="siblings mobile-hide">
			<?php
			if($post->post_parent) {
				$children = wp_list_pages("title_li=&sort_column=menu_order&child_of=".$post->post_parent."&echo=0");
				$titlenamer = get_the_title($post->post_parent);
			}
			else {
				$children = wp_list_pages("title_li=&sort_column=menu_order&child_of=".$post->ID."&echo=0");
				$titlenamer = get_the_title($post->ID);
			}
			if ($children) { ?>
			<ul>
				<li class="<?php echo $post->post_parent ? '' : 'current_page_item'; ?>"><a href="<?php echo get_permalink($post->post_parent); ?>"><?php echo $titlenamer; ?></a></li>
				<?php echo $children; ?>
			</ul>
			<?php } ?>
		</div>
		<div class="breadcrumbs">
			<?php if (function_exists('bcn_display')) {
				bcn_display();
			} ?>
		</div>
		<?php get_template_part('loop', 'page'); ?>
		<div class="siblings mobile-show">
			<?php
			if($post->post_parent) {
				$children = wp_list_pages("title_li=&sort_column=menu_order&child_of=".$post->post_parent."&echo=0");
				$titlenamer = get_the_title($post->post_parent);
			}
			else {
				$children = wp_list_pages("title_li=&sort_column=menu_order&child_of=".$post->ID."&echo=0");
				$titlenamer = get_the_title($post->ID);
			}
			if ($children) { ?>
			<ul>
				<li class="<?php echo $post->post_parent ? '' : 'current_page_item'; ?>"><a href="<?php echo get_permalink($post->post_parent); ?>"><?php echo $titlenamer; ?></a></li>
				<?php echo $children; ?>
			</ul>
			<?php } ?>
		</div>
	</div>
<?php endif; ?>
<script type="text/javascript">
    (function($) {
        $(document).ready(function() {
            $('.link-lightbox').simpleLightboxVideo();
        });
    })(jQuery);
</script>
</div>
<?php //get_sidebar(); ?>
<?php get_footer(); ?>