<?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']]);
	}
	?>
	<div id="tabs">
		<ul>
			<li><a href="#tabs-1"><?php __('menuInstall'); ?></a></li>
		</ul>
		<div id="tabs-1" class="form pj-form">
			<?php pjUtil::printNotice(__('lblInstallJs1_title', true), __('lblInstallJs1_body', true), false, false); ?>
			<p>
				<label class="title"><?php __('lblCampaign'); ?></label>
				<span class="inline_block">
					<?php
					if(!empty($tpl['campaign_arr'])) 
					{
						?>
						<select id="campaign_id" name="campaign_id" class="pj-form-field w300 required">
							<option value="">-- <?php __('lblChoose'); ?>--</option>
							<?php
							foreach ($tpl['campaign_arr'] as $k => $v)
							{
								?><option value="<?php echo $v['id']; ?>"><?php echo $v['title']; ?></option><?php
							}
							?>
						</select>
						<?php
					}else{
						if($tpl['cnt'] == 0)
						{
							$message = __('lblNoCampaigns', true, false);
						}else{
							$message = __('lblNoActiveCampaigns', true, false);
						}
						$message = str_replace("[STAG]", '<a href="'.$_SERVER['PHP_SELF'].'?controller=pjAdminCampaigns&amp;action=pjActionCreate">', $message);
						$message = str_replace("[ETAG]", '</a>', $message);
						?><label class="content"><?php echo $message;?></label><?php
					} 
					?>
				</span>
			</p>
			<?php
			if(!empty($tpl['campaign_arr']))
			{ 
				?>
				<p>
					<label class="title">&nbsp;</label>
					<input type="button" id="btnPreview" value="<?php __('btnPreview', false, true); ?>" class="pj-button" />
				</p>
				<?php
			} 
			?>
			<br/>
			
			<textarea class="pj-form-field textarea_install" id="install_code" style="display:none; overflow: auto; height:80px; width: 728px;"></textarea>
<div style="display:none" id="pj_install_clone">&lt;link href="<?php echo PJ_INSTALL_FOLDER; ?>index.php?controller=pjFront&action=pjActionLoadCss" type="text/css" rel="stylesheet" /&gt;
&lt;script type="text/javascript" src="<?php echo PJ_INSTALL_FOLDER; ?>index.php?controller=pjFront&action=pjActionLoad{CAMPAIGN}"&gt;&lt;/script&gt;</div>
		</div>
	</div>
	<?php
}
?>