<?php
/**
* LayerSlider v5.1.2 - Responsive Slideshow Module http://layerslider.webshopworks.com
*
*  @author    WebshopWorks <info@webshopworks.com>
*  @copyright 2015 WebshopWorks
*  @license   One Domain Licence
*/

if (!defined('_PS_VERSION_'))
	exit;

if (!defined('LS_INCLUDE'))
	$ls_defaults = array();

$id = (int)Tools::getValue('id');

$slider = LSSliders::find($id);
$slider = $slider['data'];

if (function_exists( 'wp_enqueue_media' ))
	$upload_class = 'ls-mass-upload';
else
	$upload_class = 'ls-upload';

$ls_screen_options = get_option('ls-screen-options', '0');
$ls_screen_options = ($ls_screen_options == 0) ? array() : $ls_screen_options;
$ls_screen_options = is_array($ls_screen_options) ? $ls_screen_options : unserialize($ls_screen_options);

if (!isset($ls_screen_options['showTooltips']))
	$ls_screen_options['showTooltips'] = 'true';

if (!class_exists('phpQuery'))
{
	libxml_use_internal_errors(true);
	include LS_ROOT_PATH.'/helpers/phpQuery.php';
}

include LS_ROOT_PATH.'/config/defaults.php';
include LS_ROOT_PATH.'/helpers/admin.ui.tools.php';

if (has_filter('layerslider_override_defaults'))
{
	$new_defaults = apply_filters('layerslider_override_defaults', $ls_defaults);
	if (!empty($new_defaults) && is_array($new_defaults))
	{
		$ls_defaults = $new_defaults;
		unset($new_defaults);
	}
}

$settings_tab_class = Tools::getIsset('showsettings') ? 'active' : '';
$slides_tab_class = !Tools::getIsset('showsettings') ? 'active' : '';

if (!isset($slider['layers'][0]['properties']))
	$slider['layers'][0]['properties'] = array();

?>
<div id="ls-screen-options" class="metabox-prefs hidden">
	<div id="screen-options-wrap" class="hidden">
		<form id="ls-screen-options-form" action="<?php echo $_SERVER['REQUEST_URI']?>" method="post">
			<h5><?php _e('Show on screen', 'LayerSlider') ?></h5>
			<label>
				<input type="checkbox" name="showTooltips"<?php echo $ls_screen_options['showTooltips'] == 'true' ? ' checked="checked"' : ''?>> Tooltips
			</label>
		</form>
	</div>
	<div id="screen-options-link-wrap" class="hide-if-no-js screen-meta-toggle">
		<a href="#screen-options-wrap" id="show-settings-link" class="show-settings"><?php _e('Screen Options', 'LayerSlider') ?></a>
	</div>
