<?php
include_once dirname(__FILE__) . '/elements/urlLanguage.php';

$params = $controller->getParams();
?>
<div id="pjWrapperVacationRental">
	<?php
	include_once dirname(__FILE__) . '/elements/menu.php';
	if (isset($params['search']) && $params['search'] === true)
	{
		if (!empty($tpl['option_arr']['o_listing_page']))
		{
			$listingPage = $tpl['option_arr']['o_listing_page'];
		} else {
			$listingPage = $_SERVER['SCRIPT_NAME'];
		}
		
		?>
		<div class="container-fluid pjVrContainer">
			<?php
			include_once dirname(__FILE__) . '/elements/search.php';
			?>
		</div><!-- /.container-fluid pjVrContainer -->
		<?php
	} 
	?>	
	<div class="container-fluid pjVrContainer">
		<div class="pjVrSlider pjVrSliderFeatured">
			<div class="pjVrSliderClip">
				<?php
				if (isset($tpl['arr']) && count($tpl['arr']) > 0)
				{
					?>
					<ul class="list-unstyled pjVrSlides">
						<?php
						foreach ($tpl['arr'] as $v)
						{
							$property_title = pjSanitize::html(stripslashes($v['listing_title']));
							if ($tpl['option_arr']['o_seo_url'] == 'No')
							{
								$url = $_SERVER['SCRIPT_NAME'] . '?controller=pjListings&amp;action=pjActionView&amp;id=' . $v['id'] .(isset($_GET['iframe']) ? '&amp;iframe' : NULL);
							} else {
								$url = $SEO_LANG . $controller->friendlyURL($v['listing_title']) . "-". $v['id'] . ".html";
							}
							$_SESSION[$controller->defaultBackUrl] = pjUtil::getPageURL();
							?>
							<li class="pjVrSlide">
								<a href="<?php echo $url;?>" class="thumbnail pjVrFeatured">
									<h3 class="pjVrFeaturedTitle"><?php echo $property_title;?></h3><!-- /.pjVrFeaturedTitle -->
	
									<div class="pjVrFeaturedImage">
										<img src="<?php echo  (!empty($v['pic']) ? PJ_INSTALL_URL.$v['pic'] : 'https://placehold.it/350x240'); ?>" alt="<?php echo $property_title;?>" />
									</div><!-- /.pjVrFeaturedImage -->
	
									<div class="pjVrFeaturedContent">
										<p><?php echo pjMultibyte::substr(stripslashes(strip_tags($v['listing_description'])), 0, 350); ?>...</p>
	
										<ul class="list-unstyled list-inline pjVrFeaturedMeta">
											<?php
											if (!empty($v['type_title']))
											{
												?>
												<li>
													<dl class="dl-horizontal">
														<dt><?php __('front_index_type'); ?>	</dt>
														<dd><?php echo stripslashes($v['type_title']); ?></dd>
													</dl><!-- /.dl-horizontal -->
												</li>
												<?php
											}
											if (!empty($v['listing_floor_area']))
											{
												$floor = $tpl['option_arr']['o_floor'];
												?>
												<li>
													<dl class="dl-horizontal">
														<dt><?php __('front_index_floor'); ?>	</dt>
														<dd><?php echo pjUtil::showFloor($floor, $v['listing_floor_area'], __('front_view_floor_measure', true)); ?></dd>
													</dl><!-- /.dl-horizontal -->
												</li>
												<?php
											}
											if (!empty($v['listing_bedrooms']))
											{ 
												?>
												<li>
													<dl class="dl-horizontal">
														<dt><?php __('front_index_bedrooms'); ?></dt>
														<dd><?php echo $v['listing_bedrooms']; ?></dd>
													</dl><!-- /.dl-horizontal -->
												</li>
												<?php
											}
											if (!empty($v['listing_bathrooms']))
											{ 
												?>
												<li>
													<dl class="dl-horizontal">
														<dt><?php __('front_index_bathrooms'); ?></dt>
														<dd><?php echo $v['listing_bathrooms'] - (int) $v['listing_bathrooms'] == 0 ? round($v['listing_bathrooms'], 0) : round($v['listing_bathrooms'], 1); ?></dd>
													</dl><!-- /.dl-horizontal -->
												</li>
												<?php
											} 
											?>
										</ul><!-- /.list-unstyled list-inline pjVrFeaturedMeta -->
	
										<div class="pjVrFeaturedActions">
											<button type="button" class="btn btn-default pjVrBtn pjVrBtnPrimary"><?php __('front_button_full_details');?></button>
										</div><!-- /.pjVrFeaturedActions -->
									</div><!-- /.pjVrFeaturedContent -->
								</a><!-- /.thumbnail pjVrFeatured -->
							</li><!-- /.pjVrSlide -->
							<?php
						} 
						?>	
					</ul>
					<?php
				}else{
					__('front_index_empty');
				}
				?>
			</div><!-- /.pjVrSliderClip -->
		</div><!-- /.pjVrSlider pjVrSliderFeatured -->
	</div><!-- /.container-fluid pjVrContainer -->


</div><!-- /#pjWrapper -->
<?php include_once dirname(__FILE__) . '/elements/loadjs.php';?>