<?php
if (isset($tpl['status']))
{
	$status = __('status', true);
	switch ($tpl['status'])
	{
		case 2:
			pjUtil::printNotice(NULL, $status[2]);
			break;
	}
} else {
	$titles = __('error_titles', true);
	$bodies = __('error_bodies', true);
	if (isset($_GET['err']))
	{
		pjUtil::printNotice(@$titles[$_GET['err']], @$bodies[$_GET['err']]);
	}
	?>
	
	<?php pjUtil::printNotice(__('lblInstallJs1_title', true), __('lblInstallJs1_body', true), false, false); ?>
	<div class="form pj-form">
		<p>
			<label class="title"><?php __('lblSelectFloorplan');?></label>
			<span class="inline_block">
				<?php
				if(count($tpl['floorplan_arr']) > 0)
				{ 
					?>
					<select name="floorplan_id" id="floorplan_id" class="pj-form-field w200 required" data-msg-required="<?php __('lblFieldRequired');?>">
						<option value="">-- <?php __('lblChoose'); ?>--</option>
						<?php
						foreach ($tpl['floorplan_arr'] as $k => $v)
						{
							if(isset($_GET['id']))
							{
								if($_GET['id'] == $v['id']){
									?><option value="<?php echo $v['id']; ?>" selected="selected"><?php echo $v['title']; ?></option><?php
								}else{
									?><option value="<?php echo $v['id']; ?>"><?php echo $v['title']; ?></option><?php
								}
							}else{
								?><option value="<?php echo $v['id']; ?>"><?php echo $v['title']; ?></option><?php
							}
						}
						?>
					</select>
					<?php
				}else{
					$message = __('lblNoFloorplansMessage', true);
					$message = str_replace("{STAG}", '<a href="'.$_SERVER['PHP_SELF'].'?controller=pjAdminFloorplans&amp;action=pjActionCreate">', $message);
					$message = str_replace("{ETAG}", '</a>', $message);
					?><label class="block t5"><?php echo $message;?></label><?php
				} 
				?>
			</span>
		</p>
		<?php
		if(count($tpl['floorplan_arr']) > 0 || isset($_GET['id']))
		{
			?>
			<p>
				<label class="title">&nbsp;</label>
				<span class="inline_block">
					<input type="button" value="<?php __('btnPreview'); ?>" class="pj-button pj-button-preview"/>
					<input type="button" value="<?php __('btnGetInstallCode'); ?>" class="pj-button pj-button-get-code"/>
				</span>
			</p>
			<?php
		}
		?>
		<div id="step_container" style="display:<?php echo isset($_GET['id']) ? 'block' : 'none';?>;">
	<textarea class="pj-form-field textarea_install" id="install_code" style="overflow: auto; height:90px; width: 726px;">
&lt;link href="<?php echo PJ_INSTALL_URL; ?>index.php?controller=pjFront&action=pjActionLoadCss" type="text/css" rel="stylesheet" /&gt;
&lt;script type="text/javascript" src="<?php echo PJ_INSTALL_URL; ?>index.php?controller=pjFront&action=pjActionLoad<?php echo isset($_GET['id']) && (int) $_GET['id'] > 0 ? '&floorplan_id=' . $_GET['id'] : NULL ?>"&gt;&lt;/script&gt;</textarea>
		
	<div style="display:none" id="hidden_code">&lt;link href="<?php echo PJ_INSTALL_URL; ?>index.php?controller=pjFront&action=pjActionLoadCss" type="text/css" rel="stylesheet" /&gt;
&lt;script type="text/javascript" src="<?php echo PJ_INSTALL_URL; ?>index.php?controller=pjFront&action=pjActionLoadJS"&gt;&lt;/script&gt;</div>
		</div>
	</div>	
	<?php
}
?>