<?php

	/**
	 * Template für die Einstellungsseite des Videodownloadproduktmoduls
	 */

?>
<br />
<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="tab tabright tabright-last" id="tab3"><?php echo __('Info', 'wpsg'); ?></div>
			<div class="wpsg_clear"></div>
		</div>
	</div>
	<div class="content">
		
		<div id="tabcontent1" class="tabcontent">			
			<?php echo wpsg_drawForm_Input('wpsg_mod_videodownload_command', __('Programmaufruf', 'wpsg'), $this->get_option('wpsg_mod_videodownload_command'), array('help' => 'mod_videodownload_einstellungen_programmaufruf')); ?>
			<?php echo wpsg_drawForm_Input('wpsg_mod_videodownload_infocommand', __('Programmaufruf (ffmpeg -i)', 'wpsg'), $this->get_option('wpsg_mod_videodownload_infocommand'), array('help' => 'mod_videodownload_einstellungen_programminfoaufruf')); ?>		
			<?php echo wpsg_drawForm_Input('wpsg_mod_videodownload_filename', __('Personalisierter Dateiname', 'wpsg'), $this->get_option('wpsg_mod_videodownload_filename'), array('help' => 'mod_videodownload_einstellungen_filename')); ?>
			<?php echo wpsg_drawForm_Select('wpsg_mod_videodownload_indiv_mode', __('Individualisierung planen', 'wpsg'), array(0 => __('Manuell', 'wpsg'), 1 => __('Nach Zahlung', 'wpsg'), 2 => __('Nach Bestellung', 'wpsg')), $this->get_option('wpsg_mod_videodownload_indiv_mode'), array('help' => 'mod_videodownload_einstellungen_individualisierungsmodus')); ?>
			<?php echo wpsg_drawForm_Checkbox('wpsg_mod_videodownload_autosend', __('Videos nach Individualisierung sofort senden', 'wpsg'), $this->get_option('wpsg_mod_videodownload_autosend'), array('help' => 'mod_videodownload_einstellungen_autosend')); ?>
			<?php echo wpsg_drawForm_Select('wpsg_mod_videodownload_accepted', __('Gültigkeit von Links', 'wpsg'), array(0 => __('Unbegrenzt', 'wpsg'), 1 => __('Nach Downloads', 'wpsg'), 2 => __('Nach Tagen', 'wpsg')), $this->get_option('wpsg_mod_videodownload_accepted'), array('help' => 'mod_videodownload_einstellungen_accepted')); ?>
			<?php echo wpsg_drawForm_Input('wpsg_mod_videodownload_days', __('Gültigkeit in Tagen', 'wpsg'), $this->get_option('wpsg_mod_videodownload_days')); ?> 
			<?php echo wpsg_drawForm_Input('wpsg_mod_videodownload_downloads', __('Anzahl an möglichen Downloads', 'wpsg'), $this->get_option('wpsg_mod_videodownload_downloads')); ?>
			<?php echo wpsg_drawForm_Checkbox('wpsg_mod_videodownload_cleanraiddownloads', __('Abgelaufene Downloads bereinigen', 'wpsg'), $this->get_option('wpsg_mod_videodownload_cleanraiddownloads')); ?>
			<?php echo wpsg_drawForm_Input('wpsg_mod_videodownload_cleanolddownloads', __('Downloads nach X Tagen löschen', 'wpsg'), $this->get_option('wpsg_mod_videodownload_cleanolddownloads')); ?>
			<?php echo wpsg_drawForm_Input('wpsg_mod_videodownload_videopath', __('Pfad für die Videos der Produkte', 'wpsg'), $this->get_option('wpsg_mod_videodownload_videopath'), array('hint' => __('Standard: uploads/wpsg_videoprodukte/', 'wpsg'))); ?>
			<?php echo wpsg_drawForm_Input('wpsg_mod_videodownload_videoindivpath', __('Pfad für die Individualisierten Videos', 'wpsg'), $this->get_option('wpsg_mod_videodownload_videoindivpath'), array('hint' => __('Standard: uploads/wpsg_videoprodukte_order/', 'wpsg'))); ?>
			<?php echo wpsg_drawForm_Select('wpsg_mod_videodownload_format', __('Auslieferungsformat', 'wpsg'), array(0 => __('Direkt', 'wpsg'), 1 => __('Gezippt (intern)', 'wpsg'), 2 => __('Gezippt (extern)', 'wpsg')), $this->get_option('wpsg_mod_videodownload_format')); ?>
			<?php echo wpsg_drawForm_Input('wpsg_mod_videodownload_fontpath', __('Pfad für die weitere Schriftarten', 'wpsg'), $this->get_option('wpsg_mod_videodownload_fontpath'), array('hint' => __('Standard: user_views/mods/mod_videodownload/fonts/', 'wpsg'))); ?>
			<div class="wpsg_form_field">
				<div class="wpsg_form_left">
					<label><?php echo __('Mail für Individualisierungsbericht', '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#videodownloadcronmail'); ?></p>
				</div>
				<div class="wpsg_clear"></div>
			</div>			
			<div class="wpsg_form_field">
				<div class="wpsg_form_left">
					<label><?php echo __('Mail für Downloads 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#videodownloadfiles'); ?></p>
				</div>
				<div class="wpsg_clear"></div>
			</div>
			<div class="wpsg_form_field">
				<div class="wpsg_form_left">
					<label><?php echo __('Letzte Ausführung des Crons', 'wpsg'); ?>:</label>
				</div>
				<div class="wpsg_form_right">
					<p><?php echo (($this->get_option('wpsg_lastCron') > 0)?wpsg_formatTimestamp($this->get_option('wpsg_lastCron')):__('Noch nicht ausgeführt', 'wpsg')); ?></p>
					<a rel="?page=wpsg-Admin&subaction=loadHelp&noheader=1&field=mod_videodownload_einstellungen_cron" class="wpsg_form_help" href="?page=wpsg-Admin&subaction=loadHelp&noheader=1&field=mod_videodownload_einstellungen_cron"></a>
				</div>
				<div class="wpsg_clear"></div>
			</div>
		</div>
		
		<div id="tabcontent2" class="tabcontent">
		
			<table class="wpsg_mod_videodownload_fieldtable">
				<tr>
					<th class="col_bezeichnung"></th>
					<th class="col_font"><?php echo __('Schriftart', 'wpsg'); ?></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_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 < 5; $i ++) { ?>				
				<tr>
					<td><?php echo '#'.($i + 1); ?></td>
					<td class="col_font">
						<?php if (!wpsg_isSizedArray($this->view['arFonts'])) { ?>
						<span class="wpsg_error"><?php echo __('Keine Fonts!', 'wpsg'); ?></span>
						<?php } else { ?>
						<select name="text[<?php echo $i; ?>][font]">
							<?php foreach ($this->view['arFonts'] as $font) { ?>
							<option value="<?php echo rawurlencode($font); ?>" <?php echo ((rawurlencode($font) === $this->view['arTexte'][$i]['font'])?'selected="selected"':''); ?>><?php echo wpsg_hspc($font); ?></option>
							<?php } ?>
						</select>
						<?php } ?>
					</td>					
					<td>
						<input type="text" style="width:100%;" name="text[<?php echo $i; ?>][x]" value="<?php echo wpsg_hspc($this->view['arTexte'][$i]['x']); ?>" />
					</td>
					<td>
						<input type="text" style="width:100%;" name="text[<?php echo $i; ?>][y]" value="<?php echo wpsg_hspc($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 (($this->view['arTexte'][$i]['align'] == '1')?'checked="checked"':''); ?> />
					</td>
					<td>
						<input type="text" style="width:100%;" name="text[<?php echo $i; ?>][color]" value="<?php echo wpsg_hspc($this->view['arTexte'][$i]['color']); ?>" />
					</td>
					<td>
						<input type="text" style="width:100%;" name="text[<?php echo $i; ?>][alpha]" value="<?php echo wpsg_hspc($this->view['arTexte'][$i]['alpha']); ?>" />
					</td>					
					<td>
						<input type="text" style="width:100%;" name="text[<?php echo $i; ?>][angle]" value="<?php echo wpsg_hspc($this->view['arTexte'][$i]['angle']); ?>" />
					</td>
					<td>
						<select name="text[<?php echo $i; ?>][fontsize]" style="width:100%;">
							<option <?php echo (($this->view['arTexte'][$i]['fontsize'] == "8")?'selected="selected"':''); ?> value="8">8</option>				
							<option <?php echo (($this->view['arTexte'][$i]['fontsize'] == "9")?'selected="selected"':''); ?> value="9">9</option>
							<option <?php echo (($this->view['arTexte'][$i]['fontsize'] == "10")?'selected="selected"':''); ?> value="10">10</option>
							<option <?php echo (($this->view['arTexte'][$i]['fontsize'] == "11")?'selected="selected"':''); ?> value="11">11</option>
							<option <?php echo (($this->view['arTexte'][$i]['fontsize'] == "12")?'selected="selected"':''); ?> value="12">12</option>
							<option <?php echo (($this->view['arTexte'][$i]['fontsize'] == "13")?'selected="selected"':''); ?> value="13">13</option>
							<option <?php echo (($this->view['arTexte'][$i]['fontsize'] == "14")?'selected="selected"':''); ?> value="14">14</option>
							<option <?php echo (($this->view['arTexte'][$i]['fontsize'] == "16")?'selected="selected"':''); ?> value="16">16</option>
							<option <?php echo (($this->view['arTexte'][$i]['fontsize'] == "18")?'selected="selected"':''); ?> value="18">18</option>
							<option <?php echo (($this->view['arTexte'][$i]['fontsize'] == "20")?'selected="selected"':''); ?> value="20">20</option>
							<option <?php echo (($this->view['arTexte'][$i]['fontsize'] == "22")?'selected="selected"':''); ?> value="22">22</option>
							<option <?php echo (($this->view['arTexte'][$i]['fontsize'] == "24")?'selected="selected"':''); ?> value="24">24</option>
						</select>
					</td>
					<td>			
						<label><input type="checkbox" value="1" name="text[<?php echo $i; ?>][aktiv]" <?php echo (($this->view['arTexte'][$i]['aktiv'] == 1)?'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_videodownload_fieldconfig" rel="?page=wpsg-Admin&subaction=loadHelp&noheader=1&field=mod_videodownload_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($this->view['arTexte'][$i]['text']); ?>" />
					</td>
				</tr>
				<?php } ?>
			</table>
			
		</div>
		
		<div id="tabcontent3" class="tabcontent">
		
			<p><?php echo __('Mit dem Videodownload Modul ist es möglich Videos zu verkaufen die pro Bestellung individuell angepasst werden.', 'wpsg'); ?>
		
		</div>
		
	</div>
</div>

<script type="text/javascript">

	function wpsg_mod_videodownload_switchAccepted()
	{

		if (jQuery('#wpsg_mod_videodownload_accepted').val() == '1')
			jQuery('#wpsg_mod_videodownload_downloads').parent().parent().show();
		else
			jQuery('#wpsg_mod_videodownload_downloads').parent().parent().hide();
		
		if (jQuery('#wpsg_mod_videodownload_accepted').val() == '2')
			jQuery('#wpsg_mod_videodownload_days').parent().parent().show();
		else
			jQuery('#wpsg_mod_videodownload_days').parent().parent().hide();
		
	} // function wpsg_mod_videodownload_switchAccepted()

	jQuery(document).ready(function() {

		jQuery('.wpsg_form_help').tipTip();

		jQuery('#wpsg_mod_videodownload_accepted').bind('change', function() { wpsg_mod_videodownload_switchAccepted(); } );

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

</script>