<?php
$week_arr = pjUtil::getWeeksOfMonth(date('Y', $_GET['month']), date('n', $_GET['month']), $tpl['option_arr']['o_week_start']);
$months = __('months', true); 
?>
<div class="ylReservationNav">
		<div class="ylColSize1">
			<a class="ylNavMonth" href="#" data-id="<?php echo $_GET['id']?>" data-month="<?php echo $week_arr['prev'] ?>">&lt; <?php __('front_prev');?></a>
		</div><!-- /.ylColSize1 -->

		<div class="ylColSize2">
			<?php echo $months[date('n', $_GET['month'])] . ' ' . date('Y', $_GET['month']);?>
		</div><!-- /.ylColSize2 -->

		<div class="ylColSize3">
			<a class="ylNavMonth" href="#" data-id="<?php echo $_GET['id']?>" data-month="<?php echo $week_arr['next'] ?>"><?php __('front_next');?> &gt;</a>
		</div><!-- /.ylColSize3 -->
	</div>
	<ul class="ylBook">
		<?php
		foreach($week_arr as $k => $v)
		{
			if($k == 'next' || $k == 'prev')
			{
				continue;
			}
			$iso_date = date('Y-m-d', $v['monday']);
			$is_reserved = false;
			$is_avaialble = false;
			if(in_array($iso_date, $tpl['booking_arr']))
			{
				$is_reserved = true;
			}else{
				if(isset($tpl['price_arr'][$iso_date]))
				{
					if($iso_date >= date('Y-m-d'))
					{
						$is_avaialble = true;
					}
				}
			}
			?>
			<li>
				<div class="ylColSize1">
					<strong><?php echo date($tpl['option_arr']['o_date_format'], $v['monday'])?> - <?php echo date($tpl['option_arr']['o_date_format'], $v['sunday'])?></strong>

					<span><?php __('front_week');?> <?php echo $k;?></span>
				</div><!-- /.ylColSize1 -->

				<div class="ylColSize2">
					<strong><?php echo $is_avaialble == true ? pjUtil::formatCurrencySign($tpl['price_arr'][$iso_date], $tpl['option_arr']['o_currency'])  : '&nbsp;'?></strong>

				</div><!-- /.ylColSize2 -->

				<div class="ylColSize3">
					<?php
					if($is_reserved == false)
					{ 
						if($is_avaialble == true)
						{
							?>
							<a href="<?php echo $_SERVER['PHP_SELF']; ?>?controller=pjListings&amp;action=pjActionReserve&amp;id=<?php echo $_GET['id']?>" data-week="<?php echo $v['monday'];?>" class="ylBtn ylBtnTertiary ylBtnReserve"><?php __('front_book_now');?></a>
							<?php
						}else{
							?><em class="ylUnavailable"><?php __('front_not_avaialble');?></em><?php
						}
					}else{
						?><em class="ylReserved"><?php __('front_reserved');?></em><?php
					} 
					?>
				</div><!-- /.ylColSize3 -->
			</li>
			<?php
		} 
		?>
	</ul>