<?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']]);
	}
	
	pjUtil::printNotice(__('infoInstallPreviewTitle', true), __('infoInstallPreviewDesc', true), false, false)
	?>
	<div id="pjTbsInstallPreview">
		<fieldset class="fieldset white">
			<legend><?php __('lblChooseEvent'); ?></legend>
			<br/>
			<form action="" method="get" class="pj-form form">
				<p>
					<label class="title"><?php __('lblEvent');?></label>
					<?php
					$no_events = true;
					$message = __('lblNoEventsAdded', true);
					$message = str_replace("{STAG}", '<a href="'.$_SERVER['PHP_SELF'].'?controller=pjAdminEvents&amp;action=pjActionCreate">', $message);
					$message = str_replace("{ETAG}", '</a>', $message);
					if(!empty($tpl['event_arr']))
					{
						$no_events = false;
						?>
						<span class="inline_block">
							<select id="install_event" name="install_event" class="pj-form-field w300">
								<?php
								foreach($tpl['event_arr'] as $k => $v)
								{ 
									?>
									<option value="<?php echo $v['id']?>"<?php echo isset($_GET['id']) ? ($_GET['id'] == $v['id'] ? ' selected="selected"' : NULL) : NULL;?>><?php echo pjSanitize::html($v['title']);?></option>
									<?php
								} 
								?>
							</select>
						</span>
						<?php
					}else{
						?>
						<span class="inline_block t5"><?php echo $message;?></span>
						<?php
					} 
					?>
				</p>
			</form>
		</fieldset>
		<fieldset class="fieldset white pjTbsPreview" style="display:<?php echo $no_events == true ? 'none' : 'block'; ?>;">
			<legend><?php __('lblChooseTheme'); ?></legend>
			<div class="theme-holder pj-loader-outer">
				<?php include PJ_VIEWS_PATH . 'pjAdminOptions/elements/theme.php'; ?>
			</div>
		</fieldset>
		<fieldset class="fieldset white pjTbsPreview" style="display:<?php echo $no_events == true ? 'none' : 'block'; ?>;">
			<legend><?php __('lblInstallCode'); ?></legend>
			<form action="" method="get" class="pj-form form">
				<p>
					<textarea id="install_code" class="pj-form-field textarea_install" style="overflow: auto; height:100px; width: 695px;"></textarea>
				</p>
			</form>
			<textarea id="install_clone" style="display: none;">&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{ID}" type="text/css" rel="stylesheet" /&gt;
&lt;script type="text/javascript" src="<?php echo PJ_INSTALL_URL; ?>index.php?controller=pjFront&action=pjActionLoad{ID}"&gt;&lt;/script&gt;</textarea>
		</fieldset>
	</div>
	<?php
}
?>