</div>
<?php include LS_ROOT_PATH.'/views/slider_edit_sample.php'; ?>
<form action="<?php echo $_SERVER['REQUEST_URI']?>" method="post" class="wrap" id="ls-slider-form" novalidate="novalidate">

	<input type="hidden" name="slider_id" value="<?php echo $id ?>">
	<input type="hidden" name="action" value="saveSlider">

	<!-- Title -->
	<h2>
		<?php _e('Editing slider:', 'LayerSlider') ?>
		<?php echo apply_filters('ls_slider_title', $slider['properties']['title'], 35) ?>
		<a href="<?php echo Context::getContext()->link->getAdminLink('AdminLayerSlider') ?>" class="add-new-h2"><?php _e('Back to the list', 'LayerSlider') ?></a>
	</h2>

	<!-- Main menu bar -->
	<div id="ls-main-nav-bar">
		<a href="#" class="settings <?php echo $settings_tab_class ?>">
			<span><?php _e('Slider Settings', 'LayerSlider') ?></span>
		</a>
		<a href="#" class="layers <?php echo $slides_tab_class ?>">
			<span><?php _e('Slides', 'LayerSlider') ?></span>
		</a>
		<a href="#" class="callbacks">
			<span><?php _e('Event Callbacks', 'LayerSlider') ?></span>
		</a>
		<a href="#" class="support right unselectable">
			<span><?php _e('Documentation', 'LayerSlider') ?></span>
		</a>
		<span class="right help"><?php _e('Need help?', 'LayerSlider') ?></span>
		<a href="#" class="clear unselectable"></a>
	</div>

	<!-- Post options -->
	<?php /* include LS_ROOT_PATH.'/views/slider_edit_posts.php'; */ ?>

	<!-- Pages -->
	<div id="ls-pages">

		<!-- Slider Settings -->
		<div class="ls-page ls-settings ls-slider-settings <?php echo $settings_tab_class ?>">
			<?php include LS_ROOT_PATH.'/views/slider_edit_settings.php'; ?>
		</div>

		<!-- Slides -->
		<div class="ls-page <?php echo $slides_tab_class ?>">

			<!-- Slide tabs -->
			<div id="ls-layer-tabs">
				<?php foreach ($slider['layers'] as $key => $layer)
				{?>
				<?php $active = empty($key) ? 'active' : '' ?>
				<a href="#" class="<?php echo $active ?>">Slide #<?php echo ($key + 1) ?><span>x</span></a>
				<?php
				}?>
				<a href="#" class="unsortable" id="ls-add-layer"><?php _e('Add new slide', 'LayerSlider') ?></a>
				<div class="unsortable clear"></div>
			</div>

			<!-- Slides -->
			<div id="ls-layers">
				<?php if (!empty($slider['layers']))
				{?>
				<?php foreach ($slider['layers'] as $key => $layer)
				{?>
				<?php
					$layer_props = !empty($layer['properties']) ? $layer['properties'] : array();
					$active = empty($key) ? 'active' : '';
					$layer_props['background'] = !empty($layer_props['background']) ? $layer_props['background'] : null;
					$layer_props['backgroundId'] = !empty($layer_props['backgroundId']) ? $layer_props['backgroundId'] : null;
					$layer_props['thumbnailId'] = !empty($layer_props['thumbnailId']) ? $layer_props['thumbnailId'] : null;
					$layer_props['thumbnail'] = !empty($layer_props['thumbnail']) ? $layer_props['thumbnail'] : null;
				?>
				<div class="ls-box ls-layer-box <?php echo $active ?>">
					<input type="hidden" name="layerkey" value="0">
					<table>
						<thead class="ls-layer-options-thead">
							<tr>
								<td colspan="7">
									<span id="ls-icon-layer-options"></span>
									<h4>
										<?php _e('Slide Options', 'LayerSlider') ?>
										<a href="#" class="duplicate ls-layer-duplicate"><?php _e('Duplicate this slide', 'LayerSlider') ?></a>
									</h4>
								</td>
							</tr>
						</thead>
						<tbody class="ls-slide-options">
							<input type="hidden" name="post_offset" value="<?php echo isset($layer_props['post_offset']) ? $layer_props['post_offset'] : '-1' ?>">
							<input type="hidden" name="3d_transitions" value="<?php echo isset($layer_props['3d_transitions']) ? $layer_props['3d_transitions'] : '' ?>">
							<input type="hidden" name="2d_transitions" value="<?php echo isset($layer_props['2d_transitions']) ? $layer_props['2d_transitions'] : '' ?>">
							<input type="hidden" name="custom_3d_transitions" value="<?php echo isset($layer_props['custom_3d_transitions']) ? $layer_props['custom_3d_transitions'] : '' ?>">
							<input type="hidden" name="custom_2d_transitions" value="<?php echo isset($layer_props['custom_2d_transitions']) ? $layer_props['custom_2d_transitions'] : '' ?>">
							<tr class="black">
								<td colspan="2" class="right">
									<?php _e('Choose slide image', 'LayerSlider') ?><br>
									<?php _e('or', 'LayerSlider') ?> <a href="#" class="ls-url-prompt"><?php _e('enter URL', 'LayerSlider') ?></a>
								</td>
								<td>
									<input type="hidden" name="backgroundId" value="<?php echo !empty($layer_props['backgroundId']) ? $layer_props['backgroundId'] : '' ?>">
									<input type="hidden" name="background" value="<?php echo !empty($layer_props['background']) ? $layer_props['background'] : '' ?>">
										<div class="ls-image ls-upload" data-help="<?php echo $ls_defaults['slides']['image']['tooltip'] ?>">
											<div><img src="<?php echo apply_filters('ls_get_thumbnail', $layer_props['backgroundId'], $layer_props['background']) ?>" alt=""></div>
											<a href="#">x</a>
										</div>
								</td>
								<td class="right">
									<?php _e('Choose thumbnail', 'LayerSlider') ?><br>
									<?php _e('or', 'LayerSlider') ?> <a href="#" class="ls-url-prompt"><?php _e('enter URL', 'LayerSlider') ?></a>
								</td>
								<td>
									<input type="hidden" name="thumbnailId" value="<?php echo !empty($layer_props['thumbnailId']) ? $layer_props['thumbnailId'] : '' ?>">
									<input type="hidden" name="thumbnail" value="<?php echo !empty($layer_props['thumbnail']) ? $layer_props['thumbnail'] : '' ?>">
									<div class="ls-image ls-upload" data-help="<?php echo $ls_defaults['slides']['thumbnail']['tooltip'] ?>">
										<div><img src="<?php echo apply_filters('ls_get_thumbnail', $layer_props['thumbnailId'], $layer_props['thumbnail']) ?>" alt=""></div>
										<a href="#">x</a>
									</div>
								</td>
								<td class="right"></td>
								<td>
									<span style="margin-left: 25px;"><?php echo $ls_defaults['slides']['delay']['name'] ?></span> <br>
									<?php lsGetInput($ls_defaults['slides']['delay'], $layer_props, array('class' => 'layerprop')) ?> ms
								</td>
							</tr>
							<tr>
								<td class="right"><?php _e('Slide transition', 'LayerSlider') ?></td>
								<td></td>
								<td><button class="button ls-select-transitions new" data-help="<?php _e('You can select your desired slide transitions by clicking on this button.', 'LayerSlider') ?>">Select transitions</button></td>
								<td class="right"><?php echo $ls_defaults['slides']['timeshift']['name'] ?></td>
								<td colspan="3"><?php lsGetInput($ls_defaults['slides']['timeshift'], $layer_props, array('class' => 'layerprop')) ?> ms</td>
							</tr>
							<tr>
								<td class="right"><?php _e('Link this slide', 'LayerSlider'); ?></td>
								<td class="right"><?php echo $ls_defaults['slides']['linkUrl']['name'] ?></td>
								<td colspan="3"><?php lsGetInput($ls_defaults['slides']['linkUrl'], $layer_props, array('class' => 'ls-linkfield')) ?></td>
								<td></td>
								<td><?php lsGetSelect($ls_defaults['slides']['linkTarget'], $layer_props) ?></td>
							</tr>
							<tr>
								<td class="right"><?php _e('Misc', 'LayerSlider') ?></td>
								<td class="right"><?php echo $ls_defaults['slides']['ID']['name'] ?></td>
								<td><?php lsGetInput($ls_defaults['slides']['ID'], $layer_props) ?></td>
								<td class="right"><?php echo $ls_defaults['slides']['deeplink']['name'] ?></td>
								<td><?php lsGetInput($ls_defaults['slides']['deeplink'], $layer_props) ?></td>
								<td class="right"><?php _e('Hidden', 'LayerSlider') ?></td>
								<td><input type="checkbox" name="skip" class="checkbox" <?php echo isset($layer_props['skip']) ? 'checked="checked"' : '' ?> data-help="<?php _e('If you don\'t want to use this slide in your front-page, but you want to keep it, you can hide it with this switch.', 'LayerSlider') ?>"></td>
							</tr>
						</tbody>
					</table>
					<table>
						<thead>
							<tr>
								<td>
									<span id="ls-icon-preview"></span>
									<h4>
										<?php _e('Preview', 'LayerSlider') ?>
										<span class="ls-editor-slider-text">Size:</span>
										<div class="ls-editor-slider"></div>
										<span class="ls-editor-slider-val">100%</span>
									</h4>
								</td>
							</tr>
						</thead>
						<tbody>
							<tr>
								<td class="ls-preview-td">
									<div class="ls-preview-wrapper">
										<div class="ls-preview">
											<div class="draggable ls-layer"></div>
										</div>
										<div class="ls-real-time-preview"></div>
									</div>
									<button class="button ls-preview-button"><?php _e('Enter Preview', 'LayerSlider') ?></button>
								</td>
							</tr>
						</tbody>
					</table>
					<table>
						<thead>
							<tr>
								<td>
									<span id="ls-icon-sublayers"></span>
									<h4><?php _e('Layers', 'LayerSlider') ?><a href="#" class="ls-tl-toggle">[ <?php _e('timeline view', 'LayerSlider') ?> ]</a></h4>
								</td>
							</tr>
						</thead>
						<tbody class="ls-sublayers ls-sublayer-sortable">
							<?php if (!empty($layer['sublayers']))
							{?>
							<?php foreach ($layer['sublayers'] as $key => $sublayer)
							{?>
							<?php $active = (count($layer['sublayers']) == ($key + 1)) ? ' class="active"' : '' ?>
							<?php $title = empty($sublayer['subtitle']) ? 'Layer #'.($key + 1).'' : htmlspecialchars(call_user_func('stripslashes', $sublayer['subtitle'])); ?>
							<tr<?php echo $active ?>>
								<td>
									<div class="ls-sublayer-wrapper">
										<span class="ls-sublayer-sortable-handle dashicons dashicons-menu"></span>
										<span class="ls-sublayer-number"><?php echo ($key + 1) ?></span>
										<input type="text" name="subtitle" class="ls-sublayer-title" value="<?php echo $title ?>">

										<div class="ls-tl">
											<table>
												<tr>
													<td data-help="Delay in: " class="ls-tl-delayin"></td>
													<td data-help="Duration in: " class="ls-tl-durationin"></td>
													<td data-help="Show Until: " class="ls-tl-showuntil"></td>
													<td data-help="Duration out: " class="ls-tl-durationout"></td>
												</tr>
											</table>
										</div>

										<span class="ls-sublayer-controls">
											<span class="ls-highlight dashicons dashicons-lightbulb" data-help="<?php _e('Highlight layer in editor.', 'LayerSlider') ?>"></span>
											<span class="ls-icon-lock dashicons dashicons-lock" data-help="<?php _e('Prevent layer from dragging in editor.', 'LayerSlider') ?>"></span>
											<span class="ls-icon-eye dashicons dashicons-visibility" data-help="<?php _e('Hide layer in editor.', 'LayerSlider') ?>"></span>
										</span>
										<div class="clear"></div>
										<div class="ls-sublayer-nav">
											<a href="#" class="active"><?php _e('Content', 'LayerSlider') ?></a>
											<a href="#"><?php _e('Transition', 'LayerSlider') ?></a>
											<a href="#"><?php _e('Link', 'LayerSlider') ?></a>
											<a href="#"><?php _e('Styles', 'LayerSlider') ?></a>
											<a href="#"><?php _e('Attributes', 'LayerSlider') ?></a>
											<a href="#" title="Remove this layer" class="remove">x</a>
										</div>
										<div class="ls-sublayer-pages">
											<div class="ls-sublayer-page ls-sublayer-basic active">

												<!-- Layer Media Type -->
												<?php
													if (empty($sublayer['media']))
														switch ($sublayer['type'])
														{
															case 'img':
																$sublayer['media'] = 'img';
																break;
															case 'div':
																$sublayer['media'] = 'html';
																break;
															default:
																$sublayer['media'] = 'text';
																break;
														}
													$sublayer['type'] = ($sublayer['type'] == 'span') ? 'p' : $sublayer['type'];
													$sublayer['type'] = ($sublayer['type'] == 'img') ? 'p' : $sublayer['type'];
												?>
												<input type="hidden" name="media" value="<?php echo $sublayer['media'] ?>">
												<div class="ls-layer-kind">
													<ul>
														<li data-section="img"><span class="ls-icon img"></span><?php _e('Image', 'LayerSlider') ?></li>
														<li data-section="text"><span class="ls-icon text"></span><?php _e('Text', 'LayerSlider') ?></li>
														<li data-section="html"><span class="ls-icon video"></span><?php _e('HTML / Video / Audio', 'LayerSlider') ?></li>
													</ul>
												</div>
												<!-- End of Layer Media Type -->

												<!-- Layer Element Type -->
												<input type="hidden" name="type" value="<?php echo $sublayer['type'] ?>">
												<ul class="ls-sublayer-element">
													<li class="ls-type" data-element="p"><span class="ls-icon-p"></span><br><?php _e('Paragraph', 'LayerSlider') ?></li>
													<li class="ls-type" data-element="h1"><span class="ls-icon-h1"></span><br><?php _e('H1', 'LayerSlider') ?></li>
													<li class="ls-type" data-element="h2"><span class="ls-icon-h2"></span><br><?php _e('H2', 'LayerSlider') ?></li>
													<li class="ls-type" data-element="h3"><span class="ls-icon-h3"></span><br><?php _e('H3', 'LayerSlider') ?></li>
													<li class="ls-type" data-element="h4"><span class="ls-icon-h4"></span><br><?php _e('H4', 'LayerSlider') ?></li>
													<li class="ls-type" data-element="h5"><span class="ls-icon-h5"></span><br><?php _e('H5', 'LayerSlider') ?></li>
													<li class="ls-type" data-element="h6"><span class="ls-icon-h6"></span><br><?php _e('H6', 'LayerSlider') ?></li>
												</ul>
												<!-- End of Layer Element Type -->

												<div class="ls-layer-sections">

													<!-- Image Layer -->
													<div class="ls-image-uploader clearfix ls-hidden">
														<?php $sublayer['imageId'] = !empty($sublayer['imageId']) ? $sublayer['imageId'] : null; ?>
														<input type="hidden" name="imageId" value="<?php echo !empty($sublayer['imageId']) ? $sublayer['imageId'] : '' ?>">
														<input type="hidden" name="image" value="<?php echo !empty($sublayer['image']) ? $sublayer['image'] : '' ?>">
														<div class="ls-image ls-upload <?php echo $upload_class ?>">
															<div><img src="<?php echo apply_filters('ls_get_thumbnail', $sublayer['imageId'], $sublayer['image']) ?>" alt=""></div>
															<a href="#">x</a>
														</div>
														<p>
															<?php _e('Click on the image preview to open Media Library or', 'LayerSlider') ?>
															<a href="#" class="ls-url-prompt"><?php _e('insert from URL', 'LayerSlider') ?></a>
														</p>
													</div>

													<!-- Text/HTML Layer -->
													<div class="ls-html-code">
														<textarea name="html" cols="50" rows="5" placeholder="Enter layer content here" data-help="<?php _e('Type here the contents of your layer. You can use any HTML codes in this field to insert other contents then text. This field is also shortcode-aware, so you can insert content from other plugins as well as video embed codes.', 'LayerSlider') ?>"><?php echo call_user_func('stripslashes', $sublayer['html']) ?></textarea>
													</div>

													<!-- Dynamic Layer -->
													<div class="ls-post-section ls-hidden">
														<div class="ls-posts-configured">
															<ul class="ls-post-placeholders clearfix">
																<li><span>[post-id]</span></li>
																<li><span>[post-slug]</span></li>
																<li><span>[post-url]</span></li>
																<li><span>[date-published]</span></li>
																<li><span>[date-modified]</span></li>
																<li><span>[image]</span></li>
																<li><span>[image-url]</span></li>
																<li><span>[title]</span></li>
																<li><span>[content]</span></li>
																<li><span>[excerpt]</span></li>
																<li data-placeholder="<a href=&quot;[post-url]&quot;>Read more</a>"><span>[link]</span></li>
																<li><span>[author]</span></li>
																<li><span>[author-id]</span></li>
																<li><span>[categories]</span></li>
																<li><span>[tags]</span></li>
																<li><span>[comments]</span></li>
															</ul>
															<p>
																<?php _e('Click on one or more post placeholders to insert them into your layer\'s content. Post placeholders are acting like shortcodes in WP, and they will be filled with the actual content from your posts.', 'LayerSlider') ?><br>
																<?php _e('Limit text length (if any)', 'LayerSlider') ?>
																<input type="number" name="post_text_length" value="<?php echo !empty($sublayer['post_text_length']) ? $sublayer['post_text_length'] : '' ?>">
																<button class="button ls-configure-posts"><span class="dashicons dashicons-admin-post"></span><?php _e('Configure post options', 'LayerSlider') ?></button>
															</p>
														</div>
													</div>
												</div>
											</div>
											<div class="ls-sublayer-page ls-sublayer-options">
												<input type="hidden" name="transition">
												<?php
													if (!isset($sublayer['transition']))
													{
														switch ($sublayer['slidedirection'])
														{
															case 'fade':
																$sublayer['fadein'] = true;
																$sublayer['offsetxin'] = '0';
																$sublayer['offsetyin'] = '0';
																break;
															case 'auto':
																$sublayer['offsetxin'] = 'right';
																$sublayer['offsetyin'] = '0';
																break;
															default:
																$sublayer['offsetxin'] = ($sublayer['slidedirection'] == 'left' || $sublayer['slidedirection'] == 'right') ? $sublayer['slidedirection'] : 0;
																$sublayer['offsetyin'] = ($sublayer['slidedirection'] == 'top' || $sublayer['slidedirection'] == 'bottom') ? $sublayer['slidedirection'] : 0;
																break;
														}

														switch ($sublayer['slideoutdirection'])
														{
															case 'fade':
																$sublayer['fadeout'] = true;
																$sublayer['offsetxout'] = '0';
																$sublayer['offsetyout'] = '0';
																break;
															case 'auto':
																if ($sublayer['slidedirection'] == 'fade')
																{
																	$sublayer['fadeout'] = true;
																	$sublayer['offsetxout'] = '0';
																}
																else
																	$sublayer['offsetxout'] = 'right';
																break;
															default:
																$sublayer['offsetxout'] = ($sublayer['slideoutdirection'] == 'left' || $sublayer['slideoutdirection'] == 'right') ? $sublayer['slideoutdirection'] : 0;
																$sublayer['offsetyout'] = ($sublayer['slideoutdirection'] == 'top' || $sublayer['slideoutdirection'] == 'bottom') ? $sublayer['slideoutdirection'] : 0;
																break;
														}

														$sublayer['scalexin'] = $sublayer['scalein'];
														$sublayer['scaleyin'] = $sublayer['scalein'];
														$sublayer['scalexout'] = $sublayer['scaleout'];
														$sublayer['scaleyout'] = $sublayer['scaleout'];
													}

													$sublayer['transition'] = !empty($sublayer['transition']) ? Tools::jsonDecode(call_user_func('stripslashes', $sublayer['transition']), true) : array();
													$sublayer = array_merge($sublayer, $sublayer['transition']);
												?>
												<table>
													<tbody>
														<tr>
															<td rowspan="3"><?php _e('Transition in', 'LayerSlider') ?></td>
															<td class="right"><?php echo $ls_defaults['layers']['transitionInOffsetX']['name'] ?></td>
															<td><?php lsGetInput($ls_defaults['layers']['transitionInOffsetX'], $sublayer, array('class' => 'sublayerprop')) ?></td>
															<td class="right"><?php echo $ls_defaults['layers']['transitionInOffsetY']['name'] ?></td>
															<td><?php lsGetInput($ls_defaults['layers']['transitionInOffsetY'], $sublayer, array('class' => 'sublayerprop')) ?></td>
															<td class="right"><?php echo $ls_defaults['layers']['transitionInDuration']['name'] ?></td>
															<td><?php lsGetInput($ls_defaults['layers']['transitionInDuration'], $sublayer, array('class' => 'sublayerprop')) ?> ms</td>
															<td class="right"><?php echo $ls_defaults['layers']['transitionInDelay']['name'] ?></td>
															<td><?php lsGetInput($ls_defaults['layers']['transitionInDelay'], $sublayer, array('class' => 'sublayerprop')) ?> ms</td>
															<td class="right"><a href="http://easings.net/" target="_blank"><?php echo $ls_defaults['layers']['transitionInEasing']['name'] ?></a></td>
															<td><?php lsGetSelect($ls_defaults['layers']['transitionInEasing'], $sublayer, array('class' => 'sublayerprop', 'options' => $ls_defaults['easings'])) ?></td>
														</tr>
														<tr>
															<td class="right"><?php echo $ls_defaults['layers']['transitionInFade']['name'] ?></td>
															<td><?php lsGetCheckbox($ls_defaults['layers']['transitionInFade'], $sublayer, array('class' => 'sublayerprop')) ?></td>
															<td class="right"><?php echo $ls_defaults['layers']['transitionInRotate']['name'] ?></td>
															<td><?php lsGetInput($ls_defaults['layers']['transitionInRotate'], $sublayer, array('class' => 'sublayerprop')) ?> &deg;</td>
															<td class="right"><?php echo $ls_defaults['layers']['transitionInRotateX']['name'] ?></td>
															<td><?php lsGetInput($ls_defaults['layers']['transitionInRotateX'], $sublayer, array('class' => 'sublayerprop')) ?> &deg;</td>
															<td class="right"><?php echo $ls_defaults['layers']['transitionInRotateY']['name'] ?></td>
															<td><?php lsGetInput($ls_defaults['layers']['transitionInRotateY'], $sublayer, array('class' => 'sublayerprop')) ?> &deg;</td>
															<td colspan="2" rowspan="2" class="center">
																<?php echo $ls_defaults['layers']['transitionInTransformOrigin']['name'] ?><br>
																<?php lsGetInput($ls_defaults['layers']['transitionInTransformOrigin'], $sublayer, array('class' => 'sublayerprop')) ?>
															</td>
														</tr>

														<tr>
															<td class="right"><?php echo $ls_defaults['layers']['transitionInSkewX']['name'] ?></td>
															<td><?php lsGetInput($ls_defaults['layers']['transitionInSkewX'], $sublayer, array('class' => 'sublayerprop')) ?> &deg;</td>
															<td class="right"><?php echo $ls_defaults['layers']['transitionInSkewY']['name'] ?></td>
															<td><?php lsGetInput($ls_defaults['layers']['transitionInSkewY'], $sublayer, array('class' => 'sublayerprop')) ?> &deg;</td>
															<td class="right"><?php echo $ls_defaults['layers']['transitionInScaleX']['name'] ?></td>
															<td><?php lsGetInput($ls_defaults['layers']['transitionInScaleX'], $sublayer, array('class' => 'sublayerprop')) ?></td>
															<td class="right"><?php echo $ls_defaults['layers']['transitionInScaleY']['name'] ?></td>
															<td><?php lsGetInput($ls_defaults['layers']['transitionInScaleY'], $sublayer, array('class' => 'sublayerprop')) ?></td>
														</tr>
														<tr class="ls-separator"><td colspan="11"></td></tr>
														<tr>
															<td rowspan="3"><?php _e('Transition out', 'LayerSlider') ?></td>
															<td class="right"><?php echo $ls_defaults['layers']['transitionOutOffsetX']['name'] ?></td>
															<td><?php lsGetInput($ls_defaults['layers']['transitionOutOffsetX'], $sublayer, array('class' => 'sublayerprop')) ?></td>
															<td class="right"><?php echo $ls_defaults['layers']['transitionOutOffsetY']['name'] ?></td>
															<td><?php lsGetInput($ls_defaults['layers']['transitionOutOffsetY'], $sublayer, array('class' => 'sublayerprop')) ?></td>
															<td class="right"><?php echo $ls_defaults['layers']['transitionOutDuration']['name'] ?></td>
															<td><?php lsGetInput($ls_defaults['layers']['transitionOutDuration'], $sublayer, array('class' => 'sublayerprop')) ?> ms</td>
															<td class="right"><?php echo $ls_defaults['layers']['showUntil']['name'] ?></td>
															<td><?php lsGetInput($ls_defaults['layers']['showUntil'], $sublayer, array('class' => 'sublayerprop')) ?> ms</td>
															<td class="right"><a href="http://easings.net/" target="_blank"><?php echo $ls_defaults['layers']['transitionOutEasing']['name'] ?></a></td>
															<td><?php lsGetSelect($ls_defaults['layers']['transitionOutEasing'], $sublayer, array('class' => 'sublayerprop', 'options' => $ls_defaults['easings'])) ?></td>
														</tr>
														<tr>
															<td class="right"><?php echo $ls_defaults['layers']['transitionOutFade']['name'] ?></td>
															<td><?php lsGetCheckbox($ls_defaults['layers']['transitionOutFade'], $sublayer, array('class' => 'sublayerprop')) ?></td>
															<td class="right"><?php echo $ls_defaults['layers']['transitionOutRotate']['name'] ?></td>
															<td><?php lsGetInput($ls_defaults['layers']['transitionOutRotate'], $sublayer, array('class' => 'sublayerprop')) ?> &deg;</td>
															<td class="right"><?php echo $ls_defaults['layers']['transitionOutRotateX']['name'] ?></td>
															<td><?php lsGetInput($ls_defaults['layers']['transitionOutRotateX'], $sublayer, array('class' => 'sublayerprop')) ?> &deg;</td>
															<td class="right"><?php echo $ls_defaults['layers']['transitionOutRotateY']['name'] ?></td>
															<td><?php lsGetInput($ls_defaults['layers']['transitionOutRotateY'], $sublayer, array('class' => 'sublayerprop')) ?> &deg;</td>
															<td colspan="2" rowspan="2" class="center">
																<?php echo $ls_defaults['layers']['transitionOutTransformOrigin']['name'] ?><br>
																<?php lsGetInput($ls_defaults['layers']['transitionOutTransformOrigin'], $sublayer, array('class' => 'sublayerprop')) ?>
															</td>
														</tr>

														<tr>
															<td class="right"><?php echo $ls_defaults['layers']['transitionOutSkewX']['name'] ?></td>
															<td><?php lsGetInput($ls_defaults['layers']['transitionOutSkewX'], $sublayer, array('class' => 'sublayerprop')) ?> &deg;</td>
															<td class="right"><?php echo $ls_defaults['layers']['transitionOutSkewY']['name'] ?></td>
															<td><?php lsGetInput($ls_defaults['layers']['transitionOutSkewY'], $sublayer, array('class' => 'sublayerprop')) ?> &deg;</td>
															<td class="right"><?php echo $ls_defaults['layers']['transitionOutScaleX']['name'] ?></td>
															<td><?php lsGetInput($ls_defaults['layers']['transitionOutScaleX'], $sublayer, array('class' => 'sublayerprop')) ?></td>
															<td class="right"><?php echo $ls_defaults['layers']['transitionOutScaleY']['name'] ?></td>
															<td><?php lsGetInput($ls_defaults['layers']['transitionOutScaleY'], $sublayer, array('class' => 'sublayerprop')) ?></td>
														</tr>
														<tr class="ls-separator"><td colspan="11"></td></tr>
														<tr>
															<td rowspan="3"><?php _e('Other options', 'LayerSlider') ?></td>
															<td class="right"><?php echo $ls_defaults['layers']['transitionParallaxLevel']['name'] ?></td>
															<td><?php lsGetInput($ls_defaults['layers']['transitionParallaxLevel'], $sublayer, array('class' => 'sublayerprop')) ?></td>
															<td class="right"><?php _e('Hidden', 'LayerSlider') ?></td>
															<td><input type="checkbox" name="skip" class="checkbox" data-help="<?php _e('If you don\'t want to use this layer, but you want to keep it, you can hide it with this switch.', 'LayerSlider') ?>" <?php echo isset($sublayer['skip']) ? 'checked="checked"' : '' ?>></td>
															<td colspan="1"><button class="button duplicate" data-help="<?php _e('If you will use similar settings for other layers or you want to experiment on a copy, you can duplicate this layer.', 'LayerSlider') ?>"><?php _e('Duplicate this layer', 'LayerSlider') ?></button></td>
															<td class="right"><label data-help="<?php _e('If you will use similar transition for a layer, just copy and paste it on the other.', 'LayerSlider') ?>" >Transition settings</label></td>
															<td colspan="2"><a href="javascript:;" onclick="localStorage.lsTransition=jQuery(this.parentNode.parentNode.parentNode).inputsToObj();" class="copy dashicons dashicons-admin-page" data-help="Copy all transition settings"></a>
																							<a href="javascript:;" onclick="jQuery(this.parentNode.parentNode.parentNode).objToInputs(localStorage.lsTransition);" class="paste dashicons dashicons-clipboard" data-help="Paste all transition settings"></a></td>
														</tr>
												</table>
											</div>
											<div class="ls-sublayer-page ls-sublayer-link">
												<table>
													<tbody>
														<tr>
															<td><?php echo $ls_defaults['layers']['linkURL']['name'] ?></td>
															<td class="url"><?php lsGetInput($ls_defaults['layers']['linkURL'], $sublayer) ?></td>
															<td><?php lsGetSelect($ls_defaults['layers']['linkTarget'], $sublayer) ?></td>
														</tr>
													</tbody>
												</table>
											</div>
											<div class="ls-sublayer-page ls-sublayer-style">
												<?php $sublayer['styles'] = !empty($sublayer['styles']) ? Tools::jsonDecode(call_user_func('stripslashes', $sublayer['styles']), true) : array(); ?>
												<input type="hidden" name="styles">
												<table>
													<tbody>
														<tr>
															<td><?php _e('Layout & Positions', 'LayerSlider') ?></td>
															<td class="right"><?php echo $ls_defaults['layers']['width']['name'] ?></td>
															<td><?php lsGetInput($ls_defaults['layers']['width'], $sublayer['styles'], array('class' => 'auto')) ?></td>
															<td class="right"><?php echo $ls_defaults['layers']['height']['name'] ?></td>
															<td><?php lsGetInput($ls_defaults['layers']['height'], $sublayer['styles'], array('class' => 'auto')) ?></td>
															<td class="right"><?php echo $ls_defaults['layers']['top']['name'] ?></td>
															<td><?php lsGetInput($ls_defaults['layers']['top'], $sublayer) ?></td>
															<td class="right"><?php echo $ls_defaults['layers']['left']['name'] ?></td>
															<td><?php lsGetInput($ls_defaults['layers']['left'], $sublayer) ?></td>
														</tr>
														<tr>
															<td><?php _e('Padding', 'LayerSlider') ?></td>
															<td class="right"><?php echo $ls_defaults['layers']['paddingTop']['name'] ?></td>
															<td><?php lsGetInput($ls_defaults['layers']['paddingTop'], $sublayer['styles'], array('class' => 'auto')) ?></td>
															<td class="right"><?php echo $ls_defaults['layers']['paddingRight']['name'] ?></td>
															<td><?php lsGetInput($ls_defaults['layers']['paddingRight'], $sublayer['styles'], array('class' => 'auto')) ?></td>
															<td class="right"><?php echo $ls_defaults['layers']['paddingBottom']['name'] ?></td>
															<td><?php lsGetInput($ls_defaults['layers']['paddingBottom'], $sublayer['styles'], array('class' => 'auto')) ?></td>
															<td class="right"><?php echo $ls_defaults['layers']['paddingLeft']['name'] ?></td>
															<td><?php lsGetInput($ls_defaults['layers']['paddingLeft'], $sublayer['styles'], array('class' => 'auto')) ?></td>
														</tr>
														<tr>
															<td><?php _e('Border', 'LayerSlider') ?></td>
															<td class="right"><?php echo $ls_defaults['layers']['borderTop']['name'] ?></td>
															<td><?php lsGetInput($ls_defaults['layers']['borderTop'], $sublayer['styles'], array('class' => 'auto')) ?></td>
															<td class="right"><?php echo $ls_defaults['layers']['borderRight']['name'] ?></td>
															<td><?php lsGetInput($ls_defaults['layers']['borderRight'], $sublayer['styles'], array('class' => 'auto')) ?></td>
															<td class="right"><?php echo $ls_defaults['layers']['borderBottom']['name'] ?></td>
															<td><?php lsGetInput($ls_defaults['layers']['borderBottom'], $sublayer['styles'], array('class' => 'auto')) ?></td>
															<td class="right"><?php echo $ls_defaults['layers']['borderLeft']['name'] ?></td>
															<td><?php lsGetInput($ls_defaults['layers']['borderLeft'], $sublayer['styles'], array('class' => 'auto')) ?></td>
														</tr>
														<tr>
															<td><?php _e('Font', 'LayerSlider') ?></td>
															<td class="right"><?php echo $ls_defaults['layers']['fontFamily']['name'] ?></td>
															<td><?php lsGetInput($ls_defaults['layers']['fontFamily'], $sublayer['styles'], array('class' => 'auto')) ?></td>
															<td class="right"><?php echo $ls_defaults['layers']['fontSize']['name'] ?></td>
															<td><?php lsGetInput($ls_defaults['layers']['fontSize'], $sublayer['styles'], array('class' => 'auto')) ?></td>
															<td class="right"><?php echo $ls_defaults['layers']['lineHeight']['name'] ?></td>
															<td><?php lsGetInput($ls_defaults['layers']['lineHeight'], $sublayer['styles'], array('class' => 'auto')) ?></td>
															<td class="right"><?php echo $ls_defaults['layers']['color']['name'] ?></td>
															<td><?php lsGetInput($ls_defaults['layers']['color'], $sublayer['styles'], array('class' => 'auto ls-colorpicker')) ?></td>
														</tr>
														<tr>
															<td><?php _e('Misc', 'LayerSlider') ?></td>
															<td class="right"><?php echo $ls_defaults['layers']['background']['name'] ?></td>
															<td><?php lsGetInput($ls_defaults['layers']['background'], $sublayer['styles'], array('class' => 'auto ls-colorpicker')) ?></td>
															<td class="right"><?php echo $ls_defaults['layers']['borderRadius']['name'] ?></td>
															<td><?php lsGetInput($ls_defaults['layers']['borderRadius'], $sublayer['styles'], array('class' => 'auto')) ?></td>
															<td class="right"><?php _e('Word-wrap', 'LayerSlider') ?></td>
															<td colspan="1"><input type="checkbox" name="wordwrap" data-help="<?php _e('If you use custom sized layers, you have to enable this setting to wrap your text.', 'LayerSlider') ?>" class="checkbox"<?php echo isset($sublayer['wordwrap']) ? ' checked="checked"' : '' ?>></td>
															<td class="right"><label data-help="<?php _e('If you will use similar style settings for a layer, just copy and paste it on the other.', 'LayerSlider') ?>" >Style settings</label></td>
															<td colspan="2"><a href="javascript:;" onclick="localStorage.lsStyle=jQuery(this.parentNode.parentNode.parentNode).inputsToObj();" class="copy dashicons dashicons-admin-page" data-help="Copy all style settings"></a>
																							<a href="javascript:;" onclick="jQuery(this.parentNode.parentNode.parentNode).objToInputs(localStorage.lsStyle);" class="paste dashicons dashicons-clipboard" data-help="Paste all style settings"></a></td>
														</tr>
														<tr>
															<td><?php _e('Custom style settings', 'LayerSlider') ?></td>
															<td class="right"><?php _e('Custom styles', 'LayerSlider') ?></td>
															<td colspan="7"><textarea rows="5" cols="50" name="style" class="style" data-help="<?php _e('If you want to set style settings other then above, you can use here any CSS codes. Please make sure to write valid markup.', 'LayerSlider') ?>"><?php echo !empty($sublayer['style']) ? call_user_func('stripslashes', $sublayer['style']) : '' ?></textarea></td>
														</tr>
													</tbody>
												</table>
											</div>
											<div class="ls-sublayer-page ls-sublayer-attributes">
												<table>
													<tbody>
														<tr>
															<td><?php _e('Attributes', 'LayerSlider') ?></td>
															<td class="right"><?php echo $ls_defaults['layers']['ID']['name'] ?></td>
															<td><?php lsGetInput($ls_defaults['layers']['ID'], $sublayer) ?></td>
															<td class="right"><?php echo $ls_defaults['layers']['class']['name'] ?></td>
															<td><?php lsGetInput($ls_defaults['layers']['class'], $sublayer) ?></td>
															<td class="right"><?php echo $ls_defaults['layers']['title']['name'] ?></td>
															<td><?php lsGetInput($ls_defaults['layers']['title'], $sublayer) ?></td>
															<td class="right"><?php echo $ls_defaults['layers']['alt']['name'] ?></td>
															<td><?php lsGetInput($ls_defaults['layers']['alt'], $sublayer) ?></td>
															<td class="right"><?php echo $ls_defaults['layers']['rel']['name'] ?></td>
															<td><?php lsGetInput($ls_defaults['layers']['rel'], $sublayer) ?></td>
														</tr>
													</tbody>
												</table>
											</div>
										</div>
									</div>
								</td>
							</tr>
							<?php
							}
							}?>
						</tbody>
					</table>
					<a href="#" class="ls-add-sublayer"><?php _e('Add new layer', 'LayerSlider') ?></a>
				</div>
				<?php
				}
				}?>
			</div>
		</div>

		<!-- Event Callbacks -->
		<div class="ls-page ls-callback-page">
			<div class="ls-box ls-callback-box">
				<h3 class="header">
					cbInit
					<figure><span>|</span> <?php _e('Fires when LayerSlider has loaded', 'LayerSlider') ?></figure>
				</h3>
				<div>
					<textarea name="cbinit" cols="20" rows="5" class="ls-codemirror"><?php echo !empty($slider['properties']['cbinit']) ? call_user_func('stripslashes', $slider['properties']['cbinit']) : $ls_defaults['slider']['cbInit']['value'] ?></textarea>
				</div>
			</div>

			<div class="ls-box ls-callback-box">
				<h3 class="header">
					cbStart
					<figure><span>|</span> <?php _e('Calling when the slideshow has started.', 'LayerSlider') ?></figure>
				</h3>
				<div>
					<textarea name="cbstart" cols="20" rows="5" class="ls-codemirror"><?php echo !empty($slider['properties']['cbstart']) ? call_user_func('stripslashes', $slider['properties']['cbstart']) : $ls_defaults['slider']['cbStart']['value'] ?></textarea>
				</div>
			</div>

			<div class="ls-box ls-callback-box side">
				<h3 class="header">
					cbStop
					<figure><span>|</span> <?php _e('Calling when the slideshow is stopped by the user.', 'LayerSlider') ?></figure>
				</h3>
				<div>
					<textarea name="cbstop" cols="20" rows="5" class="ls-codemirror"><?php echo !empty($slider['properties']['cbstop']) ? call_user_func('stripslashes', $slider['properties']['cbstop']) : $ls_defaults['slider']['cbStop']['value'] ?></textarea>
				</div>
			</div>

			<div class="ls-box ls-callback-box">
				<h3 class="header">
					cbPause
					<figure><span>|</span> <?php _e('Fireing when the slideshow is temporary on hold (e.g.: "Pause on hover" feaure).', 'LayerSlider') ?></figure>
				</h3>
				<div>
					<textarea name="cbpause" cols="20" rows="5" class="ls-codemirror"><?php echo !empty($slider['properties']['cbpause']) ? call_user_func('stripslashes', $slider['properties']['cbpause']) : $ls_defaults['slider']['cbPause']['value'] ?></textarea>
				</div>
			</div>

			<div class="ls-box ls-callback-box">
				<h3 class="header">
					cbAnimStart
					<figure><span>|</span> <?php _e('Calling when the slider commencing slide change (animation start).', 'LayerSlider') ?></figure>
				</h3>
				<div>
					<textarea name="cbanimstart" cols="20" rows="5" class="ls-codemirror"><?php echo !empty($slider['properties']['cbanimstart']) ? call_user_func('stripslashes', $slider['properties']['cbanimstart']) : $ls_defaults['slider']['cbAnimStart']['value'] ?></textarea>
				</div>
			</div>

			<div class="ls-box ls-callback-box side">
				<h3 class="header">
					cbAnimStop
					<figure><span>|</span> <?php _e('Fireing when the slider finished a slide change (animation end).', 'LayerSlider') ?></figure>
				</h3>
				<div>
					<textarea name="cbanimstop" cols="20" rows="5" class="ls-codemirror"><?php echo !empty($slider['properties']['cbanimstop']) ? call_user_func('stripslashes', $slider['properties']['cbanimstop']) : $ls_defaults['slider']['cbAnimStop']['value'] ?></textarea>
				</div>
			</div>

			<div class="ls-box ls-callback-box">
				<h3 class="header">
					cbPrev
					<figure><span>|</span> <?php _e('Calling when the slider will change to the previous slide by the user.', 'LayerSlider') ?></figure>
				</h3>
				<div>
					<textarea name="cbprev" cols="20" rows="5" class="ls-codemirror"><?php echo !empty($slider['properties']['cbprev']) ? call_user_func('stripslashes', $slider['properties']['cbprev']) : $ls_defaults['slider']['cbPrev']['value'] ?></textarea>
				</div>
			</div>

			<div class="ls-box ls-callback-box">
				<h3 class="header">
					cbNext
					<figure><span>|</span> <?php _e('Calling when the slider will change to the next slide by the user.', 'LayerSlider') ?></figure>
				</h3>
				<div>
					<textarea name="cbnext" cols="20" rows="5" class="ls-codemirror"><?php echo !empty($slider['properties']['cbnext']) ? call_user_func('stripslashes', $slider['properties']['cbnext']) : $ls_defaults['slider']['cbNext']['value'] ?></textarea>
				</div>
			</div>
			<div class="clear"></div>
		</div>
	</div>

	<div class="ls-publish">
		<button class="button button-primary button-hero"><?php _e('Save changes', 'LayerSlider') ?></button>
		<p class="ls-saving-warning"></p>
	</div>
</form>

<script type="text/javascript">
	var lsTrImgPath = '<?php echo __PS_BASE_URI__ ?>modules/layerslider/views/img/base';
	var lsTrCssPath = '<?php echo __PS_BASE_URI__ ?>modules/layerslider/views/css/base';

	var newMediaUploader = false;

	var lsScreenOptions = <?php echo Tools::jsonEncode($ls_screen_options) ?>;
</script>
