
<main class="content singleRoomWidePage headerImg">
	
	
	
	<section class="singleWideSlider">
		
		
		<?php $slider = get_field('slider'); ?>
		<?php if($slider): ?>
		<div class="roomsWideSlider royalSlider rsDefault">
		
			<?php foreach($slider as $slide): ?>	
			<div class="sliderItem">
				<?php $type = $slide['type']; ?>
				<?php if($type == 'image'):?>
					<?php $image = wp_get_attachment_image_src($slide['image'],'full');  ?>
					<img class="rsImg img-responsive" src="<?php echo $image[0]; ?>" data-rsTmb="<?php echo $image[0]; ?>"  />
				<?php else: ?>
						<?php $videoType = $slide['video_type']; ?>
						<?php if($videoType == 'selfhost'): ?>
							
							<?php $video_poster = wp_get_attachment_image_src($slide['video_poster'],'full'); ?>
								<video preload="none"  poster="<?php  echo $video_poster[0];?>" width="480" height="270">
										<source type="video/mp4" src="<?php echo $slide['video']; ?>">
								</video>
								<div class="rsPlayBtn selfPlay">
										<div class="rsPlayBtnIcon"></div>
								</div>
								
							
						<?php elseif($videoType == 'youtube'): ?>
									<?php 
										$video_id = $slide['video_url']; 
										parse_str( parse_url( $video_id, PHP_URL_QUERY ), $youTubeID );
									?>	
									<?php 
										$poster = "http://img.youtube.com/vi/". $youTubeID['v']."/maxresdefault.jpg";
										if($slide['video_poster']){ 
											
											$poster = wp_get_attachment_image_src($slide['video_poster'],'full'); 
											$poster = $poster[0];
										}
									?>
										
								<img class="rsImg img-responsive" src="<?php echo $poster; ?>" data-rsVideo="<?php echo $video_id; ?>" />
									
						<?php else: ?>
						
								<?php
									$video_id = $slide['video_url']; 
									preg_match('~^http://(?:www\.)?vimeo\.com/(?:clip:)?(\d+)~', $video_id , $vimeoID);
									$link = 'http://vimeo.com/api/v2/video/'.$vimeoID[1].'.php';
									$link = wp_remote_get($link);
									$link = wp_remote_retrieve_body($link);
									$html_returned = unserialize($link);
									$thumb_url = $html_returned[0]['thumbnail_large'];
							
									$poster = $thumb_url;
									if($slide['video_poster']){ 
										
										$poster = wp_get_attachment_image_src($slide['video_poster'],'full'); 
										$poster = $poster[0];
									}
									?>
								
								<img class="rsImg img-responsive" src="<?php echo $poster; ?>" data-rsVideo="<?php echo $video_id; ?>" />
								
						<?php endif; ?>		
				<?php endif; ?>
			</div>
			<?php endforeach; ?>
		</div>
		<?php endif; ?>
		
		<div class="bookingInfo">
			<div class="container">
				<div class="brandBgColor mainColor bookingInfoContent">
					<div class="row">
						<div class="col-md-10 col-sm-10 col-xs-10">
							<h5 class="title titleUp"><?php the_field('room_name'); ?></h5>
							<p><?php the_field('price_label'); ?></p>
						</div>
						<div class="col-md-2 col-sm-2 col-xs-2">
							<?php 
								$redirectClass = 'um_book';
								if(get_field('redirect_to') != "booking"){
									$redirectClass = '';	
								}
							 ?>
							<a href="<?php the_field('shop_link'); ?>" data-postID="<?php echo $post->ID; ?>" class="btn btn-default titleUp <?php echo $redirectClass; ?>"><?php the_field('redirect_title'); ?></a>
						</div>
					</div>
				</div>
			</div>
		</div>
	</section>

	<div class="container">
		<div class="row">
			
			<section class="content">
				<div class="col-md-12">
					<section class="innerContent singleWideRoomContent">
						<div class="row">
							<?php 
								$colMdClass = "col-md-6";								
								if(get_field('disable_attributes')){
									$colMdClass = "col-md-12";
								}
							 ?>
							
							<div class="<?php echo $colMdClass; ?>">						
								<div class="roomsDescription">
									<h5 class="title titleUp bottomGutter"><?php the_field('description_text'); ?></h5>
									<?php wp_reset_postdata(); ?>
									<?php the_content(); ?>
								</div>
							</div>
								<?php if($colMdClass == "col-md-6"): ?>
									
									<div class="col-md-6">
										<h5 class="title titleUp bottomGutter"><?php the_field('attributes_title'); ?></h5>
										
										<?php $attributes = get_field('attributes'); ?>
										<?php if($attributes): ?>
											<table class="um_table">
												<?php foreach($attributes as $attr): ?>
												<tr>
													<td><?php echo $attr['title']; ?></td>
													<td><?php echo $attr['description']; ?></td>
												</tr>
												<?php endforeach; ?>
											</table>
										<?php endif; ?>
									</div>							
								<?php endif; ?>
							</div>	
						</div>
					</section>
				</div>
		
			</section>
		</div>
	</div>

</main>