<?php /* Smarty version 2.6.26, created on 2017-04-13 17:35:48
         compiled from /home3/bargaip4/public_html/gevimmo/plugins/importExportCategories/admin/importExportCategories.tpl */ ?>
<?php require_once(SMARTY_CORE_DIR . 'core.load_plugins.php');
smarty_core_load_plugins(array('plugins' => array(array('modifier', 'cat', '/home3/bargaip4/public_html/gevimmo/plugins/importExportCategories/admin/importExportCategories.tpl', 16, false),array('modifier', 'replace', '/home3/bargaip4/public_html/gevimmo/plugins/importExportCategories/admin/importExportCategories.tpl', 69, false),)), $this); ?>
<!-- export import categories tpl -->

<!-- navigation bar -->
<div id="nav_bar">
	<?php if ($_GET['action'] == 'import' || ! isset ( $_GET['action'] )): ?>
	<a href="<?php echo $this->_tpl_vars['rlBaseC']; ?>
action=export" class="button_bar"><span class="left"></span><span class="center_export"><?php echo $this->_tpl_vars['lang']['importExportCategories_export']; ?>
</span><span class="right"></span></a>
	<?php endif; ?>
	<?php if ($_GET['action'] == 'export' || ! isset ( $_GET['action'] )): ?>
	<a href="<?php echo $this->_tpl_vars['rlBaseC']; ?>
action=import" class="button_bar"><span class="left"></span><span class="center_import"><?php echo $this->_tpl_vars['lang']['importExportCategories_import']; ?>
</span><span class="right"></span></a>
	<?php endif; ?>
</div>
<!-- navigation bar end -->

<?php if (! isset ( $_GET['action'] )): ?>

	<?php $_smarty_tpl_vars = $this->_tpl_vars;
$this->_smarty_include(array('smarty_include_tpl_file' => ((is_array($_tmp=((is_array($_tmp='blocks')) ? $this->_run_mod_handler('cat', true, $_tmp, @RL_DS) : smarty_modifier_cat($_tmp, @RL_DS)))) ? $this->_run_mod_handler('cat', true, $_tmp, 'm_block_start.tpl') : smarty_modifier_cat($_tmp, 'm_block_start.tpl')), 'smarty_include_vars' => array()));
$this->_tpl_vars = $_smarty_tpl_vars;
unset($_smarty_tpl_vars);
 ?>
	<img src="<?php echo @RL_PLUGINS_URL; ?>
importExportCategories/admin/static/example.png" alt="" title="" />
	<div class="clear"></div>
	<?php $_smarty_tpl_vars = $this->_tpl_vars;
$this->_smarty_include(array('smarty_include_tpl_file' => ((is_array($_tmp=((is_array($_tmp='blocks')) ? $this->_run_mod_handler('cat', true, $_tmp, @RL_DS) : smarty_modifier_cat($_tmp, @RL_DS)))) ? $this->_run_mod_handler('cat', true, $_tmp, 'm_block_end.tpl') : smarty_modifier_cat($_tmp, 'm_block_end.tpl')), 'smarty_include_vars' => array()));
$this->_tpl_vars = $_smarty_tpl_vars;
unset($_smarty_tpl_vars);
 ?>

	<script type="text/javascript">
	<?php echo '
		printMessage(\'info\', \'Your XLS file must be like on the example.\');
	'; ?>

	</script>

<?php elseif ($_GET['action'] == 'import'): ?>
	<?php if (! $_SESSION['imex_plugin']): ?>

		<?php $_smarty_tpl_vars = $this->_tpl_vars;
$this->_smarty_include(array('smarty_include_tpl_file' => ((is_array($_tmp=((is_array($_tmp='blocks')) ? $this->_run_mod_handler('cat', true, $_tmp, @RL_DS) : smarty_modifier_cat($_tmp, @RL_DS)))) ? $this->_run_mod_handler('cat', true, $_tmp, 'm_block_start.tpl') : smarty_modifier_cat($_tmp, 'm_block_start.tpl')), 'smarty_include_vars' => array()));
$this->_tpl_vars = $_smarty_tpl_vars;
unset($_smarty_tpl_vars);
 ?>
		<form action="<?php echo $this->_tpl_vars['rlBaseC']; ?>
action=import" method="post" enctype="multipart/form-data" onsubmit="return submit_form();">
		<input type="hidden" name="submit" value="1" />
			<table class="form">
			<tr>
				<td class="name">
					<span class="red">*</span><?php echo $this->_tpl_vars['lang']['importExportCategories_importTo']; ?>

				</td>
				<td class="field">
					<select name="listing_type">
						<?php $_from = $this->_tpl_vars['listing_types']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['typeKey'] => $this->_tpl_vars['type']):
?>
						<option value="<?php echo $this->_tpl_vars['type']['Key']; ?>
