<?php
if(isset($_GET['year']))
{
	$year = $_GET['year'];
}
$map = array(0 => 'sunday', 1 => 'monday', 2 => 'tuesday', 3 => 'wednesday', 4 => 'thursday', 5 => 'friday', 6 => 'saturday');
?>
<table class="pj-table" cellspacing="0" cellpadding="0" style="width: 100%;">
	<thead>
		<tr>
			<th class="w50p"><?php __('lblWeek');?></th>
			<th class="w50p"><?php __('lblPrice');?></th>
		</tr>
	</thead>
	<tbody>
		<?php
		$firstDayOfYear = mktime(0, 0, 0, 1, 1, $year);
		$nextMonday     = strtotime($map[$tpl['option_arr']['o_week_start']], $firstDayOfYear);
		$nextSunday     = $nextMonday + 6 * 60 * 60 * 24;
		while (date('Y', $nextMonday) == $year) 
		{
			$sql_date = date('Y-m-d', $nextMonday);
			?>
			<tr>
				<td><?php echo date($tpl['option_arr']['o_date_format'], $nextMonday), ' - ', date($tpl['option_arr']['o_date_format'], $nextSunday);?></td>
				<td>
					<span class="pj-form-field-custom pj-form-field-custom-before float_left r10">
						<span class="pj-form-field-before"><abbr class="pj-form-field-icon-text"><?php echo pjUtil::formatCurrencySign(NULL, $tpl['option_arr']['o_currency'], ""); ?></abbr></span>
						<input type="text" name="rental_price[<?php echo $sql_date; ?>]" class="pj-form-field w90 align_right" value="<?php echo isset($tpl['price_arr'][$sql_date]) ? $tpl['price_arr'][$sql_date] : null;?>"/>
					</span>
				</td>
			</tr>
			<?php
			$nextMonday = strtotime('+1 week', $nextMonday);
			$nextSunday = strtotime('+1 week', $nextSunday);
		}
		?>
	</tbody>
</table>