<?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); ?>

	<form action="" method="get" class="pj-form form">
		<fieldset class="fieldset white">
			<legend><?php __('lblInstallConfig'); ?></legend>
			<?php
			if(count($tpl['locale_arr']) > 1)
			{ 
				?>
				<p>
					<label class="title"><?php __('lblInstallConfigLocale'); ?></label>
					<select class="pj-form-field w200 pj-install-config" id="install_locale" name="install_locale">
						<option value="">-- <?php __('lblAll'); ?> --</option>
						<?php
						foreach ($tpl['locale_arr'] as $locale)
						{
							?><option value="<?php echo $locale['id']; ?>"><?php echo pjSanitize::html($locale['title']); ?></option><?php
						}
						?>
					</select>
				</p>
				<?php
			} 
			?>
			<p>
				<label class="title"><?php __('lblInstallConfigProduct'); ?></label>
				<span class="inline_block">
					<?php
					if(!empty($tpl['product_arr']))
					{ 
						?>
						<select class="pj-form-field w200 pj-install-config" id="install_product" name="install_product">
							<?php
							foreach ($tpl['product_arr'] as $v)
							{
								?><option value="<?php echo $v['id']; ?>"><?php echo pjSanitize::clean($v['name']); ?></option><?php
							}
							?>
						</select>
						<?php
					} else {
						$message = __('lblNoProductsAdded', true);
						$message = str_replace("{STAG}", '<a href="'.$_SERVER['PHP_SELF'].'?controller=pjAdminProducts&amp;action=pjActionCreate">', $message);
						$message = str_replace("{ETAG}", '</a>', $message);
						?>
						<span class="inline_block t5"><?php echo $message;?></span>
						<?php
					}
					?>
				</span>
			</p>
		</fieldset>
	</form>
	<?php
	if(!empty($tpl['product_arr']))
	{ 
		?>
		<fieldset class="fieldset white pjCasPreview">
			<legend><?php __('lblChooseTheme'); ?></legend>
			<div class="theme-holder pj-loader-outer">
				<?php include PJ_VIEWS_PATH . 'pjAdminOptions/elements/theme.php'; ?>
			</div>
		</fieldset>
		
		<p style="margin: 20px 0 7px; font-weight: bold"><?php __('lblInstallJs1_1'); ?></p>
		<textarea class="pj-form-field textarea_install" id="install_code" style="overflow: auto; height:120px; width: 728px;"></textarea>
	
		<div style="display:none" id="pj_install_clone">&lt;link href="<?php echo PJ_INSTALL_URL.PJ_FRAMEWORK_LIBS_PATH . 'pj/css/'; ?>pj.bootstrap.min.css" type="text/css" rel="stylesheet" /&gt;
&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{LOCALE}{PRODUCT}"&gt;&lt;/script&gt;</div>
			
		<?php
	}
}
?>