"><?php echo $this->_tpl_vars['type']['name']; ?>
</option>
						<?php endforeach; endif; unset($_from); ?>
					</select>
				</td>
			</tr>
			<tr>
				<td class="name">
					<span class="red">*</span><?php echo $this->_tpl_vars['lang']['file']; ?>

				</td>
				<td class="field">
					<input type="file" class="file" name="file_import" />
				</td>
			</tr>
			<tr>
				<td></td>
				<td class="field">
					<input class="submit" type="submit" value="<?php echo $this->_tpl_vars['lang']['importExportCategories_import']; ?>
" />
				</td>
			</tr>
			</table>
		</form>
		<?php $_smarty_tpl_vars = $this->_tpl_vars;
$this->_smarty_include(array('smarty_include_tpl_file' => ((is_array($_tmp=((is_array($_tmp='blocks')) ? $this->_run_mod_handler('cat', true, $_tmp, @RL_DS) : smarty_modifier_cat($_tmp, @RL_DS)))) ? $this->_run_mod_handler('cat', true, $_tmp, 'm_block_end.tpl') : smarty_modifier_cat($_tmp, 'm_block_end.tpl')), 'smarty_include_vars' => array()));
$this->_tpl_vars = $_smarty_tpl_vars;
unset($_smarty_tpl_vars);
 ?>

		<script type="text/javascript">
		<?php echo '
			var submit_form = function() {
				var importFile = $(\'[name=file_import]\').val();
				if ( importFile == \'\' ) {
					printMessage(\'error\', \''; ?>
<?php echo ((is_array($_tmp=$this->_tpl_vars['lang']['importExportCategories_import_filename_empty'])) ? $this->_run_mod_handler('replace', true, $_tmp, "[field]", $this->_tpl_vars['lang']['file']) : smarty_modifier_replace($_tmp, "[field]", $this->_tpl_vars['lang']['file'])); ?>
<?php echo '\');
					return false;
				}
				else {
					if ( importFile.split(\'.\').pop() != \'xls\' ) {
						printMessage(\'error\', \''; ?>
<?php echo $this->_tpl_vars['lang']['importExportCategories_incorrect_file_ext']; ?>
<?php echo '\');
						return false;
					}
				}
				return true;
			}
		'; ?>

		</script>

	<?php else: ?>

	<?php $_smarty_tpl_vars = $this->_tpl_vars;
$this->_smarty_include(array('smarty_include_tpl_file' => ((is_array($_tmp=((is_array($_tmp='blocks')) ? $this->_run_mod_handler('cat', true, $_tmp, @RL_DS) : smarty_modifier_cat($_tmp, @RL_DS)))) ? $this->_run_mod_handler('cat', true, $_tmp, 'm_block_start.tpl') : smarty_modifier_cat($_tmp, 'm_block_start.tpl')), 'smarty_include_vars' => array()));
$this->_tpl_vars = $_smarty_tpl_vars;
unset($_smarty_tpl_vars);
 ?>
	<div style="padding: 10px;">
		<table class="lTable">
		<tr class="body">
			<td class="list_td_light">Import all categories from the uploaded XLS file</td>
			<td style="width: 5px;" rowspan="100"></td>
			<td class="list_td_light" align="center" style="width: 200px;">
				<input type="button" id="import_categories_button" value="<?php echo $this->_tpl_vars['lang']['importExportCategories_import']; ?>
" style="margin: 0;width: 100px;" />
			</td>
		</tr>
		</table>
	</div>
	<?php $_smarty_tpl_vars = $this->_tpl_vars;
$this->_smarty_include(array('smarty_include_tpl_file' => ((is_array($_tmp=((is_array($_tmp='blocks')) ? $this->_run_mod_handler('cat', true, $_tmp, @RL_DS) : smarty_modifier_cat($_tmp, @RL_DS)))) ? $this->_run_mod_handler('cat', true, $_tmp, 'm_block_end.tpl') : smarty_modifier_cat($_tmp, 'm_block_end.tpl')), 'smarty_include_vars' => array()));
$this->_tpl_vars = $_smarty_tpl_vars;
unset($_smarty_tpl_vars);
 ?>

	<div id="grid"></div>
	<script type="text/javascript" src="<?php echo @RL_PLUGINS_URL; ?>
importExportCategories/admin/static/lib.js"></script>
	<script type="text/javascript">//<![CDATA[
	<?php echo '

	function inportCategories(start) {
		$.getJSON(rlPlugins +\'importExportCategories/admin/import.php?start=\'+ start, function(response) {
			if ( response.next === true && response.start > start ) {
				inportCategories(response.start);
			}
			else {
				location.href=rlUrlHome +\'index.php?controller=\'+ controller +\'&done\';
			}
		});
	}

	$(document).ready(function(){

		$(\'#import_categories_button\').click(function() {
			inportCategories(0);
		});

		var importCategoriesGrid = new gridObj({
			key: \'importCategories\',
			id: \'grid\',
			ajaxUrl: rlPlugins + \'importExportCategories/admin/importExportCategories.inc.php?q=ext\',
			defaultSortField: false,
			title: lang[\'importExportCategories_titleOfManager\'],
			fields: [
				{name: \'name\', mapping: \'name\'},
				{name: \'parent\', mapping: \'parent\'},
				{name: \'type\', mapping: \'type\'},
				{name: \'path\', mapping: \'path\'},
				{name: \'level\', mapping: \'level\', type: \'int\'},
				{name: \'locked\', mapping: \'locked\'}
			],
			columns: [
				{
					header: lang[\'ext_name\'],
					dataIndex: \'name\',
					id: \'rlExt_item_bold\',
					width: 22
				},{
					header: lang[\'ext_parent\'],
					dataIndex: \'parent\',
					id: \'rlExt_item\',
					width: 15,
					renderer: function(value) {
						if ( !value ) {
							return \'<span style="color:#3D3D3D">'; ?>
<?php echo $this->_tpl_vars['lang']['no_parent']; ?>
<?php echo '</span>\';
						}
						return value;
					}
				},{
					header: lang[\'ext_type\'],
					dataIndex: \'type\',
					width: 10,
					renderer: function(value) {
						return \'<b>\'+ value +\'</b>\';
					}
				},{
					header: \''; ?>
<?php echo $this->_tpl_vars['lang']['category_url']; ?>
<?php echo '\',
					dataIndex: \'path\',
					width: 40,
                    renderer: function(value) {
                        if (!value) {
                            return \'<span style="color:#df7c41">will generated</span>\';
                        }
                        return value;
                    }
				},{
					header: lang[\'importExportCategories_rowLevel\'],
					dataIndex: \'level\',
					width: 8,
					renderer: function(value) {
						return \'<b>\'+ value +\'</b>\';
					}
				},{
					header: lang[\'ext_locked\'],
					dataIndex: \'locked\',
					width: 8,
					renderer: function(value) {
						if ( value == \'1\' ) {
							return lang[\'ext_yes\'];
						}
						return lang[\'ext_no\'];
					}
				}
			]
		});

		importCategoriesGrid.init();
		grid.push(importCategoriesGrid.grid);

	});
	'; ?>

	//]]>
	</script>

	<?php endif; ?>
	
<?php elseif ($_GET['action'] == 'export'): ?>

	<?php $_smarty_tpl_vars = $this->_tpl_vars;
$this->_smarty_include(array('smarty_include_tpl_file' => ((is_array($_tmp=((is_array($_tmp='blocks')) ? $this->_run_mod_handler('cat', true, $_tmp, @RL_DS) : smarty_modifier_cat($_tmp, @RL_DS)))) ? $this->_run_mod_handler('cat', true, $_tmp, 'm_block_start.tpl') : smarty_modifier_cat($_tmp, 'm_block_start.tpl')), 'smarty_include_vars' => array()));
$this->_tpl_vars = $_smarty_tpl_vars;
unset($_smarty_tpl_vars);
 ?>
	<form action="<?php echo $this->_tpl_vars['rlBaseC']; ?>
action=export" method="post" onsubmit="return submit_form();">
		<input type="hidden" name="submit" value="1" />
		<table class="form">
		<tr>
			<td>
				<div id="cat_checkboxed" style="margin: 0 0 8px;<?php if ($this->_tpl_vars['sPost']['cat_sticky']): ?>display: none<?php endif; ?>">
					<div class="tree">
						<?php $_from = $this->_tpl_vars['sections']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['section']):
?>
							<fieldset class="light">
								<legend id="legend_section_<?php echo $this->_tpl_vars['section']['ID']; ?>
" class="up" onclick="fieldset_action('section_<?php echo $this->_tpl_vars['section']['ID']; ?>
');"><?php echo $this->_tpl_vars['section']['name']; ?>
</legend>
								<div id="section_<?php echo $this->_tpl_vars['section']['ID']; ?>
">
									<?php if (! empty ( $this->_tpl_vars['section']['Categories'] )): ?>
										<?php $_smarty_tpl_vars = $this->_tpl_vars;
$this->_smarty_include(array('smarty_include_tpl_file' => ((is_array($_tmp=((is_array($_tmp='blocks')) ? $this->_run_mod_handler('cat', true, $_tmp, @RL_DS) : smarty_modifier_cat($_tmp, @RL_DS)))) ? $this->_run_mod_handler('cat', true, $_tmp, 'category_level_checkbox.tpl') : smarty_modifier_cat($_tmp, 'category_level_checkbox.tpl')), 'smarty_include_vars' => array('categories' => $this->_tpl_vars['section']['Categories'],'first' => true)));
$this->_tpl_vars = $_smarty_tpl_vars;
unset($_smarty_tpl_vars);
 ?>
									<?php else: ?>
										<div style="padding: 0 0 8px 10px;"><?php echo $this->_tpl_vars['lang']['no_items_in_sections']; ?>
</div>
									<?php endif; ?>
								</div>
							</fieldset>
						<?php endforeach; endif; unset($_from); ?>
					</div>
				</div>

				<script type="text/javascript">
				var submit_form;
				var tree_selected = <?php if ($_POST['categories']): ?>[<?php $_from = $_POST['categories']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }$this->_foreach['postcatF'] = array('total' => count($_from), 'iteration' => 0);
if ($this->_foreach['postcatF']['total'] > 0):
    foreach ($_from as $this->_tpl_vars['post_cat']):
        $this->_foreach['postcatF']['iteration']++;
?>['<?php echo $this->_tpl_vars['post_cat']; ?>
']<?php if (! ($this->_foreach['postcatF']['iteration'] == $this->_foreach['postcatF']['total'])): ?>,<?php endif; ?><?php endforeach; endif; unset($_from); ?>]<?php else: ?>false<?php endif; ?>;
				var tree_parentPoints = <?php if ($this->_tpl_vars['parentPoints']): ?>[<?php $_from = $this->_tpl_vars['parentPoints']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }$this->_foreach['parentF'] = array('total' => count($_from), 'iteration' => 0);
if ($this->_foreach['parentF']['total'] > 0):
    foreach ($_from as $this->_tpl_vars['parent_point']):
        $this->_foreach['parentF']['iteration']++;
?>['<?php echo $this->_tpl_vars['parent_point']; ?>
']<?php if (! ($this->_foreach['parentF']['iteration'] == $this->_foreach['parentF']['total'])): ?>,<?php endif; ?><?php endforeach; endif; unset($_from); ?>]<?php else: ?>false<?php endif; ?>;
				<?php echo '

				$(document).ready(function(){
					flynax.treeLoadLevel(\'checkbox\', \'flynax.openTree(tree_selected, tree_parentPoints)\', \'div#cat_checkboxed\');
					flynax.openTree(tree_selected, tree_parentPoints);

					$(\'input[name=cat_sticky]\').click(function(){
						$(\'#cat_checkboxed\').slideToggle();
						$(\'#cats_nav\').fadeToggle();
					});
					
					submit_form = function() {
						if ( $(\'#cat_checkboxed input[type=checkbox]:checked\').length > 0 || $(\'input[name=cat_sticky]:checked\').length > 0 ) {
							return true;
						}
						else {
							printMessage(\'info\', \''; ?>
<?php echo $this->_tpl_vars['lang']['importExportCategories_empty']; ?>
<?php echo '\');
							return false;
						}
					}
				});

				'; ?>

				</script>

				<div class="grey_area">
					<label><input class="checkbox" <?php if ($this->_tpl_vars['sPost']['cat_sticky']): ?>checked="checked"<?php endif; ?> type="checkbox" name="cat_sticky" value="true" /> <?php echo $this->_tpl_vars['lang']['sticky']; ?>
</label>
					<span id="cats_nav" <?php if ($this->_tpl_vars['sPost']['cat_sticky']): ?>class="hide"<?php endif; ?>>
						<span onclick="$('#cat_checkboxed div.tree input').attr('checked', true);" class="green_10"><?php echo $this->_tpl_vars['lang']['check_all']; ?>
</span>
						<span class="divider"> | </span>
						<span onclick="$('#cat_checkboxed div.tree input').attr('checked', false);" class="green_10"><?php echo $this->_tpl_vars['lang']['uncheck_all']; ?>
</span>
					</span>
				</div>
			</td>
		</tr>
		<tr>
			<td class="field">
				<input type="submit" id="export_btn" value="<?php echo $this->_tpl_vars['lang']['importExportCategories_export']; ?>
" />
			</td>
		</tr>
		</table>
	</form>
	<?php $_smarty_tpl_vars = $this->_tpl_vars;
$this->_smarty_include(array('smarty_include_tpl_file' => ((is_array($_tmp=((is_array($_tmp='blocks')) ? $this->_run_mod_handler('cat', true, $_tmp, @RL_DS) : smarty_modifier_cat($_tmp, @RL_DS)))) ? $this->_run_mod_handler('cat', true, $_tmp, 'm_block_end.tpl') : smarty_modifier_cat($_tmp, 'm_block_end.tpl')), 'smarty_include_vars' => array()));
$this->_tpl_vars = $_smarty_tpl_vars;
unset($_smarty_tpl_vars);
 ?>

<?php endif; ?>

<!-- export import categories tpl end -->