<?php

	/**
	 * Template für die Einstellungen des Gutscheinprodukt Moduls
	 */

?>
<?php if (!$this->hasMod('wpsg_mod_gutschein')) { ?>
<p class="wpsg_error"><?php echo __('Bitte aktivieren Sie das Gutscheinmodul, damit dieses Modul korrekt funktioniert!', 'wpsg'); ?></p>
<?php } ?>
<div class="wpsg_admin_box" id="wpsg_tab">	
	<div class="head">
		<div class="title">
			<div class="tab" id="tab1"><?php echo __('Einstellungen', 'wpsg'); ?></div>
			<div class="tab" id="tab2"><?php echo __('Textfelder', 'wpsg'); ?></div>
			<div class="wpsg_clear"></div>
		</div>
	</div>
	<div class="content">
		
		<div id="tabcontent1" class="tabcontent">	
			<div class="wpsg_form_field">
				<div class="wpsg_form_left">
					<label><?php echo __('Briefpapier (PDF/JPG)', 'wpsg'); ?>:</label><br />
					<?php if (isset($this->view['bp']) && $this->view['bp'] !== false) { ?>
					<label>
						<input type="checkbox" name="wpsg_mod_voucherproduct_bp_del" value="1" />&nbsp;<?php echo __('Löschen', 'wpsg'); ?>
					</label>
					<?php } ?>
				</div>
				<div class="wpsg_form_right">
					<?php if (!isset($this->view['bp']) || $this->view['bp'] === false) { ?>
					<p><?php echo __('Es wurde bisher kein Briefpapier hochgeladen', 'wpsg'); ?></p>
					<?php } else { ?>
					<a href="<?php echo $this->view['bp']; ?>" target="_blank"><?php echo __('Derzeitiges Briefpapier', 'wpsg'); ?></a>
					<?php } ?>				
					<a style="float:right; position:relative;" class="wpsg_form_help" href="?page=wpsg-Admin&subaction=loadHelp&noheader=1&field=mod_voucherproduct_paper" rel="?page=wpsg-Admin&subaction=loadHelp&noheader=1&field=mod_voucherproduct_paper"></a>
					<input type="file" name="wpsg_mod_voucherproduct_bp">
				</div>
				<div class="wpsg_clear"></div>				
			</div>
			<?php echo wpsg_drawForm_Input('wpsg_voucherproduct_width', __('Breite des PDFs in mm', 'wpsg'), $this->get_option('wpsg_voucherproduct_width'), array ('help' => 'wpsg_voucherproduct_width')); ?>
			<?php echo wpsg_drawForm_Input('wpsg_voucherproduct_height', __('Höhe des PDFs in mm', 'wpsg'), $this->get_option('wpsg_voucherproduct_height'), array ('help' => 'wpsg_voucherproduct_height')); ?>
			<div class="wpsg_form_field">
				<div class="wpsg_form_left">
					<label><?php echo __('Gutscheinmail an Kunden', 'wpsg'); ?>:</label>
				</div>
				<div class="wpsg_form_right">
					<p><?php echo wpsg_translate(__('Kann <a href="#1#">hier</a> konfiguriert werden.', 'wpsg'), WPSG_URL_WP.'wp-admin/admin.php?page=wpsg-Admin&subaction=emailconf#gutscheinproductmail'); ?>
					<a style="float:right; position:relative;" class="wpsg_form_help" href="?page=wpsg-Admin&subaction=loadHelp&noheader=1&field=mod_voucherproduct_mail" rel="?page=wpsg-Admin&subaction=loadHelp&noheader=1&field=mod_voucherproduct_mail"></a></p>
				</div>
				<div class="wpsg_clear"></div>
			</div>
		
		</div>
		
		<div id="tabcontent2" class="tabcontent">
			<table class="wpsg_mod_downloadplus_fieldtable">
				<tr>
					<th class="col_bezeichnung"></th>					
					<th class="col_x"><?php echo __('X', 'wpsg'); ?></th>
					<th class="col_y"><?php echo __('Y', 'wpsg'); ?></th>
					<th class="col_align"><?php echo __('Zentriert', 'wpsg'); ?></th>
					<th class="col_bg"><?php echo __('Hintergrund', 'wpsg'); ?></th>
					<th class="col_color"><?php echo __('Farbe', 'wpsg'); ?></th>
					<th class="col_alpha"><?php echo __('Opaque', 'wpsg'); ?></th>
					<th class="col_angle"><?php echo __('Winkel', 'wpsg'); ?></th>
					<th class="col_groesse"><?php echo __('Größe', 'wpsg'); ?></th>
					<th class="col_action"></th>
				</tr>
				<?php for ($i = 0; $i < 10; $i ++) { ?>
				<tr>
					<td><?php echo '#'.($i + 1); ?></td>					
					<td>
						<input type="text" style="width:100%;" name="text[<?php echo $i; ?>][x]" value="<?php echo wpsg_hspc(wpsg_getStr($this->view['arTexte'][$i]['x'])); ?>" />
					</td>
					<td>
						<input type="text" style="width:100%;" name="text[<?php echo $i; ?>][y]" value="<?php echo wpsg_hspc(wpsg_getStr($this->view['arTexte'][$i]['y'])); ?>" />
					</td>
					<td class="col_align">
						<input type="hidden" name="text[<?php echo $i; ?>][align]" value="0" />
						<input type="checkbox" name="text[<?php echo $i; ?>][align]" value="1" <?php echo ((wpsg_isSizedInt($this->view['arTexte'][$i]['align']))?'checked="checked"':''); ?> />
					</td>
					<td class="col_bg">
						<input type="hidden" name="text[<?php echo $i; ?>][bg]" value="0" />
						<input type="checkbox" name="text[<?php echo $i; ?>][bg]" value="1" <?php echo ((wpsg_isSizedInt($this->view['arTexte'][$i]['bg']))?'checked="checked"':''); ?> />
					</td>
					<td>
						<input type="text" style="width:100%;" name="text[<?php echo $i; ?>][color]" value="<?php echo wpsg_hspc(wpsg_getStr($this->view['arTexte'][$i]['color'])); ?>" />
					</td>
					<td>
						<input type="text" style="width:100%;" name="text[<?php echo $i; ?>][alpha]" value="<?php echo wpsg_hspc(wpsg_getStr($this->view['arTexte'][$i]['alpha'])); ?>" />
					</td>					
					<td>
						<input type="text" style="width:100%;" name="text[<?php echo $i; ?>][angle]" value="<?php echo wpsg_hspc(wpsg_getStr($this->view['arTexte'][$i]['angle'])); ?>" />
					</td>
					<td>
						<select name="text[<?php echo $i; ?>][fontsize]" style="width:100%;">
							<option <?php echo ((wpsg_isSizedInt($this->view['arTexte'][$i]['fontsize'], 4))?'selected="selected"':''); ?> value="4">4</option>
							<option <?php echo ((wpsg_isSizedInt($this->view['arTexte'][$i]['fontsize'], 5))?'selected="selected"':''); ?> value="5">5</option>
							<option <?php echo ((wpsg_isSizedInt($this->view['arTexte'][$i]['fontsize'], 6))?'selected="selected"':''); ?> value="6">6</option>
							<option <?php echo ((wpsg_isSizedInt($this->view['arTexte'][$i]['fontsize'], 7))?'selected="selected"':''); ?> value="7">7</option>
							<option <?php echo ((wpsg_isSizedInt($this->view['arTexte'][$i]['fontsize'], 8))?'selected="selected"':''); ?> value="8">8</option>				
							<option <?php echo ((wpsg_isSizedInt($this->view['arTexte'][$i]['fontsize'], 9))?'selected="selected"':''); ?> value="9">9</option>
							<option <?php echo ((wpsg_isSizedInt($this->view['arTexte'][$i]['fontsize'], 10))?'selected="selected"':''); ?> value="10">10</option>
							<option <?php echo ((wpsg_isSizedInt($this->view['arTexte'][$i]['fontsize'], 11))?'selected="selected"':''); ?> value="11">11</option>
							<option <?php echo ((wpsg_isSizedInt($this->view['arTexte'][$i]['fontsize'], 12))?'selected="selected"':''); ?> value="12">12</option>
							<option <?php echo ((wpsg_isSizedInt($this->view['arTexte'][$i]['fontsize'], 13))?'selected="selected"':''); ?> value="13">13</option>
							<option <?php echo ((wpsg_isSizedInt($this->view['arTexte'][$i]['fontsize'], 14))?'selected="selected"':''); ?> value="14">14</option>
							<option <?php echo ((wpsg_isSizedInt($this->view['arTexte'][$i]['fontsize'], 16))?'selected="selected"':''); ?> value="16">16</option>
							<option <?php echo ((wpsg_isSizedInt($this->view['arTexte'][$i]['fontsize'], 18))?'selected="selected"':''); ?> value="18">18</option>
							<option <?php echo ((wpsg_isSizedInt($this->view['arTexte'][$i]['fontsize'], 20))?'selected="selected"':''); ?> value="20">20</option>
							<option <?php echo ((wpsg_isSizedInt($this->view['arTexte'][$i]['fontsize'], 22))?'selected="selected"':''); ?> value="22">22</option>
							<option <?php echo ((wpsg_isSizedInt($this->view['arTexte'][$i]['fontsize'], 24))?'selected="selected"':''); ?> value="24">24</option>
							<option <?php echo ((wpsg_isSizedInt($this->view['arTexte'][$i]['fontsize'], 26))?'selected="selected"':''); ?> value="26">26</option>
							<option <?php echo ((wpsg_isSizedInt($this->view['arTexte'][$i]['fontsize'], 28))?'selected="selected"':''); ?> value="28">28</option>
							<option <?php echo ((wpsg_isSizedInt($this->view['arTexte'][$i]['fontsize'], 30))?'selected="selected"':''); ?> value="30">30</option>
							<option <?php echo ((wpsg_isSizedInt($this->view['arTexte'][$i]['fontsize'], 32))?'selected="selected"':''); ?> value="32">32</option>
							<option <?php echo ((wpsg_isSizedInt($this->view['arTexte'][$i]['fontsize'], 34))?'selected="selected"':''); ?> value="34">34</option>
						</select>
					</td>
					<td>			
						<label><input type="checkbox" value="1" name="text[<?php echo $i; ?>][aktiv]" <?php echo ((wpsg_isSizedInt($this->view['arTexte'][$i]['aktiv']))?'checked="checked"':''); ?> />&nbsp;<?php echo __("Aktiv", "wpsg"); ?></label>
						<a style="float:right; position:relative;" class="wpsg_form_help" href="?page=wpsg-Admin&subaction=loadHelp&noheader=1&field=mod_pdfdownload_fieldconfig" rel="?page=wpsg-Admin&subaction=loadHelp&noheader=1&field=mod_pdfdownload_fieldconfig"></a>
					</td>
				</tr>
				<tr>
					<td></td>
					<td class="col_freitext_label"><?php echo __('Freitext', 'wpsg'); ?>:</td>
					<td colspan="8" class="col_freitext">
						<input type="text" style="width:100%;" name="text[<?php echo $i; ?>][text]" value="<?php echo wpsg_hspc(wpsg_getStr($this->view['arTexte'][$i]['text'])); ?>" />
					</td>
				</tr>
				<?php } ?>
			</table>
			
			<input type="hidden" name="" id="wpsg-PreviewSubmit" />
			
			<br />
			<input type="submit" name="submit" onclick="wpsg_showPreview(); return false;" class="button" value="<?php echo __('Speichern und Vorschau anzeigen', 'wpsg'); ?>" />
			<br /><br />
			
		</div>
	</div>
</div>

<script type="text/javascript">

	function wpsg_showPreview()
	{

		jQuery('form[name="form1"]').attr('target', 'voucherprview');
		jQuery('#wpsg-PreviewSubmit').attr('name', 'submit-preview');
		
		jQuery('input[name="submit"]:last').click();
		
		jQuery('#wpsg-PreviewSubmit').attr('name', '');
		jQuery('form[name="form1"]').attr('target', '');
		
	} // function wpsg_showPreview()

	jQuery(document).ready(function() {

		jQuery('#wpsg_tab').wpsg_tab( { 
			'cookiename': 'wpsg_pdfdownload_tab',
			'tab2': function() {
				jQuery('.tablink').show();
			}
		} );
		
	} );

</script>